File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,6 +191,8 @@ public static class FPM
191191
192192 // Controls whether the update tab is selected at launch
193193 public static bool OpenUpdateTab { get ; set ; } = false ;
194+ // Controls which component (if any) will be automatically downloaded at launch
195+ public static string AutoDownload { get ; set ; } = "" ;
194196
195197 // Object for tracking numerous file size sums
196198 public static class SizeTracker
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ private void Main_Load(object sender, EventArgs e)
3737
3838 FPM . SyncManager ( true ) ;
3939
40+ if ( FPM . AutoDownload . Length == 0 )
4041 {
4142 long totalSizeChange = 0 ;
4243
@@ -106,6 +107,18 @@ void AddToQueue(Component component, long oldSize)
106107 UpdateButton . Text += $ " ({ FPM . GetFormattedBytes ( totalSizeChange ) } )";
107108 }
108109 }
110+ else
111+ {
112+ var query = ComponentList . Nodes . Find ( FPM . AutoDownload , true ) ;
113+
114+ if ( query . Length > 0 && ! query [ 0 ] . Checked )
115+ {
116+ query [ 0 ] . Checked = true ;
117+ ChangeButton_Click ( this , new EventArgs ( ) ) ;
118+ }
119+
120+ Environment . Exit ( 0 ) ;
121+ }
109122
110123 if ( FPM . OpenUpdateTab ) TabControl . SelectTab ( 1 ) ;
111124 }
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ static void Main(string[] args)
4848 Application . SetCompatibleTextRenderingDefault ( false ) ;
4949
5050 // Load config, or create if it doesn't exist
51-
5251 try
5352 {
5453 var configReader = File . ReadAllLines ( FPM . ConfigFile ) ;
@@ -65,7 +64,6 @@ static void Main(string[] args)
6564 }
6665
6766 // Download and parse component list
68-
6967 Stream listStream = null ;
7068 Task . Run ( async ( ) => { listStream = await new DownloadService ( ) . DownloadFileTaskAsync ( FPM . ListURL ) ; } ) . Wait ( ) ;
7169
@@ -87,11 +85,22 @@ static void Main(string[] args)
8785 // Verify that the configured Flashpoint path is valid
8886 FPM . VerifySourcePath ( ) ;
8987
90- // Open update tab on startup if /update argument is passed
91- if ( args . Length > 0 && args [ 0 ] . ToLower ( ) == "/update" ) FPM . OpenUpdateTab = true ;
88+ if ( args . Length > 0 )
89+ {
90+ // Open update tab on startup if /update argument is passed
91+ if ( args [ 0 ] . ToLower ( ) == "/update" )
92+ {
93+ FPM . OpenUpdateTab = true ;
94+ }
95+ // Automatically download component if /download argument is passed
96+ else if ( args . Length > 1 && args [ 0 ] . ToLower ( ) == "/download" )
97+ {
98+ FPM . AutoDownload = args [ 1 ] . ToLower ( ) ;
99+ }
100+ }
92101
93102 // Display the application window
94- Application . Run ( new Main ( ) ) ;
103+ Application . Run ( new Main ( ) { Opacity = FPM . AutoDownload . Length > 0 ? 0 : 1 } ) ;
95104 }
96105 }
97106}
You can’t perform that action at this time.
0 commit comments