using System.Diagnostics;

namespace updater
{
    public class OfficeKiller
    {
        public static void KillWordProcess()
        {
            Process[] processesByName = Process.GetProcessesByName("WINWORD");
            foreach (Process obj in processesByName)
            {
                UpdateData.GetInstance().ShouldRebootMSOffice = true;
                obj.Kill();
                obj.WaitForExit();
            }
        }

        public static void KillExcelProcess()
        {
            Process[] processesByName = Process.GetProcessesByName("EXCEL");
            foreach (Process obj in processesByName)
            {
                obj.Kill();
                obj.WaitForExit();
            }
        }

        public static void KillWPSProcess()
        {
            Process[] processesByName = Process.GetProcessesByName("wps");
            foreach (Process process in processesByName)
            {
                UpdateData.GetInstance().ShouldRebootWPS = true;
                if (!process.HasExited)
                {
                    process.Kill();
                    process.WaitForExit();
                }
            }
        }
    }
}
