Пример #1
0
        static int Main(string[] args)
        {
            if (args.Length == 2 && args[0] == "--post-build-check")
            {
                return(PostBuildChecker.RunPostBuildChecks(args[1], Assembly.GetExecutingAssembly()));
            }

            SettingsUtil.LoadSettings(out ZiimHelperProgram.Settings);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Mainform());

            Settings.Save(onFailure: SettingsOnFailure.ShowRetryOnly);
            return(0);
        }
Пример #2
0
        static int Main(string[] args)
        {
            try { Console.OutputEncoding = Encoding.UTF8; }
            catch { }

            if (args.Length == 2 && args[0] == "--post-build-check")
            {
                return(PostBuildChecker.RunPostBuildChecks(args[1], Assembly.GetExecutingAssembly()));
            }

            Classify.DefaultOptions.AddTypeSubstitution(new ClassifyColorSubstitute());

            SettingsUtil.LoadSettings(out Settings);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Mainform(Settings, args));

            Settings.Save(onFailure: SettingsOnFailure.ShowRetryWithCancel);
            return(0);
        }
Пример #3
0
        public static int Main(string[] args)
        {
            try { Console.OutputEncoding = Encoding.UTF8; }
            catch { }

            if (args.Length == 2 && args[0] == "--post-build-check")
            {
                return(PostBuildChecker.RunPostBuildChecks(args[1], Assembly.GetExecutingAssembly()));
            }

            Console.BackgroundColor = IsDebug ? ConsoleColor.DarkBlue : ConsoleColor.DarkRed;
            Console.ForegroundColor = ConsoleColor.White;
            var msg    = IsDebug ? "DEBUG MODE" : "RELEASE MODE";
            var spaces = new string(' ', (Console.BufferWidth - msg.Length - 7) / 2);

            Console.WriteLine("{0}┌──{1}──╖{0}".Fmt(spaces, new string('─', msg.Length)));
            Console.WriteLine("{0}│  {1}  ║{0}".Fmt(spaces, msg));
            Console.WriteLine("{0}╘══{1}══╝{0}".Fmt(spaces, new string('═', msg.Length)));
            Console.ResetColor();

            PropellerUtil.RunStandalone(PathUtil.AppPathCombine("DocGen.Settings.json"), new DocGenPropellerModule());
            return(0);
        }
Пример #4
0
 public override int Execute() => PostBuildChecker.RunPostBuildChecks(SourcePath, Assembly.GetExecutingAssembly());
Пример #5
0
        public static int Main(string[] args)
        {
            if (args.Length == 2 && args[0] == "--post-build-check")
            {
                return(PostBuildChecker.RunPostBuildChecks(args[1], System.Reflection.Assembly.GetExecutingAssembly()));
            }

            CommandLine cmdLine;

            try
            {
                cmdLine = CommandLineParser.Parse <CommandLine>(args);
            }
            catch (CommandLineParseException e)
            {
                e.WriteUsageInfoToConsole();
                return(1);
            }

            var serviceProcess = new SingleSelfServiceProcess <PropellerService>();
            var service        = (PropellerService)serviceProcess.Services.First();

            service.SettingsPath = cmdLine.SettingsPath;

            Console.WriteLine("Propeller invoked with action: " + cmdLine.Action);
            Console.WriteLine("Settings file: " + (cmdLine.SettingsPath ?? "(default)"));

            switch (cmdLine.Action)
            {
            case Action.RunAsStandalone:
                var thread = new Thread(() => { service.RunAsStandalone(args); });
                thread.Start();
                Console.WriteLine("Running. Press ENTER to exit.");
                Console.ReadLine();
                Console.WriteLine("Shutting down...");
                service.Shutdown();
                thread.Join();
                break;

            case Action.Install:
                var arguments = "service";
                if (cmdLine.SettingsPath != null)
                {
                    arguments += @" -s ""{0}""".Fmt(cmdLine.SettingsPath);
                }
                serviceProcess.Install(ServiceAccount.NetworkService, arguments);
                break;

            case Action.Uninstall:
                serviceProcess.Uninstall();
                break;

            case Action.Start:
                serviceProcess.StartAll();
                break;

            case Action.Stop:
                serviceProcess.StopAll();
                break;

            case Action.Service:
                serviceProcess.ExecuteServices();
                break;

            default:
                Console.WriteLine("Unknown arguments.");
                return(1);
            }

#if DEBUG
            Console.WriteLine("Done. Press ENTER to exit.");
            Console.ReadLine();
#endif

            return(0);
        }