Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. private void start()
  2. {
  3. RegistryKey steamreg = Registry.CurrentUser.OpenSubKey(@"Software\Valve\Steam");
  4. string steamdir = steamreg.GetValue("SteamPath").ToString();
  5. string steampath = steamdir + "/steamapps/downloading";
  6. DirectoryInfo dir = new DirectoryInfo(steampath);
  7. FileInfo[] files = dir.GetFiles();
  8.  
  9. startcheck = true;
  10.  
  11. while (startcheck)
  12. {
  13. if (files.Length > 0)
  14. {
  15. label5.Visible = false;
  16. label3.Visible = true;
  17. }
  18. else
  19. {
  20. label5.Visible = false;
  21. label4.Visible = true;
  22.  
  23. DialogResult dialogResult = MessageBox.Show("Warning, shutdown imminent. Continue?", "", MessageBoxButtons.YesNo);
  24.  
  25. if (dialogResult == DialogResult.No)
  26. {
  27. startcheck = false;
  28. }
  29. else if (dialogResult == DialogResult.Yes)
  30. {
  31. ProcessStartInfo shutdown = new ProcessStartInfo("shutdown");
  32. shutdown.WindowStyle = ProcessWindowStyle.Hidden;
  33. shutdown.Arguments = " -s";
  34. Process startcmd = new Process();
  35. startcmd.StartInfo = shutdown;
  36. startcmd.Start();
  37. }
  38. }
  39. Thread.Sleep(60000);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement