private void simpleButton1_Click(object sender, EventArgs e) { Directory.CreateDirectory(Application.StartupPath.ToString() + @"\HWMonitor\"); File.WriteAllBytes(Application.StartupPath.ToString() + @"\HWMonitor\HWMonitor_x64.exe", Properties.Resources.HWMonitor_x64); Process.Start(Application.StartupPath.ToString() + @"\HWMonitor\HWMonitor_x64.exe"); simpleButton1.Text = "HWMonitor"; simpleButton1.ForeColor = Color.Green; HWCheck.Start(); }
private void MsConfigCheck_Tick(object sender, EventArgs e) { string exedir = Application.StartupPath.ToString() + @"\HWMonitor\"; Process[] pname = Process.GetProcessesByName("HWMonitor_x64"); if (pname.Length == 0) { //Répertoire de l'exécutable foreach (string filePath in Directory.GetFiles(exedir)) { if (filePath != exedir) { File.Delete(filePath); } } Directory.Delete(Application.StartupPath.ToString() + @"\HWMonitor\"); simpleButton1.Text = "HWMonitor"; simpleButton1.ForeColor = Color.Red; HWCheck.Stop(); } }