public static void Main(string[] args) { string routine = "StateModMain.Main"; try { // Set program name and version IOUtil.setProgramData(PROGRAM_NAME, PROGRAM_VERSION, args); // Set the initial working directory based on users's starting location // - this is used to determine the absolute path for the response file setWorkingDirInitial(); // Determine the response file and working directory so that the log file can be opened. // - do this by parsing the command line arguments and detecting response file try { bool initialChecks = true; parseArgs(args, initialChecks); } catch (Exception e2) { Message.printWarning(1, routine, "Error parsing command line. Exiting."); Message.printWarning(3, routine, e2); quitProgram(1); } // If a response file was not specified, print the usage and exit if (responseFile == null) { Console.WriteLine(""); Console.WriteLine("No response file was specified."); Console.WriteLine(""); printUsage(); quitProgram(1); } // If a response file was specified but does not exist, print an error and exit //File f = new File(responseFile); if (!File.Exists(responseFile)) { Console.WriteLine(""); Console.WriteLine("Response file \"" + responseFile + "\" does not exist."); Console.WriteLine(""); printUsage(); quitProgram(1); } // Initialize logging initializeLogging(); // Now parse the command line arguments // - the response file is determined first so that the working directory is determined // - and then other actions are taken try { bool initialChecks = false; parseArgs(args, initialChecks); } catch (Exception e2) { Message.printWarning(1, routine, "Error parsing command line. Exiting."); Message.printWarning(3, routine, e2); quitProgram(1); } // If no run mode was requested, print an error if (runMode == null) { Console.WriteLine(""); Console.WriteLine("No run mode was specified."); Console.WriteLine(""); printUsage(); quitProgram(1); } else { Console.WriteLine("Run mode is " + runMode); } // Error indicator bool error = false; // Open the dataset by reading the response file. // - try reading dataset files try { bool readData = true; // Read the data files (except for time series) bool readTimeSeries = true; // Read the time series files bool useGUI = false; // No UI is defined //JFrame parent = null; // A JFrame if UI is used, not implemented here dataset = new StateMod_DataSet(); //TODO @jurentie 03/25/2019 - removed parent dataset.readStateModFile(responseFile, readData, readTimeSeries, useGUI);//, parent); //Message.printStatus(1, routine, dataset.ToString()); } catch (Exception e2) { Message.printWarning(1, routine, "Error reading response file. See the log file."); Message.printWarning(3, routine, e2); } if (!error) { // Run StateMod for the requested run mode, consistent with the original software but // - will enhance this for additional command line options try { //RunStateMod(dataset, runMode); } catch (Exception e2) { Message.printWarning(1, routine, "Error running StateMod. See the log file."); Message.printWarning(3, routine, e2); } } } catch { quitProgram(1); } Console.WriteLine("Hit any key to exit console"); Console.ReadKey(); }