Exemple #1
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ImproveIt.InitInfrastructure(true);

            LoadLanguage();
            CheckIntergrity();
            ProcessArguments(args);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            ImproveIt.InitInfrastructure(false);
            try
            {
                Console.WriteLine(_ABOUT);
                if (args.Length == 0)
                {
                    runServiceHelper();
                }
                else
                {
                    switch (args.Length)
                    {
                    case 1:
                        string command = args[0].Substring(1).ToUpperInvariant();
                        switch (command)
                        {
                        case _HELP:
                            Console.WriteLine(_USAGE);
                            return;

                        case "I":
                        case _INSTALL:
                            installHelper(true);
                            return;

                        case "U":
                        case _DEINSTALL:
                            installHelper(false);
                            return;

                        default:
                            Console.WriteLine(_INVALIDARGUMENTS);
                            Console.WriteLine(_USAGE);
                            break;
                        }
                        break;

                    default:
                        Console.WriteLine(_INVALIDNUMBEROFARGUMENTS);
                        Console.WriteLine(_USAGE);
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                ImproveIt.ProcessUnhandledException(e);
            }
        }
Exemple #3
0
 public static void Main(string[] args)
 {
     ImproveIt.InitInfrastructure(false);
     try
     {
         using (var controller = new ConsoleBackupController())
         {
             if (controller.ParseCommandLineArguments(args))
             {
                 if (controller.Prepare())
                 {
                     controller.Backup();
                 }
             }
         }
         Console.WriteLine(CopyrightInfo.Copyright);
     }
     catch (Exception e)
     {
         ImproveIt.ProcessUnhandledException(e);
     }
 }
Exemple #4
0
        public static void Main(string[] args)
        {
            ImproveIt.InitInfrastructure(true);
            loadLocalization();

            processInternalArguments(args);

            if (!File.Exists(Files.ProfileFile))
            {
                showErrorAndCloseApplicationIn10Seconds(Translation.Current[582]);
            }

            if (!SingleInstance.FirstInstance)
            {
                showErrorAndCloseApplicationIn10Seconds(Translation.Current[583]);
            }

            try
            {
                MD5Class.Verify7ZipBinaries();
            }
            catch (InvalidSignException e)
            {
                showErrorAndCloseApplicationIn10Seconds(string.Format(Translation.Current[584], e.Message));
            }

            loadConfiguration();
            Controller controller = new Controller(_options);

            if (args != null && args.Length > 0)
            {
                if (!(args.Length == 1 && args[0] == SchedulerParameters.START_WITHOUT_MESSAGE))
                {
                    showErrorAndCloseApplicationIn10Seconds(Translation.Current[586]);
                }
            }
            else
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(showMessageFor10Seconds), Translation.Current[587]);
            }

            try
            {
                if (!_options.DontCareAboutSchedulerStartup && !_options.DontNeedScheduler)
                {
                    verifyStartupScriptAndFixIt();
                }

                Application.SetCompatibleTextRenderingDefault(false);

                using (WithTray tray = new WithTray(controller))
                {
                    if (!RunAsWinFormApp)
                    {
                        tray.TurnIntoHiddenMode();
                    }

                    Application.Run();
                }
            }
            catch (Exception unhandledException)
            {
                ImproveIt.ProcessUnhandledException(unhandledException);
            }
        }