2
2
using FAES_GUI . CustomControls ;
3
3
using System ;
4
4
using System . Drawing ;
5
+ using System . Globalization ;
5
6
using System . IO ;
6
7
using System . Net ;
7
8
using System . Text ;
@@ -20,7 +21,7 @@ public DevForm()
20
21
InitializeComponent ( ) ;
21
22
22
23
titleLabel . Text += Program . GetVersion ( ) ;
23
- this . Text = titleLabel . Text ;
24
+ base . Text = titleLabel . Text ;
24
25
25
26
Console . SetOut ( new RichTextBoxWriter ( consoleTextBox ) ) ;
26
27
}
@@ -125,22 +126,7 @@ private void DoCheckUpdate()
125
126
126
127
private void ExportLog_Click ( object sender , EventArgs e )
127
128
{
128
- string logPath = "FileAES-" + DateTime . UtcNow . Subtract ( new DateTime ( 1970 , 1 , 1 ) ) . TotalSeconds . ToString ( ) + ".log" ;
129
-
130
- _overrideLogPath = Program . programManager . GetLogPath ( ) ;
131
-
132
- _overrideLogPath = _overrideLogPath . Replace ( '/' , '\\ ' ) . TrimStart ( '/' , '\\ ' ) ;
133
-
134
- if ( ! string . IsNullOrWhiteSpace ( _overrideLogPath ) )
135
- {
136
- if ( _overrideLogPath . Contains ( "{default}" ) || _overrideLogPath . Contains ( "{d}" ) )
137
- logPath = _overrideLogPath . Replace ( "{default}" , logPath ) . Replace ( "{d}" , logPath ) ;
138
- else
139
- logPath = _overrideLogPath ;
140
-
141
- string dir = Directory . GetParent ( logPath ) . FullName ;
142
- if ( ! Directory . Exists ( dir ) ) Directory . CreateDirectory ( dir ) ;
143
- }
129
+ string logPath = Utilities . CreateLogFile ( true ) ;
144
130
145
131
try
146
132
{
@@ -175,8 +161,7 @@ private void CommandInput(RichTextBox textbox)
175
161
176
162
if ( input [ 0 ] == "cryptostreambuffer" || input [ 0 ] == "csbuffer" || input [ 0 ] == "buffer" )
177
163
{
178
- uint csBufferTmp = 0 ;
179
- if ( input . Length > 1 && ! string . IsNullOrEmpty ( input [ 1 ] ) && uint . TryParse ( input [ 1 ] , out csBufferTmp ) )
164
+ if ( input . Length > 1 && ! string . IsNullOrEmpty ( input [ 1 ] ) && uint . TryParse ( input [ 1 ] , out uint csBufferTmp ) )
180
165
{
181
166
Logging . Log ( String . Format ( "CryptoStream Buffer set to {0} bytes" , csBufferTmp ) ) ;
182
167
FileAES_Utilities . SetCryptoStreamBuffer ( csBufferTmp ) ;
@@ -222,7 +207,7 @@ private void CommandInput(RichTextBox textbox)
222
207
string verCheck = String . Format ( "https://api.mullak99.co.uk/FAES/IsUpdate.php?app=faes_gui&ver=latest&branch={0}&showver=true" , branch ) ;
223
208
224
209
Logging . Log ( String . Format ( "Getting the latest FAES_GUI version number on branch '{0}'." , branch ) ) ;
225
- Logging . Log ( String . Format ( "This process may take a few seconds..." ) ) ;
210
+ Logging . Log ( "This process may take a few seconds..." ) ;
226
211
227
212
WebClient webClient = new WebClient ( ) ;
228
213
string latestVer = webClient . DownloadString ( new Uri ( verCheck ) ) ;
@@ -234,7 +219,7 @@ private void CommandInput(RichTextBox textbox)
234
219
}
235
220
catch
236
221
{
237
- Logging . Log ( String . Format ( "Unable to connect to the update server! Please check your internet connection." ) , Severity . WARN ) ;
222
+ Logging . Log ( "Unable to connect to the update server! Please check your internet connection." , Severity . WARN ) ;
238
223
}
239
224
} ) ;
240
225
updateCheckThread . Start ( ) ;
@@ -246,7 +231,7 @@ private void CommandInput(RichTextBox textbox)
246
231
string latestVer = GetLatestVersion ( ) ;
247
232
string currentVer = ConvertVersionToNonFormatted ( Program . GetVersion ( ) ) ;
248
233
249
- string branch = Program . programManager . GetBranch ( ) ;
234
+ Program . programManager . GetBranch ( ) ;
250
235
string compareVersions = String . Format ( "https://api.mullak99.co.uk/FAES/CompareVersions.php?app=faes_gui&branch={0}&version1={1}&version2={2}" , "dev" , currentVer , latestVer ) ;
251
236
252
237
WebClient client = new WebClient ( ) ;
@@ -255,19 +240,19 @@ private void CommandInput(RichTextBox textbox)
255
240
string result = utf . GetString ( html ) . ToLower ( ) ;
256
241
257
242
if ( String . IsNullOrEmpty ( result ) || result == "null" )
258
- Logging . Log ( String . Format ( "Unable to connect to the update server! Please check your internet connection." ) , Severity . WARN ) ;
243
+ Logging . Log ( "Unable to connect to the update server! Please check your internet connection." , Severity . WARN ) ;
259
244
else if ( result . Contains ( "not exist in the database!" ) || result == "version1 is newer than version2" )
260
245
Logging . Log ( String . Format ( "You are on a private build. ({0} is newer than {1})." , currentVer , latestVer ) ) ;
261
246
else if ( result == "version1 is older than version2" )
262
247
Logging . Log ( String . Format ( "You are on an outdated build. ({0} is older than {1})." , currentVer , latestVer ) ) ;
263
248
else if ( result == "version1 is equal to version2" )
264
249
Logging . Log ( String . Format ( "You are on the latest build. ({0} is equal to {1})." , currentVer , latestVer ) ) ;
265
250
else
266
- Logging . Log ( String . Format ( "Unable to connect to the update server! Please check your internet connection." ) , Severity . WARN ) ;
251
+ Logging . Log ( "Unable to connect to the update server! Please check your internet connection." , Severity . WARN ) ;
267
252
}
268
253
catch
269
254
{
270
- Logging . Log ( String . Format ( "Unable to connect to the update server! Please check your internet connection." ) , Severity . WARN ) ;
255
+ Logging . Log ( "Unable to connect to the update server! Please check your internet connection." , Severity . WARN ) ;
271
256
}
272
257
273
258
DoCheckUpdate ( ) ;
@@ -285,13 +270,13 @@ private void CommandInput(RichTextBox textbox)
285
270
verToSpoof += input [ i ] . Replace ( "\" " , "" ) . Replace ( "\' " , "" ) ;
286
271
verToSpoof += " " ;
287
272
}
288
- verToSpoof . TrimEnd ( ' ' ) ;
273
+ verToSpoof = verToSpoof . TrimEnd ( ' ' ) ;
289
274
}
290
275
else verToSpoof = input [ 1 ] ;
291
276
292
277
if ( verToSpoof . ToLower ( ) == "reset" || verToSpoof . ToLower ( ) == "off" || verToSpoof . ToLower ( ) == "false" )
293
278
{
294
- Logging . Log ( String . Format ( "Disabled Version Spoofing." ) ) ;
279
+ Logging . Log ( "Disabled Version Spoofing." ) ;
295
280
Program . SetSpoofedVersion ( false ) ;
296
281
}
297
282
else
@@ -302,7 +287,7 @@ private void CommandInput(RichTextBox textbox)
302
287
}
303
288
else
304
289
{
305
- Logging . Log ( String . Format ( "Disabled Version Spoofing." ) ) ;
290
+ Logging . Log ( "Disabled Version Spoofing." ) ;
306
291
Program . SetSpoofedVersion ( false ) ;
307
292
}
308
293
}
@@ -390,8 +375,7 @@ private void TooFewArgsError(string command)
390
375
391
376
private void ConsoleInputTextBox_TextChanged ( object sender , EventArgs e )
392
377
{
393
- if ( string . IsNullOrWhiteSpace ( consoleInputTextBox . Text ) ) sendInputButton . Enabled = false ;
394
- else sendInputButton . Enabled = true ;
378
+ sendInputButton . Enabled = ! string . IsNullOrWhiteSpace ( consoleInputTextBox . Text ) ;
395
379
}
396
380
397
381
private string GetLatestVersion ( )
0 commit comments