コード例 #1
0
        //Disables Classic Theme and if specified Classic Taskbar.
        public static void MasterDisable(bool taskbar)
        {
            Process.Start($"{Configuration.InstallPath}DisableThemeScript.bat", "pre").WaitForExit();
            Configuration.Enabled = false;
            if (!taskbar || Configuration.TaskbarType == TaskbarType.ExplorerPatcher)
            {
                Disable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration(true);
                }
            }
            else if (Configuration.TaskbarType == TaskbarType.StartIsBackOpenShell)
            {
                if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build < 22000)
                {
                    Disable();
                    ClassicTaskbar.Disable();
                }
            }
            else if (Configuration.TaskbarType == TaskbarType.SimpleClassicThemeTaskbar)
            {
                ClassicTaskbar.DisableSCTT();
                Disable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
            }
            else if (Configuration.TaskbarType == TaskbarType.Windows81Vanilla)
            {
                Disable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
            }
            else if (Configuration.TaskbarType == TaskbarType.RetroBar)
            {
                foreach (Process p in Process.GetProcessesByName("RetroBar"))
                {
                    p.Kill();
                }

                Disable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
            }
            Process.Start($"{Configuration.InstallPath}DisableThemeScript.bat", "post").WaitForExit();
        }
コード例 #2
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar, bool commandLineError = false)
        {
            Process.Start($"{Configuration.InstallPath}EnableThemeScript.bat", "pre").WaitForExit();
            Configuration.Enabled = true;
            if (!taskbar)
            {
                // No taskbar
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration(true);
                }
                Enable();
            }
            else if (!File.Exists($"{Configuration.InstallPath}SCT.exe"))
            {
                if (!commandLineError)
                {
                    MessageBox.Show("You need to install Simple Classic Theme in order to enable it with Classic Taskbar enabled. Either disable Classic Taskbar from the options menu, or install SCT by pressing 'Run SCT on boot' in the main menu.", "Unsupported action");
                }
                else
                {
                    Console.WriteLine($"Enabling SCT with a taskbar requires SCT to be installed to \"{Configuration.InstallPath}SCT.exe\".");
                }
                Configuration.Enabled = false;
                return;
            }
            else if (Configuration.TaskbarType == TaskbarType.StartIsBackOpenShell)
            {
                if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 3)
                {
                    // StartIsBack+ and Open-Shell
                    // Unsupported for now
                    if (!commandLineError)
                    {
                        MessageBox.Show("StartIsBack+ is still unsupported. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("StartIsBack+ is still unsupported. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
                else if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build < 22000)
                {
                    // StartIsBack++ and Open-Shell
                    if (ExplorerPatcher.Enabled)
                    {
                        ExplorerPatcher.ApplyConfiguration();
                    }
                    ClassicTaskbar.Enable();
                    Thread.Sleep(Configuration.TaskbarDelay);
                    Enable();
                }
                else if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 22000)
                {
                    // StartAllBack and Open-Shell
                    // Unsupported for now
                    if (!commandLineError)
                    {
                        MessageBox.Show("StartAllBack is still unsupported. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("StartAllBack is still unsupported. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
                else
                {
                    // Unsupported operating system
                    if (!commandLineError)
                    {
                        MessageBox.Show("There's no version of StartIsBack for your version of Windows. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("There's no version of StartIsBack for your version of Windows. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
            }
            else if (Configuration.TaskbarType == TaskbarType.SimpleClassicThemeTaskbar)
            {
                // Simple Classic Theme Taskbar
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                ClassicTaskbar.EnableSCTT();
            }
            else if (Configuration.TaskbarType == TaskbarType.Windows81Vanilla)
            {
                // Windows 8.1 Vanilla taskbar with post-load patches
                Enable();

                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep(Configuration.TaskbarDelay);
                ClassicTaskbar.FixWin8_1();
            }
            else if (Configuration.TaskbarType == TaskbarType.RetroBar)
            {
                // RetroBar
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Process.Start($"{Configuration.InstallPath}RetroBar\\RetroBar.exe");
            }
            else if (Configuration.TaskbarType == TaskbarType.ExplorerPatcher)
            {
                // Windows 11 Vanilla taskbar with ExplorerPatcher
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration(true);
                }
            }
            Process.Start($"{Configuration.InstallPath}EnableThemeScript.bat", "post").WaitForExit();
        }