Beispiel #1
0
 //Disables Classic Theme and if specified Classic Taskbar.
 public static void MasterDisable(bool taskbar)
 {
     Process.Start("C:\\SCT\\DisableThemeScript.bat", "pre").WaitForExit();
     Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme");
     Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\1337ftw\SimpleClassicTheme", "Enabled", false.ToString());
     //SCTT
     if ((string)Configuration.GetItem("TaskbarType", "SiB+OS") == "SCTT")
     {
         ClassicTaskbar.DisableSCTT();
         Disable();
     }
     //Windows 8.1
     else if (Environment.OSVersion.Version.Major != 10)
     {
         Disable();
         Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
         Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
     }
     //Windows 10 with taskbar
     else if (taskbar)
     {
         Disable();
         ClassicTaskbar.Disable();
     }
     //Just disable
     else
     {
         Disable();
     }
     Process.Start("C:\\SCT\\DisableThemeScript.bat", "post").WaitForExit();
 }
Beispiel #2
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();
        }
Beispiel #3
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar)
        {
            Process.Start("C:\\SCT\\EnableThemeScript.bat", "pre").WaitForExit();
            Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme");
            Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\1337SimpleClassicTheme", "Enabled", true.ToString());
            //SCTT
            if ((string)Configuration.GetItem("TaskbarType", "SiB+OS") == "SCTT")
            {
#if DEBUG
#else
                if (Assembly.GetExecutingAssembly().Location != "C:\\SCT\\SCT.exe")
                {
                    MessageBox.Show("This action requires SCT to be installed and SCT to be ran from the Start Menu");
                }
                else
#endif
                {
                    ClassicTaskbar.EnableSCTT();
                    Enable();
                }
            }
            //Windows 8.1
            else if (Environment.OSVersion.Version.Major != 10)
            {
                //Enable the theme
                Enable();

                //Make explorer apply theme
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep((int)Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme").GetValue("TaskbarDelay", 5000));

                ClassicTaskbar.FixWin8_1();
            }
            //Windows 10 with taskbar
            else if (taskbar)
            {
                ClassicTaskbar.Enable();
                Enable();
            }
            //Just enable
            else
            {
                Enable();
            }
            Process.Start("C:\\SCT\\EnableThemeScript.bat", "post").WaitForExit();
        }
Beispiel #4
0
 //Disables Classic Theme and if specified Classic Taskbar.
 public static void MasterDisable(bool taskbar)
 {
     Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme");
     Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "Enabled", false.ToString());
     //Windows 8.1
     if (Environment.OSVersion.Version.Major != 10)
     {
         Disable();
         Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
         Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
     }
     //Windows 10 with taskbar
     else if (taskbar)
     {
         Disable();
         ClassicTaskbar.Disable();
     }
     //Just disable
     else
     {
         Disable();
     }
 }
Beispiel #5
0
 private void DownloadNewestTaskbarVersion()
 {
     ClassicTaskbar.InstallSCTT(this, false);
 }
Beispiel #6
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar)
        {
            Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme");
            Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "Enabled", true.ToString());
            //Windows 8.1
            if (Environment.OSVersion.Version.Major != 10)
            {
                //Enable the theme
                Enable();

                //Make explorer apply theme
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep((int)Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme").GetValue("TaskbarDelay", 5000));

                /*
                 * Remove taskbar blur
                 */

                //Get a handle to the taskbar
                IntPtr taskBarHandle = User32.FindWindowExW(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", "");
                //Create an ACCENTPOLICY instance which describe to disable any sort of transparency or blur
                User32.ACCENTPOLICY accentPolicy = new User32.ACCENTPOLICY {
                    nAccentState = 0
                };
                //Get the size of the ACCENTPOLICY instance
                int accentPolicySize = Marshal.SizeOf(accentPolicy);
                //Get the pointer to the ACCENTPOLICY instance
                IntPtr accentPolicyPtr = Marshal.AllocHGlobal(accentPolicySize);
                //Copy the struct to unmanaged memory so that Win32 can read it
                Marshal.StructureToPtr(accentPolicy, accentPolicyPtr, false);
                //Create a WINCOMPATTRDATA instance which sets the WindowCompositionAttribute (19) to the ACCENTPOLICY instance
                var winCompatData = new User32.WINCOMPATTRDATA
                {
                    nAttribute = 19,
                    ulDataSize = accentPolicySize,
                    pData      = accentPolicyPtr
                };
                //Tell Windows to apply the attribute
                User32.SetWindowCompositionAttribute(taskBarHandle, ref winCompatData);
                //Free the pointer to the ACCENTPOLICY instance
                Marshal.FreeHGlobal(accentPolicyPtr);

                /*
                 * Remove taskbar borders
                 */

                //Get the current taskbar WindowStyle
                IntPtr p = User32.GetWindowLongPtrW(taskBarHandle, -16);
                //Set the taskbar WindowStyle to the original plus an offset of 0x400000
                User32.SetWindowLongPtrW(taskBarHandle, -16, new IntPtr(p.ToInt64() + 0x400000));
                //Set the taskbar WindowStyle back to the original
                User32.SetWindowLongPtrW(taskBarHandle, -16, p);
            }
            //Windows 10 with taskbar
            else if (taskbar)
            {
                ClassicTaskbar.Enable();
                Enable();
            }
            //Just enable
            else
            {
                Enable();
            }
        }
Beispiel #7
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();
        }
        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);
        }