Exemplo n.º 1
0
        public static void BeginUpdate()
        {
            try
            {
                UserServiceSpawner.Stop();

                //Create updating.info which will warn any sub-processes currently initializing that they should halt
                File.WriteAllText(Path.Combine(Settings.Location, "updating.info"), "foobar");

                //Give time for any sub-processes that may be in the middle of initializing and missed the updating.info file so they can recieve the update pipe notice
                Thread.Sleep(1000);

                //Notify all FOG sub processes that an update is about to occur
                dynamic json = new JObject();
                json.action = "start";

                Bus.Emit(Bus.Channel.Update, json, true);

                //Kill any FOG sub processes still running after the notification
                KillSubProcesses();

                //Launch the updater
                Log.Entry(LogName, "Spawning update helper");

                ProcessHandler.RunClientEXE(Path.Combine("tmp", "FOGUpdateHelper.exe"), $"\"{Log.FilePath}\"", false);
            }
            catch (Exception ex)
            {
                Log.Error(LogName, "Unable to perform update");
                Log.Error(LogName, ex);
            }
        }
Exemplo n.º 2
0
        protected override void Unload()
        {
            UserServiceSpawner.Stop();

            dynamic json = new JObject();

            json.action = "unload";
            Bus.Emit(Bus.Channel.Status, json, true);
            Bus.Dispose();

            // Kill the sub-processes
            UserServiceSpawner.KillAll();
            ProcessHandler.KillAllEXE("FOGUserService");
            ProcessHandler.KillAllEXE("FOGTray");
        }