示例#1
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            MSBuildLauncherMenuItem msbuildMenuItem = (MSBuildLauncherMenuItem)menuItem;

            string[] commands = UserInput.Split(" ");
            if (commands.Length < 1 || commands.Length > 2 || commands[0].ToLower() != "code")
            {
                menuItem.PrintInvalidOptionError(UserInput);
                return;
            }
            else if (commands.Length == 2 && (!new List <string> {
                "stager", "gruntstager", "xml"
            }.Contains(commands[1].ToLower())))
            {
                EliteConsole.PrintFormattedErrorLine("Type must be one of: \"Stager\"\\\"GruntStager\" or \"XML\"");
                menuItem.PrintInvalidOptionError(UserInput);
                return;
            }
            msbuildMenuItem.Refresh();
            if (msbuildMenuItem.msbuildLauncher.LauncherString == "")
            {
                msbuildMenuItem.CovenantClient.ApiLaunchersMsbuildPost();
                msbuildMenuItem.Refresh();
                EliteConsole.PrintFormattedHighlightLine("Generated MSBuildLauncher: " + msbuildMenuItem.msbuildLauncher.LauncherString);
            }
            if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager")))
            {
                EliteConsole.PrintInfoLine(msbuildMenuItem.msbuildLauncher.StagerCode);
            }
            else if (commands.Length == 2 && commands[1].ToLower() == "xml")
            {
                EliteConsole.PrintInfoLine(msbuildMenuItem.msbuildLauncher.DiskCode);
            }
        }
示例#2
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            MSBuildLauncherMenuItem msbuildLauncherMenuItem = ((MSBuildLauncherMenuItem)menuItem);

            string[] commands = UserInput.Split(" ");
            if (commands.Length != 2 || commands[0].ToLower() != "write")
            {
                menuItem.PrintInvalidOptionError(UserInput);
            }
            else
            {
                msbuildLauncherMenuItem.Refresh();
                if (msbuildLauncherMenuItem.msbuildLauncher.LauncherString == "")
                {
                    msbuildLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost();
                    msbuildLauncherMenuItem.Refresh();
                    EliteConsole.PrintFormattedHighlightLine("Generated MSBuildLauncher: " + msbuildLauncherMenuItem.msbuildLauncher.LauncherString);
                }

                string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars()));
                System.IO.File.WriteAllText(OutputFilePath, msbuildLauncherMenuItem.msbuildLauncher.DiskCode);
                EliteConsole.PrintFormattedHighlightLine("Wrote MSBuildLauncher to: \"" + OutputFilePath + "\"");
            }
        }