示例#1
0
 private void DownloadNewestTaskbarVersion()
 {
     ClassicTaskbar.InstallSCTT(this, false);
 }
        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);
        }