@@ -31,8 +31,11 @@ public abstract class PatchForm<TPatcher> : RefresherForm where TPatcher : class
31
31
32
32
private bool _usedAutoDiscover = false ;
33
33
34
- protected PatchForm ( string subtitle ) : base ( subtitle , new Size ( 700 , - 1 ) , false )
34
+ protected PatchForm ( string subtitle ) : base ( subtitle + " [LEGACY PATCHER!]" , new Size ( 700 , - 1 ) , false )
35
35
{
36
+ MessageBox . Show ( "This legacy patch method is deprecated and might be removed in a future release.\n \n " +
37
+ "Please use the other patchers, or let us know if this is necessary for you." , "Deprecation Warning" , MessageBoxType . Warning ) ;
38
+
36
39
this . _messages = new ListBox { Height = 200 } ;
37
40
this . _patchButton = new Button ( this . Patch ) { Text = "Patch!" , Enabled = false } ;
38
41
@@ -45,38 +48,37 @@ protected void InitializePatcher()
45
48
TableLayout formPanel = this . FormPanel ;
46
49
formPanel . Spacing = new Size ( 5 , 5 ) ;
47
50
formPanel . Padding = new Padding ( 0 , 0 , 0 , 10 ) ;
48
-
49
- StackLayout layout ;
50
51
51
52
this . Content = new Splitter
52
53
{
53
54
Orientation = Orientation . Vertical ,
54
55
Panel1 = formPanel ,
55
56
56
57
// ReSharper disable once RedundantExplicitParamsArrayCreation
57
- Panel2 = layout = new StackLayout ( new StackLayoutItem [ ]
58
- {
58
+ Panel2 = new StackLayout ( [
59
59
this . _messages ,
60
- new Button ( this . Guide ) { Text = "View guide" } ,
61
60
new Button ( this . InvokeAutoDiscover ) { Text = "AutoDiscover" } ,
62
61
this . _patchButton ,
63
- } )
62
+ new Label
63
+ {
64
+ Text = "This is a legacy patcher. Support will not be provided." ,
65
+ TextAlignment = TextAlignment . Center ,
66
+ TextColor = Colors . Orange ,
67
+ } ,
68
+ ] )
64
69
{
65
70
Padding = new Padding ( 0 , 10 , 0 , 0 ) ,
66
71
Spacing = 5 ,
67
72
HorizontalContentAlignment = HorizontalAlignment . Stretch ,
68
73
VerticalContentAlignment = VerticalAlignment . Bottom ,
69
74
} ,
70
75
} ;
71
-
72
- foreach ( Button button in this . AddExtraButtons ( ) )
73
- layout . Items . Add ( button ) ;
74
76
75
77
this . UrlField . TextChanged += this . Reverify ;
76
78
this . UrlField . PlaceholderText = "http://localhost:10061/lbp" ;
77
79
}
78
80
79
- protected static TableRow AddField < TControl > ( string labelText , out TControl control , Button ? button = null , int forceHeight = - 1 ) where TControl : Control , new ( )
81
+ protected static TableRow AddField < TControl > ( string labelText , out TControl control ) where TControl : Control , new ( )
80
82
{
81
83
if ( ! string . IsNullOrWhiteSpace ( labelText ) ) labelText += ':' ;
82
84
@@ -87,16 +89,6 @@ protected void InitializePatcher()
87
89
} ;
88
90
89
91
control = new TControl ( ) ;
90
- if ( forceHeight != - 1 ) control . Height = forceHeight ;
91
-
92
- if ( button != null )
93
- {
94
- DynamicLayout buttonLayout = new ( ) ;
95
- buttonLayout . AddRow ( button , control ) ;
96
- buttonLayout . Spacing = new Size ( 5 , 0 ) ;
97
-
98
- return new TableRow ( label , buttonLayout ) ;
99
- }
100
92
101
93
return new TableRow ( label , control ) ;
102
94
}
@@ -106,40 +98,6 @@ public virtual void CompletePatch(object? sender, EventArgs e)
106
98
// Not necessary for some patchers maybe
107
99
}
108
100
109
- public virtual IEnumerable < Button > AddExtraButtons ( )
110
- {
111
- return Array . Empty < Button > ( ) ;
112
- }
113
-
114
- public virtual void Guide ( object ? sender , EventArgs e )
115
- {
116
- MessageBox . Show ( "No guide exists for this patch method yet, so stay tuned!" , MessageBoxType . Warning ) ;
117
- }
118
-
119
- protected void OpenUrl ( string url )
120
- {
121
- try
122
- {
123
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
124
- Process . Start ( new ProcessStartInfo ( url ) { UseShellExecute = true } ) ;
125
- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
126
- Process . Start ( "xdg-open" , url ) ;
127
- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
128
- Process . Start ( "open" , url ) ;
129
- else
130
- throw new PlatformNotSupportedException ( "Cannot open a URL on this platform." ) ;
131
- }
132
- catch ( Exception e )
133
- {
134
- State . Logger . LogError ( OSIntegration , e . ToString ( ) ) ;
135
- MessageBox . Show ( "We couldn't open your browser due to an error.\n " +
136
- $ "You can use this link instead: { url } \n \n " +
137
- $ "Exception details: { e . GetType ( ) . Name } { e . Message } ",
138
- MessageBoxType . Error ) ;
139
- }
140
- // based off of https://stackoverflow.com/a/43232486
141
- }
142
-
143
101
private void InvokeAutoDiscover ( object ? sender , EventArgs arg )
144
102
{
145
103
string url = this . UrlField . Text ;
@@ -257,8 +215,6 @@ private void Patch(object? sender, EventArgs e)
257
215
if ( ! this . _patchButton . Enabled ) return ; // shouldn't happen ever but just in-case
258
216
if ( this . Patcher == null ) return ;
259
217
260
- this . BeforePatch ( sender , e ) ;
261
-
262
218
if ( ! this . _usedAutoDiscover )
263
219
{
264
220
DialogResult result = MessageBox . Show ( "You didn't use AutoDiscover. Would you like to try to run it now?" , MessageBoxButtons . YesNoCancel , MessageBoxType . Question ) ;
@@ -285,8 +241,6 @@ private void Patch(object? sender, EventArgs e)
285
241
286
242
this . CompletePatch ( sender , e ) ;
287
243
}
288
-
289
- protected virtual void BeforePatch ( object ? sender , EventArgs e ) { }
290
244
291
245
protected void FailVerify ( string reason , Exception ? e = null , bool clear = true )
292
246
{
0 commit comments