예제 #1
0
        private static void Main()
        {
            //Add the exception dialog to our solution
            new UnhandledExceptionDlg {
                RestartApp = false
            };
            //Windows stuff
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CheckDotNet();
            CheckUpdate.CheckForUpdate();
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;

            if (!Directory.Exists(ourDirectory + "\\Logs"))
            {
                Directory.CreateDirectory(ourDirectory + "\\Logs");
            }
            if (File.Exists(ourDirectory + "\\Logs\\OldLogFile.txt"))
            {
                File.Delete(ourDirectory + "\\Logs\\OldLogFile.txt");
            }
            if (File.Exists(ourDirectory + "\\Logs\\LogFile.txt"))
            {
                File.Move(ourDirectory + "\\Logs\\LogFile.txt", ourDirectory + "\\Logs\\OldLogFile.txt");
            }
            LazyForms.Load();
            //Load license settings
            //Start update check
            // var check = new Thread(CheckUpdate.CheckForUpdate) {IsBackground = true};
            // check.Start();
            //Start license check
            LazySettings.LoadSettings();
            ReloggerSettings.LoadSettings();
            if (LazySettings.FirstRun)
            {
                new Wizard().ShowDialog();
            }
            //Lets spawn the selector and wait for it to return before starting the bot
            var selector = new Selector();

            selector.ShowDialog();
            //If the user closed the bot or the process does not exist - close
            if (AttachTo == 0)
            {
                Environment.Exit(0);
            }

            Application.Run(LazyForms.MainForm);
        }