@@ -90,8 +90,10 @@ static void Main()
9090 }
9191 else
9292 {
93- // 1st: We get the input path of the mod we are going to install
94- string [ ] inputPaths = GetInputPaths ( ) ; string [ ] errorStrings = new string [ inputPaths . Length ] ;
93+ // ask the user for mod files using a file dialog
94+ string [ ] inputPaths = ShowFileChooser ( FileChooserType . File , Strings . FileChooserTitle ,
95+ Strings . FileChooserFilter , 4 ) ;
96+ string [ ] errorStrings = new string [ inputPaths . Length ] ;
9597 if ( inputPaths . Length < 1 ) return ;
9698
9799 List < ResultType > results = new List < ResultType > ( ) ;
@@ -130,12 +132,12 @@ static void Main()
130132 }
131133 catch ( Exception ex )
132134 {
133- errorStrings [ i ] = ex . Message ; results . Add ( ResultType . UnsupportedFile ) ;
135+ errorStrings [ i ] = ex . Message ;
136+ results . Add ( ResultType . UnsupportedFile ) ;
134137 }
135138 }
136- for ( int i = 0 ; i < results . Count ; i ++ ) //foreach (ResultType type in results)
139+ for ( int i = 0 ; i < results . Count ; i ++ )
137140 {
138- //int index = results.IndexOf(type);
139141 ResultType type = results [ i ] ;
140142 outcome += GetResultText ( type , Path . GetFileNameWithoutExtension ( inputPaths [ i ] ) , errorStrings [ i ] ) + "\n " ;
141143 }
@@ -145,23 +147,6 @@ static void Main()
145147 }
146148 }
147149 }
148- static string [ ] GetInputPaths ( )
149- {
150- string [ ] arguments = Environment . GetCommandLineArgs ( ) ;
151- // If the file path was specified as an argument (i.e. dragged to the installer)
152- if ( arguments . Length > 1 )
153- { List < string > paths = new List < string > ( ) ;
154- for ( int i = 1 ; i < arguments . Length ; i ++ ) //return arguments[1];
155- {
156- if ( File . Exists ( arguments [ i ] ) )
157- paths . Add ( arguments [ i ] ) ;
158- } return paths . ToArray ( ) ;
159- } else // No file specified, show the user a dialog to choose it
160- {
161- return ShowFileChooser ( FileChooserType . File , Strings . FileChooserTitle ,
162- Strings . FileChooserFilter , 4 ) ;
163- }
164- }
165150 static string [ ] ShowFileChooser ( FileChooserType type , string title , string filter , int filterIndex )
166151 {
167152 string [ ] paths = new string [ 0 ] ;
0 commit comments