コード例 #1
0
		public void RunApplication(string[] args)
		{
			var commandLine = new CommandLine();
			commandLine.Parse(args);

			using (var @lock = CreateLock(string.IsNullOrEmpty(commandLine.LockName) ? @"F17BFCF1-0832-4575-9C7D-F30D8C359159" : commandLine.LockName, commandLine.AddGlobalPrefix))
			{
				Console.WriteLine("Acquiring lock");

				@lock.Lock();
				Console.WriteLine("Acquired lock");
				try
				{
					Console.WriteLine("Holding lock for {0} seconds", commandLine.HoldTime);
					Thread.Sleep(1000*commandLine.HoldTime);
				}
				finally
				{
					Console.WriteLine("Released lock");
					@lock.Unlock();
				}
			}

			Console.WriteLine("Press any key to exit...");
			Console.ReadKey(true);
		}
コード例 #2
0
        public void Run(string[] args)
        {
            CommandLine commandLine = new CommandLine();
            commandLine.AddOption("Verbose", false, "-verbose");

            commandLine.Parse(args);

            if ((bool)commandLine.GetOption("-h"))
            {
                commandLine.Help("Katahdin Interpreter");
                return;
            }

            Runtime runtime = new Runtime(true, false, false, false,
                (bool)commandLine.GetOption("-verbose"));

            //new ConsoleParseTrace(runtime);

            runtime.SetUp(commandLine.Args);

            if (!((bool)commandLine.GetOption("-nostd")))
                runtime.ImportStandard();

            foreach (string file in commandLine.Files)
                runtime.Import(file);
        }
コード例 #3
0
		public void RunApplication(string[] args)
		{
			var cmdLine = new CommandLine();
			cmdLine.Parse(args);

			string path = !String.IsNullOrEmpty(cmdLine.OutputDirectory)
							? cmdLine.OutputDirectory
			              	: Path.Combine(Environment.CurrentDirectory, "OverlayTestImages");

			var testImages = new GeneratedOverlayTestImages(path);
			foreach (var file in testImages.GetAll())
				Console.WriteLine(file.Filename);
		}
コード例 #4
0
        public void RunApplication(string[] args)
        {
            var commandLine = new CommandLine();
            try
            {
                commandLine.Parse(args);
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Info, e);
                Console.WriteLine(e.Message);
                commandLine.PrintUsage(Console.Out);
                Environment.Exit(-1);
            }

            try
            {
                DicomServer.DicomServer.UpdateConfiguration(new DicomServerConfiguration
                                                                {
                                                                    HostName = commandLine.HostName,
                                                                    AETitle = commandLine.AETitle,
                                                                    Port = commandLine.Port
                                                                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message); 
                Platform.Log(LogLevel.Warn, e);
                Environment.Exit(-1);
            }

            try
            {
                if (!String.IsNullOrEmpty(commandLine.FileStoreDirectory))
                    StudyStore.UpdateConfiguration(new StorageConfiguration
                                                   {
                                                       FileStoreDirectory = commandLine.FileStoreDirectory,
                                                       MinimumFreeSpacePercent =
                                                           commandLine.MinimumFreeSpacePercent != null
                                                               ? double.Parse(commandLine.MinimumFreeSpacePercent)
                                                               : StorageConfiguration.AutoMinimumFreeSpace
                                                   });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Platform.Log(LogLevel.Warn, e);
                Environment.Exit(-1);
            }
        }
コード例 #5
0
        public void RunApplication(string[] args)
        {
            CommandLine cmdLine = new CommandLine();
            try
            {
                cmdLine.Parse(args);

                if (cmdLine.Switches.ContainsKey("storedprocedures") && cmdLine.Switches["storedprocedures"])
                {
                    Console.WriteLine("Upgrading the stored procedures.");
                    if (!RunEmbeddedScript("ClearCanvas.ImageServer.Model.SqlServer.Scripts.ImageServerStoredProcedures.sql"))
                        Environment.ExitCode = -1;
                    else
                        Environment.ExitCode = 0;
                }

                if (cmdLine.Switches.ContainsKey("defaultdata") && cmdLine.Switches["defaultdata"])
                {
                    Console.WriteLine("Upgrading the stored procedures.");
                    if (!RunEmbeddedScript("ClearCanvas.ImageServer.Model.SqlServer.Scripts.ImageServerDefaultData.sql"))
                        Environment.ExitCode = -1;
                    else
                        Environment.ExitCode = 0;
                }

                foreach (string script in cmdLine.Positional)
                {
                    if (!RunScript(script))
                    {
                        Console.WriteLine("Upgrading to execute script: {0}", script);
                        Environment.ExitCode = -1;
                        return;
                    }
                }				
            }
            catch (CommandLineException e)
            {
                Console.WriteLine(e.Message);
                cmdLine.PrintUsage(Console.Out);
                Environment.ExitCode = -1;
            }
            catch (Exception e)
            {
                Console.WriteLine("Unexpected exception when executing script: {0}", e.Message);
                Environment.ExitCode = -1;
            }
        }
