Skip to content

Commit aaf28d2

Browse files
committed
Initialize/dispose console patch accessor while idle
1 parent 06f1e27 commit aaf28d2

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Refresher/UI/ConsolePatchForm.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,42 @@ public ConsolePatchForm() : base("PS3 Patch")
1212

1313
protected override void PathChanged(object? sender, EventArgs ev)
1414
{
15-
this.Accessor = new ConsolePatchAccessor(this._remoteAddress.Text);
15+
this.InitializePatchAccessor();
1616
base.PathChanged(sender, ev);
17+
this.DisposePatchAccessor();
1718
}
1819

1920
protected override void GameChanged(object? sender, EventArgs ev)
2021
{
22+
this.InitializePatchAccessor();
2123
base.GameChanged(sender, ev);
24+
this.DisposePatchAccessor();
25+
}
26+
27+
public override void CompletePatch(object? sender, EventArgs e)
28+
{
29+
this.InitializePatchAccessor();
30+
base.CompletePatch(sender, e);
31+
this.DisposePatchAccessor();
32+
}
33+
34+
protected override void RevertToOriginalExecutable(object? sender, EventArgs e)
35+
{
36+
this.InitializePatchAccessor();
37+
base.RevertToOriginalExecutable(sender, e);
38+
this.DisposePatchAccessor();
39+
}
40+
41+
private void InitializePatchAccessor()
42+
{
43+
this.DisposePatchAccessor();
44+
this.Accessor = new ConsolePatchAccessor(this._remoteAddress.Text);
45+
}
46+
47+
private void DisposePatchAccessor()
48+
{
49+
if (this.Accessor is IDisposable disposable)
50+
disposable.Dispose();
2251
}
2352

2453
protected override TableRow AddRemoteField()

Refresher/UI/IntegratedPatchForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public override IEnumerable<Button> AddExtraButtons()
196196
}
197197
}
198198

199-
private void RevertToOriginalExecutable(object? sender, EventArgs e)
199+
protected virtual void RevertToOriginalExecutable(object? sender, EventArgs e)
200200
{
201201
if (this.Accessor == null) return;
202202

0 commit comments

Comments
 (0)