@@ -13,6 +13,10 @@ namespace Universal_THCRAP_Launcher
13
13
public partial class Form1 : Form
14
14
{
15
15
private const string ConfigFile = "utl_config.js" ;
16
+ private readonly Image _custom = new Bitmap ( Resources . Custom ) ;
17
+ private readonly Image _game = new Bitmap ( Resources . Game ) ;
18
+
19
+ private readonly Image _gameAndCustom = new Bitmap ( Resources . GameAndCustom ) ;
16
20
private readonly List < string > _gamesList = new List < string > ( ) ;
17
21
18
22
private readonly Image _sortAscending = new Bitmap ( Resources . Sort_Ascending ) ;
@@ -154,6 +158,8 @@ private void Form1_Load(object sender, EventArgs e)
154
158
155
159
#endregion
156
160
161
+ #region Set default state for the sort/filter buttons
162
+
157
163
//Default sort
158
164
for ( var i = 0 ; i < 2 ; i ++ )
159
165
if ( Configuration1 . IsDescending [ i ] == "false" )
@@ -197,6 +203,11 @@ private void Form1_Load(object sender, EventArgs e)
197
203
}
198
204
}
199
205
206
+ //Default exe type button state
207
+ filterByType_button . BackgroundImage = _gameAndCustom ;
208
+
209
+ #endregion
210
+
200
211
Debug . WriteLine ( "Form1 Loaded" ) ;
201
212
}
202
213
@@ -385,7 +396,8 @@ private void Form1_Resize(object sender, EventArgs e)
385
396
star_button2 . Location . X + _resizeConstants [ 8 ] , filterByType_button . Location . Y ) ;
386
397
}
387
398
388
- private void label1_Click ( object sender , EventArgs e ) => Process . Start ( "https://github.com/Tudi20/Universal-THCRAP-Launcher" ) ;
399
+ private void label1_Click ( object sender , EventArgs e ) =>
400
+ Process . Start ( "https://github.com/Tudi20/Universal-THCRAP-Launcher" ) ;
389
401
390
402
private void sort_az_button1_Click ( object sender , EventArgs e )
391
403
{
@@ -461,7 +473,7 @@ private void star_button2_Click(object sender, EventArgs e)
461
473
star_button2 . BackgroundImage = _starHollow ;
462
474
for ( var n = listBox2 . Items . Count - 1 ; n >= 0 ; -- n )
463
475
{
464
- var filterItem = "★" ;
476
+ const string filterItem = "★" ;
465
477
if ( ! listBox2 . Items [ n ] . ToString ( ) . Contains ( filterItem ) )
466
478
listBox2 . Items . RemoveAt ( n ) ;
467
479
}
@@ -514,11 +526,37 @@ private void SelectedIndexChanged(object sender, EventArgs e)
514
526
}
515
527
}
516
528
517
- private void checkBox1_CheckedChanged ( object sender , EventArgs e ) => Configuration1 . ExitAfterStartup = checkBox1 . Checked ;
529
+ private void checkBox1_CheckedChanged ( object sender , EventArgs e ) =>
530
+ Configuration1 . ExitAfterStartup = checkBox1 . Checked ;
518
531
519
532
private void filterByType_button_Click ( object sender , EventArgs e )
520
533
{
534
+ if ( filterByType_button . BackgroundImage . Equals ( _gameAndCustom ) )
535
+ {
536
+ filterByType_button . BackgroundImage = _game ;
537
+ listBox2 . Items . Clear ( ) ;
538
+ foreach ( var item in _gamesList )
539
+ if ( ! item . Contains ( "_custom" ) )
540
+ listBox2 . Items . Add ( item ) ;
541
+ return ;
542
+ }
521
543
544
+ if ( filterByType_button . BackgroundImage . Equals ( _game ) )
545
+ {
546
+ filterByType_button . BackgroundImage = _custom ;
547
+ listBox2 . Items . Clear ( ) ;
548
+ foreach ( var item in _gamesList )
549
+ if ( item . Contains ( "_custom" ) )
550
+ listBox2 . Items . Add ( item ) ;
551
+ return ;
552
+ }
553
+
554
+ if ( ! filterByType_button . BackgroundImage . Equals ( _custom ) ) return ;
555
+ {
556
+ filterByType_button . BackgroundImage = _gameAndCustom ;
557
+ listBox2 . Items . Clear ( ) ;
558
+ foreach ( var item in _gamesList ) listBox2 . Items . Add ( item ) ;
559
+ }
522
560
}
523
561
}
524
562
0 commit comments