private void TrottleStopTimer_Tick(object sender, EventArgs e) { string exedir = Application.StartupPath.ToString() + @"\ThrottleStop\"; Process[] pname = Process.GetProcessesByName("ThrottleStop"); 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() + @"\ThrottleStop\"); simpleButton2.Text = "ThrottleStop"; simpleButton2.ForeColor = Color.Red; TrottleStopTimer.Stop(); } else { simpleButton2.Text = "ThrottleStop"; simpleButton2.ForeColor = Color.Green; } }
private void simpleButton2_Click(object sender, EventArgs e) { Directory.CreateDirectory(Application.StartupPath.ToString() + @"\ThrottleStop\"); File.WriteAllBytes(Application.StartupPath.ToString() + @"\ThrottleStop\ThrottleStop.exe", Properties.Resources.ThrottleStop); File.WriteAllBytes(Application.StartupPath.ToString() + @"\ThrottleStop\WinRing0.dll", Properties.Resources.WinRingDLL); File.WriteAllBytes(Application.StartupPath.ToString() + @"\ThrottleStop\WinRing0.sys", Properties.Resources.WinRingSys); File.WriteAllBytes(Application.StartupPath.ToString() + @"\ThrottleStop\WinRing0x64.dll", Properties.Resources.WinRing0x64DLL); File.WriteAllBytes(Application.StartupPath.ToString() + @"\ThrottleStop\WinRing0x64.sys", Properties.Resources.WinRing0x64Sys); Process.Start(Application.StartupPath.ToString() + @"\ThrottleStop\ThrottleStop.exe"); simpleButton2.Text = "ThrottleStop"; simpleButton2.ForeColor = Color.Green; TrottleStopTimer.Start(); }