11using System ;
22using System . Diagnostics ;
33using System . IO ;
4+ using System . Linq ;
45using System . Threading . Tasks ;
56using System . Windows . Forms ;
67using System . Xml ;
@@ -18,9 +19,9 @@ internal static class Program
1819 [ STAThread ]
1920 static void Main ( string [ ] args )
2021 {
21- // Run app from temp folder if it isn't already
22- // This allows the executable to be deleted when updating the component or uninstalling Flashpoint
23- if ( ! Debugger . IsAttached )
22+ // Run app from temp folder as long as /notemp argument isn't passed
23+ // This allows the executable to be deleted when updating its component or uninstalling Flashpoint
24+ if ( ! args . Any ( v => v . ToLower ( ) == "/notemp" ) && ! Debugger . IsAttached )
2425 {
2526 string realPath = AppDomain . CurrentDomain . BaseDirectory ;
2627 string realFile = AppDomain . CurrentDomain . FriendlyName ;
@@ -88,14 +89,18 @@ static void Main(string[] args)
8889 if ( args . Length > 0 )
8990 {
9091 // Open update tab on startup if /update argument is passed
91- if ( args [ 0 ] . ToLower ( ) == "/update" )
92+ if ( args . Any ( v => v . ToLower ( ) == "/update" ) )
9293 {
9394 FPM . OpenUpdateTab = true ;
9495 }
95- // Automatically download component if /download argument is passed
96- else if ( args . Length > 1 && args [ 0 ] . ToLower ( ) == "/download" )
96+ else
9797 {
98- FPM . AutoDownload = args [ 1 ] . ToLower ( ) ;
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 )
101+ {
102+ FPM . AutoDownload = args [ index + 1 ] . ToLower ( ) ;
103+ }
99104 }
100105 }
101106
0 commit comments