Exemplo n.º 1
0
		public static int Main(string[] args)
		{
			try {
				UI.TextWriter = Console.Out;

				Assembly assembly = Assembly.GetExecutingAssembly();
				VersionRelease versionRelease = new VersionRelease(assembly);
				UI.WriteLine("Landis-II {0}", versionRelease);
				UI.WriteLine("Copyright 2004-2005 University of Wisconsin");
				UI.WriteLine();
	
				if (args.Length == 0) {
					UI.WriteLine("Error: No scenario file specified.");
					return 1;
				}
				if (args.Length > 1) {
					UI.WriteLine("Error: Extra argument(s) on command line:");
					StringBuilder argsList = new StringBuilder();
					argsList.Append(" ");
					for (int i = 1; i < args.Length; ++i)
						argsList.AppendFormat(" {0}", args[i]);
					UI.WriteLine(argsList.ToString());
					return 1;
				}

				string appDir = Application.Directory;
				PlugIns.Dataset plugIns = new PlugIns.Dataset(Path.Combine(appDir, "plug-ins.xml"));
				RasterIO.DriverManager driverMgr = new RasterIO.DriverManager(Path.Combine(appDir, "raster-drivers.xml"));
				Model model = new Model(plugIns, driverMgr);
				model.Run(args[0]);
				return 0;
			}
			catch (ApplicationException exc) {
				UI.WriteLine(exc.Message);
				return 1;
			}
			catch (Exception exc) {
				UI.WriteLine("Internal error occurred within the program:");
				UI.WriteLine("  {0}", exc.Message);
				if (exc.InnerException != null) {
					UI.WriteLine("  {0}", exc.InnerException.Message);
				}
				UI.WriteLine();
				UI.WriteLine("Stack trace:");
				UI.WriteLine(exc.StackTrace);
				return 1;
			}
		}
Exemplo n.º 2
0
        //---------------------------------------------------------------------

        public static int Main(string[] args)
        {
            try {
                Assembly coreAssembly = Assembly.GetAssembly(typeof(Landis.PlugIns.PlugInInfo));
				VersionRelease versionRelease = new VersionRelease(coreAssembly);
                Console.WriteLine("Landis-II {0}", versionRelease);
                
                Assembly myAssembly = Assembly.GetExecutingAssembly();
				versionRelease = new VersionRelease(myAssembly);
                Console.WriteLine("Extensions Administration Tool {0}", versionRelease);

                Console.WriteLine("Copyright 2005-2006 University of Wisconsin");
                Console.WriteLine();

                ICommand command = ParseArgs(args);
                InstallingExtension = command is InstallCommand;
                if (command != null)
                    command.Execute();
                return 0;
            }
            catch (ApplicationException exc) {
                Console.WriteLine(exc.Message);
                return 1;
            }
            catch (Exception exc) {
                Console.WriteLine("Internal error occurred within the program:");
                Console.WriteLine("  {0}", exc.Message);
                if (exc.InnerException != null) {
                    Console.WriteLine("  {0}", exc.InnerException.Message);
                }
                Console.WriteLine();
                Console.WriteLine("Stack trace:");
                Console.WriteLine(exc.StackTrace);
                return 1;
            }
        }