File tree Expand file tree Collapse file tree 4 files changed +20
-16
lines changed Expand file tree Collapse file tree 4 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,8 @@ public static class FPM
190
190
public static bool UpdateMode { get ; set ; } = false ;
191
191
// Controls whether the update tab is selected at launch
192
192
public static bool OpenUpdateTab { get ; set ; } = false ;
193
- // Controls which component (if any) will be automatically downloaded at launch
194
- public static string AutoDownload { get ; set ; } = "" ;
193
+ // Controls components that will be automatically downloaded at launch
194
+ public static List < string > AutoDownload { get ; set ; } = new List < string > ( ) ;
195
195
196
196
// Total size of every downloaded component; managed by SyncManager() function
197
197
public static long DownloadedSize { get ; set ; } = 0 ;
Original file line number Diff line number Diff line change @@ -37,18 +37,17 @@ private void Main_Load(object sender, EventArgs e)
37
37
38
38
FPM . SyncManager ( ) ;
39
39
40
- if ( FPM . AutoDownload . Length > 0 )
40
+ if ( FPM . AutoDownload . Count > 0 )
41
41
{
42
- var query = ComponentList . Nodes . Find ( FPM . AutoDownload , true ) ;
43
-
44
- if ( query . Length > 0 && ! query [ 0 ] . Checked )
42
+ foreach ( string id in FPM . AutoDownload )
45
43
{
46
- query [ 0 ] . Checked = true ;
47
- FPM . CheckDependencies ( false ) ;
48
-
49
- ChangeButton_Click ( this , new EventArgs ( ) ) ;
44
+ var query = ComponentList . Nodes . Find ( id , true ) ;
45
+ if ( query . Length > 0 ) query [ 0 ] . Checked = true ;
50
46
}
51
47
48
+ FPM . CheckDependencies ( false ) ;
49
+ ChangeButton_Click ( this , new EventArgs ( ) ) ;
50
+
52
51
Environment . Exit ( 0 ) ;
53
52
}
54
53
@@ -116,7 +115,7 @@ private void ChangeButton_Click(object sender, EventArgs e)
116
115
117
116
FPM . UpdateMode = false ;
118
117
119
- var operationWindow = new Operate ( ) { TopMost = FPM . AutoDownload != "" } ;
118
+ var operationWindow = new Operate ( ) { TopMost = FPM . AutoDownload . Count > 0 } ;
120
119
operationWindow . ShowDialog ( ) ;
121
120
}
122
121
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ private async void Operation_Load(object sender, EventArgs e)
112
112
113
113
TaskbarManager . Instance . SetProgressState ( TaskbarProgressBarState . NoProgress , FPM . Main . Handle ) ;
114
114
115
- if ( FPM . AutoDownload == "" ) FPM . SyncManager ( ) ;
115
+ if ( FPM . AutoDownload . Count == 0 ) FPM . SyncManager ( ) ;
116
116
117
117
cancelStatus = 2 ;
118
118
Close ( ) ;
Original file line number Diff line number Diff line change @@ -96,16 +96,21 @@ static void Main(string[] args)
96
96
else
97
97
{
98
98
// Automatically download component if /download argument is passed
99
- int index = args . ToList ( ) . FindIndex ( v => v . ToLower ( ) == "/download" ) ;
100
- if ( index >= 0 && index < args . Length - 1 )
99
+ var argsList = args . ToList ( ) ;
100
+ int first = argsList . FindIndex ( v => v . ToLower ( ) == "/download" ) ;
101
+
102
+ if ( first > - 1 && first < argsList . Count - 1 )
101
103
{
102
- FPM . AutoDownload = args [ index + 1 ] . ToLower ( ) ;
104
+ int last = argsList . FindIndex ( first + 1 , v => v . StartsWith ( "/" ) ) ;
105
+ if ( last == - 1 ) last = argsList . Count ;
106
+
107
+ FPM . AutoDownload . AddRange ( argsList . Skip ( first + 1 ) . Take ( last - first - 1 ) ) ;
103
108
}
104
109
}
105
110
}
106
111
107
112
// Display the application window
108
- Application . Run ( new Main ( ) { Opacity = FPM . AutoDownload == "" ? 1 : 0 } ) ;
113
+ Application . Run ( new Main ( ) { Opacity = FPM . AutoDownload . Count == 0 ? 1 : 0 } ) ;
109
114
}
110
115
}
111
116
}
You can’t perform that action at this time.
0 commit comments