public static void Stop()
 {
     if (mpeg_stream_process != null)
     {
         Log.Main.Inform("Terminating:\r\n" + commandLine);
         ProcessRoutines.KillProcessTree(mpeg_stream_process.Id);
         mpeg_stream_process = null;
     }
     ProcessRoutines.AntiZombieTracker.This.KillTrackedProcesses();//to close the job object
     commandLine = null;
 }
Пример #2
0
 static void stop()
 {
     lock (lockObject)
     {
         if (mpeg_stream_process != null)
         {
             if (!mpeg_stream_process.HasExited)
             {
                 Log.Main.Inform("Terminating:\r\n" + commandLine);
                 ProcessRoutines.KillProcessTree(mpeg_stream_process.Id);
             }
             mpeg_stream_process = null;
         }
         antiZombieGuard.KillTrackedProcesses();
     }
 }
 public static void Stop()
 {
     if (mpeg_stream_process != null)
     {
         Log.Main.Inform("Terminating:\r\n" + commandLine);
         ProcessRoutines.KillProcessTree(mpeg_stream_process.Id);
         mpeg_stream_process = null;
     }
     if (fileStream != null)
     {
         fileStream.Flush();
         fileStream.Dispose();
         fileStream = null;
     }
     if (antiZombieTracker != null)
     {
         antiZombieTracker.KillTrackedProcesses();
         antiZombieTracker = null;
     }
     commandLine = null;
 }
        public ProjectInstaller()
        {
            InitializeComponent();

            this.Committed += delegate
            {
                //try
                //{
                //starts for initial configuration under SYSTEM account
                Process p = Process.Start(Assembly.GetExecutingAssembly().Location, "-initial_configuration");
                p.WaitForExit();

                ProcessRoutines.CreateProcessAsUserOfCurrentSession(Assembly.GetExecutingAssembly().Location);    //starts the process as the current user while the installer runs as SYSTEM
                //}
                //catch (Exception ex)
                //{
                //    //Message.Error(ex);//brings to an error: object is null
                //    MessageBox.Show();
                //}
            };

            this.BeforeUninstall += delegate
            {
                //try
                //{
                foreach (Process p in Process.GetProcessesByName(PathRoutines.GetFileNameWithoutExtentionFromPath(Assembly.GetExecutingAssembly().Location)))
                {
                    ProcessRoutines.KillProcessTree(p.Id);
                }
                //}
                //catch (Exception e)
                //{
                //    //Message.Error(ex);//brings to an error: object is null
                //    MessageBox.Show();
                //    //throw e;//to stop uninstalling(?)
                //}
            };
        }