Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Learn more about F# at http://fsharp.org
- open System
- open System.Diagnostics
- open System.IO
- open System.Threading
- open System.Security.Principal
- open Microsoft.Win32
- open Icons
- // defining strings hue hue hue
- let staticDir = Path.GetFullPath("./static")
- let dllPath = Path.Combine(staticDir, "imageres.dll")
- 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"))
- let readMe = Path.Combine(staticDir, "readme.txt")
- let imageresBackup = Path.GetFullPath("%systemdrive%\\DarkTheme\\backup\\imageres_original.dll")
- let newDir = Path.GetFullPath("%systemdrive%\\DarkTheme")
- let backupDir = Path.GetFullPath("%systemdrive%\\DarkTheme\\backup")
- let iconDir = Path.GetFullPath("./static/icons/new")
- let newIconDir = Path.GetFullPath("%systemdrive%\\DarkTheme\\icons")
- let notAdmin = "Please run this app as an admin for it to work, thanks :D \nThis window will close in 5 seconds"
- let countdown = [4; 3; 2; 1; ]
- if not(WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)) then
- Console.WriteLine(notAdmin)
- Thread.Sleep(1000)
- for n in countdown do
- printfn "_________________________|%d" n
- Thread.Sleep(1000)
- Environment.Exit(5)
- // kill explorer
- let closeexplo = Process.Start("cmd", "/c taskkill /im explorer.exe /f")
- Thread.Sleep(500)
- // changes background to pure black
- Console.WriteLine("Changing background")
- let changebg = Process.Start("cmd", bgpath)
- let forcebg = Process.Start("RUNDLL32.EXE", "user32.dll,UpdatePerUserSystemParameters")
- Thread.Sleep(500)
- if not(Directory.Exists(newDir)) then
- Directory.CreateDirectory(newDir) |> ignore
- if not(Directory.Exists(backupDir)) then
- Directory.CreateDirectory(backupDir) |> ignore
- // create backup
- if not(File.Exists(imageresBackup)) then
- File.Copy(Path.Combine(Environment.SystemDirectory, "imageres.dll"), imageresBackup)
- // copy icons to C drive
- if not(Directory.Exists(newIconDir)) then
- Directory.CreateDirectory(newIconDir) |> ignore
- for i in iconName do
- File.Copy(iconDir + i + ".ico", newIconDir + i + ".ico")
- if not(Registry.CurrentUser.GetValue("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + i + "\UserChoice", "ProgID") = null) then
- let userChoice = Registry.CurrentUser.GetValue("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + i + "\UserChoice", "ProgID").ToString()
- let name = Registry.ClassesRoot.GetValue(userChoice + "\DefaultIcon", "(Default)").ToString()
- Registry.ClassesRoot.SetValue(name, newIconDir + i + ".ico")
- // changing registry
- let openexplo = Process.Start("cmd", "/c explorer.exe")
- Thread.Sleep(500)
- Console.WriteLine("Success, closing in 5 seconds")
- Thread.Sleep(1000)
- for n in countdown do
- printfn "_________________________|%d" n
- Thread.Sleep(1000)
- Environment.Exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement