public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilMenuItem = (InstallUtilLauncherMenuItem)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; } installutilMenuItem.Refresh(); if (installutilMenuItem.installutilLauncher.LauncherString == "") { installutilMenuItem.CovenantClient.ApiLaunchersInstallutilPost(); installutilMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated InstallUtilLauncher: " + installutilMenuItem.installutilLauncher.LauncherString); } if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager"))) { EliteConsole.PrintInfoLine(installutilMenuItem.installutilLauncher.StagerCode); } else if (commands.Length == 2 && commands[1].ToLower() == "xml") { EliteConsole.PrintInfoLine(installutilMenuItem.installutilLauncher.DiskCode); } }
public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilLauncherMenuItem = ((InstallUtilLauncherMenuItem)menuItem); string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "write") { menuItem.PrintInvalidOptionError(UserInput); } else { installutilLauncherMenuItem.Refresh(); if (installutilLauncherMenuItem.installutilLauncher.LauncherString == "") { installutilLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost(); installutilLauncherMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated InstallUtilLauncher: " + installutilLauncherMenuItem.installutilLauncher.LauncherString); } string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars())); System.IO.File.WriteAllBytes(OutputFilePath, Convert.FromBase64String(installutilLauncherMenuItem.installutilLauncher.DiskCode)); EliteConsole.PrintFormattedHighlightLine("Wrote InstallUtilLauncher to: \"" + OutputFilePath + "\""); } }