コード例 #6
0
		public void RunApplication(string[] args)
		{
			var cmdLine = new CommandLine();
			try
			{
				cmdLine.Parse(args);

				var persistentStoreVersion = LoadPersistentStoreVersion();
				var assemblyVersion = LoadAssemblyVersion();

				if (cmdLine.Switches.ContainsKey("check") && cmdLine.Switches["check"])
				{
					CheckPersistentStoreStatus(persistentStoreVersion, assemblyVersion);
					return;
				}

				Console.WriteLine("The current database version is {0} and assembly version is {1}",
								  persistentStoreVersion.ToString(4),
								  assemblyVersion.ToString(4));

				if (persistentStoreVersion.Equals(assemblyVersion))
				{
					Console.WriteLine("Database version is up-to-date.");
					Environment.ExitCode = 0;
					return;
				}

				if (!UpdatePersistentStore(persistentStoreVersion, assemblyVersion))
					Environment.ExitCode = -1;
				else
				{
					Environment.ExitCode = 0;
				}
			}
			catch (CommandLineException e)
			{
				Console.WriteLine(e.Message);
				cmdLine.PrintUsage(Console.Out);
				Environment.ExitCode = -1;
			}
			catch (Exception e)
			{
				Console.WriteLine("Unexpected exception when upgrading database: {0}", e.Message);
				Environment.ExitCode = -1;
			}
		}
コード例 #7
0
ファイル: EntryPoint.cs プロジェクト: KevinKelley/katahdin
        public static void Main(string[] args)
        {
            try
            {
                CommandLine commandLine = new CommandLine();
                commandLine.AddOption("Verbose", false, "-verbose");
                
                commandLine.Parse(args);
            
                if ((bool) commandLine.GetOption("-h"))
                {
                    commandLine.Help("Katahdin Interpreter");
                    return;
                }
                
                Runtime runtime = new Runtime(true, false, false, false,
                    (bool) commandLine.GetOption("-verbose"));
                
                //new ConsoleParseTrace(runtime);
                
                runtime.SetUp(commandLine.Args);
                
                if (!((bool) commandLine.GetOption("-nostd")))
                    runtime.ImportStandard();
                
                foreach (string file in commandLine.Files)
                    runtime.Import(file);
            }
            catch (Exception e)
            {
                /*while (true)
                {
                    TargetInvocationException wrapper
                        = e as TargetInvocationException;

                    if (wrapper == null)
                        break;

                    e = wrapper.InnerException;
                }*/
                
                Console.Error.WriteLine(e);
            }
        }
コード例 #8
0
ファイル: EntryPoint.cs プロジェクト: KevinKelley/katahdin
        public static void Main(string[] args)
		{
            CommandLine commandLine = new CommandLine();
            commandLine.Parse(args);
            
            if ((bool) commandLine.GetOption("-h"))
            {
                commandLine.Help("Katahdin Graphical Debugger");
                return;
            }
            
	        Application.Init();
			
			MainWindow mainWindow = new MainWindow();
			mainWindow.ShowAll();
			
			if (mainWindow.NewSession(commandLine))
			    Application.Run();
			
			mainWindow.Destroy();
		}
コード例 #9
0
		public void RunApplication(string[] args)
		{
			var cmd = new CommandLine();
			try
			{
				cmd.Parse(args);
			}
			catch (Exception)
			{
				cmd.PrintUsage(Console.Out);
				Environment.Exit(-1);
			}

			//Hack to redirect local shared settings to a different exe's config file.
			ExtendedLocalFileSettingsProvider.ExeConfigFileName = cmd.Target;
			foreach (var settingsClass in _applicationSettingsClasses)
			{
				var settingsType = Type.GetType(settingsClass);
				SettingsMigrator.MigrateSharedSettings(settingsType, cmd.Source);
			}

			try
			{
				if (!String.IsNullOrEmpty(cmd.DicomServersFileName) && File.Exists(cmd.DicomServersFileName))
				{
					var existingServerTree = new ServerTree.ServerTree();
					if (existingServerTree.RootServerGroup.GetAllServers().Count == 0)
					{
						//Settings NOT from an old xml file were just migrated, so
						//if there's still no servers defined, import from old xml file.
						var serverTree = new ServerTree.ServerTree(cmd.DicomServersFileName);
						serverTree.Save();
					}
				}
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Warn, e, "Failed to import legacy server tree '{0}'.", cmd.DicomServersFileName);
			}
		}
コード例 #10
0
ファイル: Program.cs プロジェクト: stegru/ExceptionExplorer
        private static void Main(string[] args)
        {
            try
            {
                ErrorHandler.Init();

                CommandLine = new CommandLine();
                CommandLine.Parse(args);

                AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "ILSpy");
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Licence lic = Options.Current.Licence;
                Activation.CheckLicence(lic);

                if (lic.Status == Licence.LicenceStatus.Invalid)
                {
                }

                //Application.Run(new OpenSolutionForm()); return;

                ExceptionExplorerForm = new ExceptionExplorerForm();
                Application.Run(ExceptionExplorerForm);
                return;

                //ExceptionExplorer.ExceptionAnalysis.ExceptionFinder.Instance.ReadClass(new Class(typeof(ExceptionExplorerForm)), new System.Threading.CancellationToken(), true);
            }
            finally
            {
                ErrorHandler.DeInit();
            }
        }