Advertisement
ConsolSpam

Look at this mess

Jun 23rd, 2018
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 2.92 KB | None | 0 0
  1. // Learn more about F# at http://fsharp.org
  2. open System
  3. open System.Diagnostics
  4. open System.IO
  5. open System.Threading
  6. open System.Security.Principal
  7. open Microsoft.Win32
  8.  
  9. open Icons
  10.  
  11. // defining strings hue hue hue
  12. let staticDir = Path.GetFullPath("./static")
  13. let dllPath = Path.Combine(staticDir, "imageres.dll")
  14. let bgpath = String.Format("/c reg add \"HKEY_CURRENT_USER\Control Panel\Desktop\" /v Wallpaper /t REG_SZ /d %s /f", Path.Combine(staticDir, "images\757.png"))
  15. let readMe = Path.Combine(staticDir, "readme.txt")
  16. let imageresBackup = Path.GetFullPath("%systemdrive%\\DarkTheme\\backup\\imageres_original.dll")
  17. let newDir = Path.GetFullPath("%systemdrive%\\DarkTheme")
  18. let backupDir = Path.GetFullPath("%systemdrive%\\DarkTheme\\backup")
  19. let iconDir = Path.GetFullPath("./static/icons/new")
  20. let newIconDir = Path.GetFullPath("%systemdrive%\\DarkTheme\\icons")
  21. let notAdmin = "Please run this app as an admin for it to work, thanks :D \nThis window will close in 5 seconds"
  22. let countdown = [4; 3; 2; 1; ]
  23.  
  24. if not(WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)) then
  25.     Console.WriteLine(notAdmin)
  26.     Thread.Sleep(1000)
  27.     for n in countdown do      
  28.         printfn "_________________________|%d" n
  29.         Thread.Sleep(1000)
  30.     Environment.Exit(5)
  31. // kill explorer
  32. let closeexplo = Process.Start("cmd", "/c taskkill /im explorer.exe /f")
  33. Thread.Sleep(500)
  34. // changes background to pure black
  35. Console.WriteLine("Changing background")
  36. let changebg = Process.Start("cmd", bgpath)
  37. let forcebg = Process.Start("RUNDLL32.EXE", "user32.dll,UpdatePerUserSystemParameters")
  38. Thread.Sleep(500)
  39. if not(Directory.Exists(newDir)) then
  40.     Directory.CreateDirectory(newDir) |> ignore
  41. if not(Directory.Exists(backupDir)) then
  42.     Directory.CreateDirectory(backupDir) |> ignore
  43. // create backup
  44. if not(File.Exists(imageresBackup)) then
  45.     File.Copy(Path.Combine(Environment.SystemDirectory, "imageres.dll"), imageresBackup)
  46. // copy icons to C drive
  47. if not(Directory.Exists(newIconDir)) then
  48.     Directory.CreateDirectory(newIconDir) |> ignore
  49. for i in iconName do
  50.     File.Copy(iconDir + i + ".ico", newIconDir + i + ".ico")
  51.     if not(Registry.CurrentUser.GetValue("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + i + "\UserChoice", "ProgID") = null) then
  52.         let userChoice = Registry.CurrentUser.GetValue("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + i + "\UserChoice", "ProgID").ToString()
  53.         let name = Registry.ClassesRoot.GetValue(userChoice + "\DefaultIcon", "(Default)").ToString()
  54.         Registry.ClassesRoot.SetValue(name, newIconDir + i + ".ico")
  55. // changing registry
  56. let openexplo = Process.Start("cmd", "/c explorer.exe")
  57. Thread.Sleep(500)
  58. Console.WriteLine("Success, closing in 5 seconds")
  59. Thread.Sleep(1000)
  60. for n in countdown do      
  61.     printfn "_________________________|%d" n
  62.     Thread.Sleep(1000)
  63. Environment.Exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement