Example #1
0
        public void Run(InteractiveShell.InteractiveShell gui)
        {
            int selectedOption = 0;

            while (true)
            {
                gui.DrawTitle(Program.AppName,
                              "Help", "opt         | Optimizes games by isolating cores and adjusting low priorities." +
                              "\nres         | Restores all processes back to normal." +
                              "\nres -force  | Forces all processes to Normal Priority and Affinity 'All Cores'" +
                              "\nedit        | Allows you to edit the priorty process list." +
                              "\naudio       | Launches SndVol.exe -f allowing you to change the computers master volume." +
                              "\naudio mixer | Launches SndVol.exe -m opening the volume mixer."
                              , null, true);

                selectedOption = gui.DisplayMenu(new string[] { "Open README.txt", "Open LICENSE.txt", "Back" }, null, selectedOption);

                switch (selectedOption)
                {
                case 0:
                    Program.OpenWithDefaultProgram("README.txt"); break;

                case 1:
                    Program.OpenWithDefaultProgram("LICENSE.txt"); break;

                default:
                    return;
                }
            }
        }
Example #2
0
        public void Run(InteractiveShell.InteractiveShell gui)
        {
            if (!_settings.TOTDEnabled)
            {
                return;
            }

            int selectedOption = 0;

            while (true)
            {
                gui.DrawTitle("Tip of the day! ", string.Format("Tip #{0}", _settings.TipNumber + 1), null, true);
                gui.DrawSubtitleText(tips[_settings.TipNumber]);

                selectedOption = gui.DisplayMenu(new string[] { "Proceed to Main Menu", "Next Tip" }, null, selectedOption);

                // Increment tip by one now that the current tip has been viewed.
                _settings.TipNumber++;
                if (_settings.TipNumber >= tips.Length)
                {
                    _settings.TipNumber = 0;
                }

                if (selectedOption == 0)
                {
                    break;
                }
            }
        }
Example #3
0
        public void Run(InteractiveShell.InteractiveShell gui)
        {
            TOTDMenu tOTDMenu = new TOTDMenu(optionsMenu);

            tOTDMenu.Run(gui);

            int selectedOption = 0;

            while (true)
            {
                gui.DrawTitle(Program.AppName, Program.Optimizer.IsOptimized ? "Currently optimized, use 'Restore' or the command 'res' to de-optimize.\nSome menu options are unavailable because of this." : "Main Menu", null, true);
                selectedOption = gui.DisplayMenu(new string[] { Program.Optimizer.IsOptimized ? "Unavailable" : "Optimize >",
                                                                Program.Optimizer.IsOptimized ? "Unavailable" : "Command Input >",
                                                                "Restore",
                                                                "Options >",
                                                                "Help >",
                                                                "Exit" }, null, selectedOption);

                switch (selectedOption)
                {
                case 0:
                    if (Program.Optimizer.IsOptimized)
                    {
                        continue;
                    }

                    optimizeMenu.Run(gui);
                    break;

                case 1:
                    if (Program.Optimizer.IsOptimized)
                    {
                        continue;
                    }

                    commandMenu.Run(gui);
                    break;

                case 2:
                    commandMenu.RunCommand("res", gui);
                    break;

                case 3:
                    optionsMenu.Run(gui);
                    break;

                case 4:
                    commandMenu.RunCommand("help", gui);
                    break;

                case 5:
                    commandMenu.RunCommand("exit", gui);
                    break;
                }

                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Example #4
0
        //public static void PlayMusic()
        //{
        //    try
        //    {
        //        // Only works on windows
        //        if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
        //        {
        //            var assembly = Assembly.GetExecutingAssembly();
        //            var resName = "Zintom.GameOptimizer.optimizer_background_compressed.wav";
        //            Stream? s = assembly.GetManifestResourceStream(resName);
        //            if (s != null)
        //            {
        //                SoundPlayer player = new SoundPlayer(s);
        //                player.PlayLooping();
        //            }
        //        }
        //    }
        //    catch { }
        //}

        static void SetupInteractiveShell()
        {
            _gui = new InteractiveShell.InteractiveShell();

            var _shellDisplayOptions = new ShellDisplayOptions()
            {
                LeftOffset = 2
            };

            var _shellTitleDisplayOptions = new ShellTitleDisplayOptions()
            {
                LeftOffset = 2
            };

            _gui.FallbackDisplayOptions = _shellDisplayOptions;
            _gui.FallbackTitleDisplayOptions = _shellTitleDisplayOptions;
        }
Example #5
0
        public void Run(InteractiveShell.InteractiveShell gui)
        {
            ShellTitleDisplayOptions titleDispOptions = new ShellTitleDisplayOptions()
            {
                LeftOffset = 2,
                SubtitleVerticalPadding = 0
            };

            gui.DrawTitle(Program.AppName, "Enter command to execute:", titleDispOptions, true);
            gui.Reset();

            Console.Write("  >");
            string?command = Console.ReadLine();

            if (string.IsNullOrEmpty(command))
            {
                return;
            }

            RunCommand(command, gui);
        }
Example #6
0
        public void Run(InteractiveShell.InteractiveShell gui)
        {
            gui.DrawTitle(Program.AppName, "Select an optimization method to execute.\n(Run this app as administrator for more boosting power!)", null, true);
            string[] quickCommands = new string[] { "1: Default optimization",
                                                    "2: Default optimization plus Affinity optimization",
                                                    "3: Streamer mode optimization",
                                                    "Back" };

            string[] footerTexts = new string[] {
                "Sets all non-whitelisted processes to 'Low' priority,   \nwhilst leaving whitelisted processes at 'Normal' priority.              \n                       ",
                "Manages process priorties in the same way as option 1   \nwhilst also restricting all non-whitelisted processes to use only       \nthe last two CPU cores.",
                "Forces all 'streamer specific' processes onto the cores \nspecified in 'config.json' and forces all other processes onto the      \nremaining cores.       ",
                "Go back to the previous menu.                           \n                                                                        \n                       "
            };

            gui.FallbackDisplayOptions.FooterVerticalPadding  = 2;
            gui.FallbackDisplayOptions.FooterForegroundColour = ConsoleColor.Cyan;
            int result = gui.DisplayMenu(quickCommands, footerTexts);

            switch (result)
            {
            case 0:
                Program.Command_OptimizeWithFlags(OptimizeConditions.None);
                break;

            case 1:
                Program.Command_OptimizeWithFlags(OptimizeConditions.OptimizeAffinity);
                break;

            case 2:
                Program.Command_OptimizeWithFlags(OptimizeConditions.StreamerMode);
                break;

            //case 3:
            //    Program.Command_OptimizeWithFlags(OptimizeConditions.BoostPriorities | OptimizeConditions.IgnoreOrdinaryProcesses);
            //    break;
            default:
                return;
            }
        }
Example #7
0
 /// <summary>
 /// Runs the given <paramref name="command"/>.
 /// </summary>
 /// <param name="command">The command to run.</param>
 public void RunCommand(string command, InteractiveShell.InteractiveShell gui)
 {
     if (command.StartsWith("opt "))
     {
         Program.Command_OptimizeWithFlags(ParseFlags(command[4..]));