예제 #1
0
        // 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();
        }
예제 #2
0
        //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();
        }
        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);
        }