// Auto-launch SCT on boot private void ButtonRunOnBoot_Click(object sender, EventArgs e) { if (MessageBox.Show($"This makes SCT automatically launch when you log onto your PC. You can use the boot scripts in {Configuration.InstallPath} to configure things to load before Classic Theme gets enabled. Continue?", "Run Simple Clasic Theme on boot", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ExtraFunctions.UpdateStartupExecutable(true); } }
//Enable install mode private void Button5_Click(object sender, EventArgs e) { if (MessageBox.Show("This launches the program in auto mode every time the pc starts up (after userinit.exe is loaded). Continue?", "Auto-launch Simple Clasic Theme", MessageBoxButtons.YesNo) == DialogResult.Yes) { ExtraFunctions.UpdateStartupExecutable(true); } }
//Enables Classic Theme public static void Enable() { NtObject g = NtObject.OpenWithType("Section", $@"\Sessions\{Process.GetCurrentProcess().SessionId}\Windows\ThemeSection", null, GenericAccessRights.WriteDac); g.SetSecurityDescriptor(new SecurityDescriptor("O:BAG:SYD:(A;;RC;;;IU)(A;;DCSWRPSDRCWDWO;;;SY)"), SecurityInformation.Dacl); g.Close(); Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Microsoft").CreateSubKey("Windows").CreateSubKey("CurrentVersion").CreateSubKey("Themes").CreateSubKey("DefaultColors"); ExtraFunctions.RenameSubKey(Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Microsoft").CreateSubKey("Windows").CreateSubKey("CurrentVersion").CreateSubKey("Themes"), "DefaultColors", "DefaultColorsOld"); }
public static void MigrateOldSCTRegistry() { RegistryKey source = Registry.CurrentUser.CreateSubKey("SOFTWARE").CreateSubKey("SimpleClassicTheme"); RegistryKey dest = GetRegistryKey(); ExtraFunctions.RecurseCopyKey(source, dest); source.Close(); dest.Close(); RegistryKey software = Registry.CurrentUser.CreateSubKey("SOFTWARE"); software.DeleteSubKey("SimpleClassicTheme", false); software.Close(); }
//Enables Classic Theme public static void Enable() { if (Environment.OSVersion.Version.Major == 10) { Process.Start("explorer.exe", "C:\\Windows\\System32\\ApplicationFrameHost.exe").WaitForExit(); Thread.Sleep(200); } NtObject g = NtObject.OpenWithType("Section", $@"\Sessions\{Process.GetCurrentProcess().SessionId}\Windows\ThemeSection", null, GenericAccessRights.WriteDac); g.SetSecurityDescriptor(new SecurityDescriptor("O:BAG:SYD:(A;;RC;;;IU)(A;;DCSWRPSDRCWDWO;;;SY)"), SecurityInformation.Dacl); g.Close(); Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Microsoft").CreateSubKey("Windows").CreateSubKey("CurrentVersion").CreateSubKey("Themes").CreateSubKey("DefaultColors"); ExtraFunctions.RenameSubKey(Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Microsoft").CreateSubKey("Windows").CreateSubKey("CurrentVersion").CreateSubKey("Themes"), "DefaultColors", "DefaultColorsOld"); }
public About() { InitializeComponent(); ClientSize = new Size(400, 440); if (ExtraFunctions.ShouldDrawLight(SystemColors.Window)) { pictureBox1.Image = Properties.Resources.sct_banner_light_400x73; } else { pictureBox1.Image = Properties.Resources.sct_banner_dark_400x73; } }
//Main code: loads the UI private void Form1_Load(object sender, EventArgs e) { numericUpDown1.Maximum = Int32.MaxValue; ExtraFunctions.UpdateStartupExecutable(false); Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme"); checkBox1.Checked = bool.Parse(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\1337ftw\SimpleClassicTheme", "EnableTaskbar", false.ToString()).ToString()); File.WriteAllText(Path.Combine(Path.GetTempPath(), "\\addSchemes.bat"), Properties.Resources.addSchemes); Process.Start(new ProcessStartInfo() { FileName = Path.Combine(Path.GetTempPath(), "\\addSchemes.bat"), Verb = "runas", UseShellExecute = false, CreateNoWindow = true }); Shown += Form1_Shown; var lol = Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme").GetValue("TaskbarDelay", 5000); numericUpDown1.Value = (int)lol; CheckDependenciesAndSetControls(); }
// Install dependencies private void ButtonInstallRequirements_Click(object sender, EventArgs e) { bool osInstalled = Directory.Exists("C:\\Program Files\\Open-Shell\\"); bool sibInstalled = Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StartIsBack\\")); if (buttonInstallRequirements.Text == "Reconfigure OS+SiB") { ExtraFunctions.ReConfigureOS(osInstalled, osInstalled, sibInstalled); return; } ExtraFunctions.InstallDependencies(); //Make sure EVERYTHING is disabled before continuing ButtonDisable_Click(sender, e); CheckDependenciesAndSetControls(); }
private void MainForm_Load(object sender, EventArgs e) { SystemMenu menu = new SystemMenu(); SystemMenu.CopyToolStripToMenu(menuStrip1, menu); Controls.Remove(menuStrip1); SystemMenu = menu; panel1.ClientSize = new Size(panel1.ClientSize.Width, label2.Location.Y + 27); ClientSize = new Size(panel1.Width, panel1.Height + menu.Height); panel1.Location = new Point(0, 0); ExtraFunctions.UpdateStartupExecutable(false); File.WriteAllText($"{Configuration.InstallPath}addSchemes.bat", Properties.Resources.reg_classicschemes_add); Process.Start(new ProcessStartInfo() { FileName = $"{Configuration.InstallPath}addSchemes.bat", Verb = "runas", UseShellExecute = false, CreateNoWindow = true }); Version sctVersion = Assembly.GetExecutingAssembly().GetName().Version; label2.Text = label2.Text.Replace("%v", sctVersion.ToString(3)).Replace("%r", sctVersion.Revision.ToString()); CheckDependenciesAndSetControls(); if (ExtraFunctions.ShouldDrawLight(SystemColors.Control)) { pictureBox1.Image = Properties.Resources.sct_light_164; } else { pictureBox1.Image = Properties.Resources.sct_dark_164; } if (DateTime.Now.Year == 2022 && DateTime.Now.Day == 1 && DateTime.Now.Month == 1) { //linkLabel1.Hide(); //label2.Text = "Happy New Year!"; } }
//Install dependencies private void Button3_Click(object sender, EventArgs e) { //Win 8.1 doesn't require anything if (Environment.OSVersion.Version.Major < 10) { return; } //Check what's installed bool osInstalled = Directory.Exists("C:\\Program Files\\Open-Shell\\"); bool sibInstalled = Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StartIsBack\\")); if (button3.Text == "Reconfigure SCT+OS") { ExtraFunctions.ReConfigureOS(osInstalled, sibInstalled); return; } //Open-Shell installation if (!osInstalled && checkBox1.Checked) { //Open-Shell installation if (MessageBox.Show("To continue Open-Shell is required. Would you like Simple Classic Theme to install this for you?", "SimpleClassicTheme", MessageBoxButtons.YesNo) == DialogResult.Yes) { //Install Open-Shell File.WriteAllBytes("C:\\SCT\\openShellSetup.exe", Properties.Resources.openShellSetup); Process.Start("C:\\SCT\\openShellSetup.exe", "/qn").WaitForExit(); //Get user folder string path = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName; if (Environment.OSVersion.Version.Major >= 6) { path = Directory.GetParent(path).ToString(); } //Prepare files for Open-Shell Directory.CreateDirectory(path + "\\AppData\\Local\\StartIsBack\\Orbs"); Properties.Resources.win7.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\win7.png"); Properties.Resources.win9x.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\win9x.png"); //Find out what start orb the user wants string orbname = MessageBox.Show("Do you want to use a Win95 style start orb (If not a Windows 7 style orb will be used)?", "Simple Classic Theme", MessageBoxButtons.YesNo) == DialogResult.Yes ? "win9x.png" : "win7.png"; //Setup Open-Shell registry File.WriteAllText(Path.Combine(Path.GetTempPath(), "\\ossettings.reg"), Properties.Resources.openShellSettings); Process.Start(Path.Combine(Path.GetTempPath(), "\\ossettings.reg")).WaitForExit(); Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\OpenShell\\StartMenu\\Settings", "StartButtonPath", @"%USERPROFILE%\AppData\Local\StartIsBack\Orbs\" + orbname); } else { MessageBox.Show("Using taskbar without OpenShell is not possible!", "Simple Classic Theme"); checkBox1.Checked = false; } } //StartIsBack installation if (!sibInstalled && checkBox1.Checked) { bool b = MessageBox.Show("To continue StartIsBack++ is required. Would you like Simple Classic Theme to install this for you?", "Simple Classic Theme", MessageBoxButtons.YesNo) == DialogResult.Yes; if (b) { //Get user folder string path = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName; if (Environment.OSVersion.Version.Major >= 6) { path = Directory.GetParent(path).ToString(); } //Prepare files for StartIsBack Directory.CreateDirectory(path + "\\AppData\\Local\\StartIsBack\\Orbs"); Directory.CreateDirectory(path + "\\AppData\\Local\\StartIsBack\\Styles"); Properties.Resources.win7.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\win7.png"); Properties.Resources.win9x.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\win9x.png"); Properties.Resources.taskbar.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\taskbar.png"); Properties.Resources.null_classic3small.Save(path + "\\AppData\\Local\\StartIsBack\\Orbs\\null_classic3big.bmp"); File.WriteAllBytes(path + "\\AppData\\Local\\StartIsBack\\Styles\\Classic3.msstyles", Properties.Resources.classicStartIsBackTheme); //Setup StartIsBack registry string f = Properties.Resources.startIsBackSettings.Replace("C:\\\\Users\\\\{Username}", $"{path.Replace("\\", "\\\\")}"); File.WriteAllText("C:\\sib.reg", f); Process.Start(Path.Combine(Path.GetTempPath(), "\\sib.reg")).WaitForExit(); //Disable StartIsBack Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\StartIsBack", "Disabled", 1); using (WebClient c = new WebClient()) c.DownloadFile("https://s3.amazonaws.com/startisback/StartIsBackPlusPlus_setup.exe", Path.Combine(Path.GetTempPath(), "\\sib.exe")); //Install StartIsBack++ Process p = new Process() { StartInfo = { FileName = Path.Combine(Path.GetTempPath(), "\\sib.exe"), Arguments = "/silent" } }; p.Start(); p.WaitForExit(); p.Dispose(); File.Delete("C:\\ossettings.reg"); File.Delete("C:\\sib.reg"); File.Delete("C:\\sib.exe"); } else { MessageBox.Show("Using taskbar without StartIsBack++ is not possible!", "Simple Classic Theme"); checkBox1.Checked = false; } } //Make sure EVERYTHING is disabled before continuing Button2_Click(sender, e); //Inform the user and update controls MessageBox.Show("All requirements are installed! Enjoy!!!!"); CheckDependenciesAndSetControls(); }
static void Main(string[] args) { if (IntPtr.Size != 8) { ShowError("This binary is incorrectly compiled and cannot run. Please compile SCT as an x64 binary"); return; } Application.SetCompatibleTextRenderingDefault(false); bool windows = Environment.OSVersion.Platform == PlatformID.Win32NT; bool windows10 = Environment.OSVersion.Version.Major == 10 && Int32.Parse(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString()) >= 1803; bool windows8 = Environment.OSVersion.Version.Major == 6 && (Environment.OSVersion.Version.Minor == 2 || Environment.OSVersion.Version.Minor == 3); //Check if the OS is compatible if (!(windows && (windows10 || windows8))) { Kernel32.AttachConsole(Kernel32.ATTACH_PARENT_PROCESS); ShowError(""); #if DEBUG #else Kernel32.FreeConsole(); return; #endif } //If for some odd reason the application hasn't started with administrative privileges, restart with them WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { if (MessageBox.Show("This application requires admin privilages.\nClick Ok to elevate or Cancel to exit.", "Simple Classic Theme - Elevation required", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { ProcessStartInfo processInfo = new ProcessStartInfo { Verb = "runas", FileName = Application.ExecutablePath, Arguments = string.Join(" ", args) }; Process.Start(processInfo); } return; } Configuration.MigrateOldSCTRegistry(); Directory.CreateDirectory("C:\\SCT\\"); //Write loading scripts if (!File.Exists("C:\\SCT\\EnableThemeScript.bat")) { File.WriteAllText("C:\\SCT\\EnableThemeScript.bat", Properties.Resources.EnableThemeScript.Replace("{ver}", Assembly.GetExecutingAssembly().GetName().Version.ToString())); } if (!File.Exists("C:\\SCT\\DisableThemeScript.bat")) { File.WriteAllText("C:\\SCT\\DisableThemeScript.bat", Properties.Resources.DisableThemeScript.Replace("{ver}", Assembly.GetExecutingAssembly().GetName().Version.ToString())); } //Start update checking string updateMode = (string)Configuration.GetItem("UpdateMode", "Automatic"); if (updateMode == "Automatic" || updateMode == "Ask on startup") { ExtraFunctions.Update(); } //Get a console window Kernel32.AttachConsole(Kernel32.ATTACH_PARENT_PROCESS); Console.WriteLine("SCT Version {0}\nCopyright 2020 Anis Errais", Assembly.GetExecutingAssembly().GetName().Version); Thread.Sleep(250); //Clean up any files that might have been left over on the root of the C: drive Console.WriteLine("Cleaning up..."); File.Delete("C:\\upm.reg"); File.Delete("C:\\restoreMetrics.reg"); File.Delete("C:\\fox.exe"); File.Delete("C:\\7tt.exe"); File.Delete("C:\\ctm.exe"); File.Delete("C:\\ossettings.reg"); File.Delete("C:\\sib.reg"); File.Delete("C:\\sib.exe"); File.Delete("C:\\windowmetrics.reg"); File.Delete("C:\\RibbonDisabler.exe"); if (args.Length > 0) { bool withTaskbar = false; for (int i = 1; i < args.Length; i++) { switch (args[i]) { case "--enable-taskbar": case "-t": withTaskbar = true; break; case "--help": case "-h": case "/help": case "/?": ShowHelp(); break; default: break; } } string arg = args[0]; doArg: switch (arg) { case "/enable": if (!MainForm.CheckDependencies(withTaskbar)) { ShowError("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Enabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterEnable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); break; case "/disable": if (!MainForm.CheckDependencies(withTaskbar)) { ShowError("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Disabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterDisable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); break; case "/configure": Directory.CreateDirectory("C:\\SCT\\"); File.WriteAllBytes("C:\\SCT\\deskn.cpl", Properties.Resources.desktopControlPanelCPL); Process.Start("C:\\SCT\\deskn.cpl"); break; case "/boot": bool Enabled = bool.Parse(Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme").GetValue("Enabled", "False").ToString()); if (Enabled) { arg = "/enable"; goto doArg; } break; case "/enableauto": Enabled = bool.Parse(Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme").GetValue("Enabled", "False").ToString()); if (Enabled) { arg = "/disable"; } else { arg = "/enable"; } goto doArg; case "--help": case "-h": case "/help": case "/?": ShowHelp(); break; default: break; } return; } else { Kernel32.FreeConsole(); Application.Run(new MainForm()); } }
static void Main(string[] args) { Application.SetCompatibleTextRenderingDefault(false); bool windows = Environment.OSVersion.Platform == PlatformID.Win32NT; bool windows10 = Environment.OSVersion.Version.Major == 10 && Int32.Parse(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString()) >= 1803; bool windows8 = Environment.OSVersion.Version.Major == 6 && (Environment.OSVersion.Version.Minor == 2 || Environment.OSVersion.Version.Minor == 3); //Check if the OS is compatible if (!(windows && (windows10 || windows8))) { Kernel32.AttachConsole(Kernel32.ATTACH_PARENT_PROCESS); //If not, display a cool looking error message string t = Console.Title; Console.Title = "Simple Compatibilty Error"; int x = Console.BufferWidth; int y = Console.BufferHeight; int width = Console.WindowWidth; int height = Console.WindowHeight; Console.SetWindowSize(45, 12); Console.BufferWidth = 45; Console.BufferHeight = 12; Console.SetCursorPosition(0, 0); Console.Write(Properties.Resources.compatibiltyError.Replace("\n", "")); Console.SetCursorPosition(40, 7); Console.ReadKey(); Console.BufferWidth = x; Console.BufferHeight = y; Console.SetWindowSize(width, height); Console.SetCursorPosition(0, 11); Console.Title = t; Kernel32.FreeConsole(); //return; } //If for some odd reason the application hasn't started with administrative privileges, restart with them WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { if (MessageBox.Show("This application requires admin privilages.\nClick Ok to elevate or Cancel to exit.", "Simple Classic Theme - Elevation required", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { ProcessStartInfo processInfo = new ProcessStartInfo { Verb = "runas", FileName = Application.ExecutablePath, Arguments = string.Join(" ", args) }; Process.Start(processInfo); } return; } Directory.CreateDirectory("C:\\SCT\\"); //Start update checking ExtraFunctions.Update(); if (!(windows && (windows10 || windows8))) { return; } //Get a console window Kernel32.AttachConsole(Kernel32.ATTACH_PARENT_PROCESS); //Clean up any files that might have been left over on the root of the C: drive Console.WriteLine("Cleaning up..."); File.Delete("C:\\upm.reg"); File.Delete("C:\\restoreMetrics.reg"); File.Delete("C:\\fox.exe"); File.Delete("C:\\7tt.exe"); File.Delete("C:\\ctm.exe"); File.Delete("C:\\ossettings.reg"); File.Delete("C:\\sib.reg"); File.Delete("C:\\sib.exe"); File.Delete("C:\\windowmetrics.reg"); File.Delete("C:\\RibbonDisabler.exe"); if (args.Length > 0) { bool withTaskbar = false; for (int i = 1; i < args.Length; i++) { switch (args[i]) { case "--enable-taskbar": case "-t": withTaskbar = true; break; case "--help": case "-h": case "/help": case "/?": ShowHelp(); break; default: break; } } switch (args[0]) { case "/enable": if (!MainForm.CheckDependencies(withTaskbar)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); Console.ResetColor(); Console.WriteLine("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Enabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterEnable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); break; case "/disable": if (!MainForm.CheckDependencies(withTaskbar)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); Console.ResetColor(); Console.WriteLine("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Disabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterDisable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); break; case "/configure": File.WriteAllBytes(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\deskn.cpl", Properties.Resources.desktopControlPanelCPL); Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\deskn.cpl"); break; case "/boot": bool Enabled = bool.Parse(Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme").GetValue("Enabled", "False").ToString()); if (Enabled) { Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme"); withTaskbar = bool.Parse(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "EnableTaskbar", false.ToString()).ToString()); if (!MainForm.CheckDependencies(withTaskbar)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); Console.ResetColor(); Console.WriteLine("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Enabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterEnable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); } break; case "/enableauto": Enabled = bool.Parse(Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme").GetValue("Enabled", "False").ToString()); if (Enabled) { Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme"); withTaskbar = bool.Parse(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "EnableTaskbar", false.ToString()).ToString()); if (!MainForm.CheckDependencies(withTaskbar)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); Console.ResetColor(); Console.WriteLine("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Enabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterEnable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); } else { Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme"); withTaskbar = bool.Parse(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "EnableTaskbar", false.ToString()).ToString()); if (!MainForm.CheckDependencies(withTaskbar)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); Console.ResetColor(); Console.WriteLine("Not all dependencies are installed. Please run the GUI and install the dependencies."); } Console.Write($"INFO: Disabling classic theme{(withTaskbar ? " and taskbar" : "")}..."); ClassicTheme.MasterDisable(withTaskbar); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("SUCCES"); Console.ResetColor(); } break; case "--help": case "-h": case "/help": case "/?": ShowHelp(); break; default: break; } return; } else { Kernel32.FreeConsole(); Application.Run(new MainForm()); } }
public static bool InstallDependencies(bool commandLineOutput = false) { switch (Configuration.TaskbarType) { case TaskbarType.RetroBar: GithubDownloader download = new GithubDownloader(GithubDownloader.DownloadableGithubProject.RetroBar); download.ShowDialog(); break; case TaskbarType.SimpleClassicThemeTaskbar: if (!ExtraFunctions.IsDotNetRuntimeInstalled()) { if (commandLineOutput) { Console.WriteLine("Error: .NET 5.0 is not installed and is required for SCTT to be installed"); } else { MessageBox.Show(".NET 5.0 is not installed and is required for SCTT to be installed", "Error installing dependencies", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); } ClassicTaskbar.InstallSCTT(null, !commandLineOutput); if (commandLineOutput) { Console.WriteLine("Installed SCTT succesfully"); } break; case TaskbarType.StartIsBackOpenShell: ExtraFunctions.ReConfigureOS(true, true, true); if (commandLineOutput) { Console.WriteLine("Configured Open-Shell and StartIsBack++"); } int returnCode = InstallableUtility.OpenShell.Install(); if (returnCode != 0) { if (commandLineOutput) { Console.WriteLine("Error: Open-Shell installer returned error code {0}", returnCode); } else { MessageBox.Show($"Open-Shell installer returned error code {returnCode}", "Error installing dependencies", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); } if (commandLineOutput) { Console.WriteLine("Installed Open-Shell succesfully"); } returnCode = InstallableUtility.StartIsBackPlusPlus.Install(); if (returnCode != 0) { if (commandLineOutput) { Console.WriteLine("Error: StartIsBack++ installer returned error code {0}", returnCode); } else { MessageBox.Show($"StartIsBack++ installer returned error code {returnCode}", "Error installing dependencies", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); } if (commandLineOutput) { Console.WriteLine("Installed StartIsBack++ succesfully"); } break; case TaskbarType.ExplorerPatcher: MessageBox.Show("You have to install ExplorerPatcher through SCT's 'Patch Explorer' GUI.", "Error installing dependencies"); return(false); default: if (commandLineOutput) { Console.WriteLine("Warning: TaskbarType is not SCTT or OS+SiB. No dependencies will be installed."); } else { MessageBox.Show("Taskbar type is not SimpleClassicThemeTaskbar or Open-Shell with StartIsBack. No dependencies will be installed", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } if (commandLineOutput) { Console.WriteLine("Dependencies installed succesfully"); } else { MessageBox.Show("Dependencies installed succesfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(true); }