/// <summary> /// Our main entry point for the command line app /// </summary> /// <param name="args"></param> /// <returns></returns> public static int Main(string[] args) { Init(); LoadConfigFile(); ShowWelcomeScreen(); ShowCopyrightAndLicense(); ImportJob job = new ImportJob(); if ((args != null) && (args.Length > 0)) { _log.Debug("Loading arguments..."); if (!job.Load(args)) { _log.Debug("Error while loading arguments. Exiting."); return(-1); } if (!job.ExecuteJob()) { _log.Fatal("An error was encountered while performing the operation. Please examine the log output and try again if necessary."); } } else { DisplayOptions(); } //#if DEBUG // _log.Debug("Done! Press ANY KEY to Quit"); // Console.ReadKey(); //#endif return(0); }
/// <summary> /// Our main entry point for the command line app /// </summary> /// <param name="args"></param> /// <returns></returns> public static int Main(string[] args) { Init(); LoadConfigFile(); ShowWelcomeScreen(); ShowCopyrightAndLicense(); ImportJob job = new ImportJob(); if ((args != null) && (args.Length > 0)) { _log.Debug("Loading arguments..."); if (!job.Load(args)) { _log.Debug("Error while loading arguments. Exiting."); return -1; } if (!job.ExecuteJob()) { _log.Fatal("An error was encountered while performing the operation. Please examine the log output and try again if necessary."); } } else { DisplayOptions(); } //#if DEBUG // _log.Debug("Done! Press ANY KEY to Quit"); // Console.ReadKey(); //#endif return 0; }
public void TestFullLine() { string[] args = "-s Wyoming -y 2010 -outputFolder \"c:\\sandbox\\ACSDataErmine\\\" -workingFolder \"c:\\sandbox\\ACSDataErmine\\Wo-rking\\\" -v test_vars.txt -exportToShape".Split(' '); ImportJob job = new ImportJob(); if (!job.Load(args)) { Assert.Fail("Couldn't parse standard line for full line"); } Assert.AreEqual(AcsState.Wyoming, job.State, "State is wrong for args"); Assert.AreEqual("test_vars.txt", job.IncludedVariableFile, "variables file is wrong for args"); Assert.AreEqual("c:\\sandbox\\ACSDataErmine\\", job.OutputFolder, "Output folder is wrong!"); Assert.AreEqual("c:\\sandbox\\ACSDataErmine\\Wo-rking\\", job.WorkingFolder, "Working folder is wrong!"); Assert.AreEqual(true.ToString(), job.ExportToShapefile, true.ToString(), "flag param is wrong for args"); }
public void TestStandardLine() { var argsList = new string[][]{ ("-s Wyoming -e 150 -v my-VariablesFile.txt -jobName Test-01 " + (char)8211 + "exportToShape").Split(' '), ("-s Wyoming -e 150 " + (char)8211 + "v my-VariablesFile.txt -jobName Test-01 -exportToShape").Split(' '), ((char)8211 + "s Wyoming -e 150 -v my-VariablesFile.txt -jobName Test-01 -exportToShape").Split(' ') }; for (int i = 0; i < argsList.Length; i++) { var args = argsList[i]; ImportJob job = new ImportJob(); if (!job.Load(args)) { Assert.Fail("Couldn't parse standard line for argsList[{0}]", i); } Assert.AreEqual(AcsState.Wyoming, job.State, "State is wrong for argsList[{0}]", i); Assert.AreEqual("my-VariablesFile.txt", job.IncludedVariableFile, "variables file is wrong for argsList[{0}]", i); Assert.AreEqual("Test-01", job.JobName, "Job name is wrong for argsList[{0}]", i); Assert.AreEqual(true.ToString(), job.ExportToShapefile, true.ToString(), "flag param is wrong for argsList[{0}]", i); } }