Esempio n. 1
0
        private static void RunAsUpdater(string[] args)
        {
            if (args.Length < 3 || args[0] != "AU")             //check for correct call (AU PID EXEPATH)
            {
                return;
            }

            if (!IsRunAsAdmin())
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxAutoUpdateRequireAdmin, Strings.BoxAutoUpdateResult, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            GitHub.CleanupOldVersion();

            int    PID           = int.Parse(args[1]);
            string lasergrblpath = args[2];

            try
            {
                System.Diagnostics.Process P = System.Diagnostics.Process.GetProcessById(PID);
                if (P != null && !P.WaitForExit(1000))                 //wait for process exit
                {
                    P.Kill();
                }
            }
            catch { }


            try
            {
                foreach (System.Diagnostics.Process Pn in System.Diagnostics.Process.GetProcessesByName("LaserGRBL")) //if other instance - kill them!
                {
                    if (Pn.Id != System.Diagnostics.Process.GetCurrentProcess().Id)                                   //do not kill myself!!
                    {
                        try { Pn.Kill(); }
                        catch { }
                    }
                }
            }
            catch { }

            if (GitHub.ApplyUpdateS2())             //at this moment LaserGRBL is not running!
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxAutoUpdateSuccess, Strings.BoxAutoUpdateResult, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxAutoUpdateFailed, Strings.BoxAutoUpdateResult, MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }

            if (System.IO.File.Exists(lasergrblpath))
            {
                System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo {
                    UseShellExecute = true, WorkingDirectory = Environment.CurrentDirectory, FileName = lasergrblpath
                };
                try { System.Diagnostics.Process.Start(p); }
                catch { }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Tools.TimingBase.TimeFromApplicationStartup();

            foreach (string arg in args)
            {
                GrblCore.WriteComLog = GrblCore.WriteComLog || arg == "comlog";
            }

            Logger.Start();
            GitHub.CleanupOldVersion();
            UsageStats.LoadFile();
            CustomButtons.LoadFile();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)Settings.GetObject("User Language", null);
            if (ci != null)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            }

            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock
            Application.Run(new MainForm());
            GrblEmulator.WebSocketEmulator.Stop();
            Autotrace.CleanupTmpFolder();
            Logger.Stop();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Logger.Start();

            GitHub.CleanupOldVersion();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)Settings.GetObject("User Language", null);
            if (ci != null)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            }

            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock

            Application.Run(new MainForm());

            LaserGRBL.GrblEmulator.Stop();
            Logger.Stop();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            ExceptionManager.RegisterHandler();

            Tools.TimingBase.TimeFromApplicationStartup();

            Logger.Start();
            GitHub.CleanupOldVersion();
            UsageStats.LoadFile();
            CustomButtons.LoadFile();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Globalization.CultureInfo ci = Settings.GetObject <System.Globalization.CultureInfo>("User Language", null);
            if (ci != null)
            {
                Thread.CurrentThread.CurrentUICulture = ci;
            }

            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock
            Application.Run(new MainForm());
            GrblEmulator.WebSocketEmulator.Stop();
            Autotrace.CleanupTmpFolder();
            Logger.Stop();
        }