static private bool ParseCommandLine(ref string[] Arguments) { if (Arguments.Length == 0) { StartVisuals(); // we NEED a project, so show a uproject picker string UProjectFile; string StartingDir = ""; if (ToolsHub.ShowOpenFileDialog("Unreal Project Files (*.uproject)|*.uproject;", "IPhonePackager now requires a .uproject file for certificate/provisioning setup", "mobileprovision", "", ref StartingDir, out UProjectFile)) { Arguments = new string[] { UProjectFile }; } else { Arguments = new string[] { "gui" }; } } if (Arguments.Length == 1) { // if the only argument is a uproject, then assume gui mode, with the uproject as the project if (Arguments[0].EndsWith(".uproject")) { Config.ProjectFile = GamePath = Arguments[0]; MainCommand = "gui"; } else { MainCommand = Arguments[0]; } } else if (Arguments.Length == 2) { MainCommand = Arguments[0]; GamePath = Arguments[1]; } else if (Arguments.Length >= 2) { MainCommand = Arguments[0]; GamePath = Arguments[1]; for (int ArgIndex = 2; ArgIndex < Arguments.Length; ArgIndex++) { string Arg = Arguments[ArgIndex].ToLowerInvariant(); if (Arg.StartsWith("-")) { // Behavior switches switch (Arg) { case "-verbose": Config.bVerbose = true; break; case "-strip": Config.bForceStripSymbols = true; break; case "-compress=best": Config.RecompressionSetting = (int)CompressionLevel.BestCompression; break; case "-compress=fast": Config.RecompressionSetting = (int)CompressionLevel.BestSpeed; break; case "-compress=none": Config.RecompressionSetting = (int)CompressionLevel.None; break; case "-distribution": Config.bForDistribution = true; break; case "-createstub": Config.bCreateStubSet = true; break; case "-sign": Config.bPerformResignWhenRepackaging = true; break; case "-cookonthefly": Config.bCookOnTheFly = true; break; case "-iterate": Config.bIterate = true; break; } // get the stage dir path if (Arg == "-stagedir") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.RepackageStagingDirectory = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-manifest") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.DeltaManifest = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-backup") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.FilesForBackup.Add(Arguments[++ArgIndex]); } else { return(false); } } else if (Arg == "-config") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { GameConfiguration = Arguments [++ArgIndex]; } else { return(false); } } // append a name to the bungle identifier and display name else if (Arg == "-bundlename") { if (Arguments.Length > ArgIndex + 1) { Config.OverrideBundleName = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-mac") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.OverrideMacName = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-architecture" || Arg == "-arch") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Architecture = "-" + Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-project") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.ProjectFile = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-device") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.DeviceId = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-additionalcommandline") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { AdditionalCommandline = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-provision") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.Provision = Arguments [++ArgIndex]; Config.bProvision = true; } else { return(false); } } else if (Arg == "-certificate") { if (Arguments.Length > ArgIndex + 1) { Config.Certificate = Arguments [++ArgIndex]; Config.bCert = true; } else { return(false); } } } else { // RPC command MainRPCCommand = Arguments[ArgIndex]; } } if (!SSHCommandHelper.ParseSSHProperties(Arguments)) { return(false); } } return(true); }
static private bool ParseCommandLine(ref string[] Arguments) { if (Arguments.Length == 0) { StartVisuals(); // we NEED a project, so show a uproject picker string UProjectFile; string StartingDir = ""; if (ToolsHub.ShowOpenFileDialog("Unreal Project Files (*.uproject)|*.uproject;", "IPhonePackager now requires a .uproject file for certificate/provisioning setup", "mobileprovision", "", ref StartingDir, out UProjectFile)) { Arguments = new string[] { UProjectFile }; } else { Arguments = new string[] { "gui" }; } } if (Arguments.Length == 1) { // if the only argument is a uproject, then assume gui mode, with the uproject as the project if (Arguments[0].EndsWith(".uproject")) { Config.ProjectFile = GamePath = Arguments[0]; MainCommand = "gui"; } else { MainCommand = Arguments[0]; } } else if (Arguments.Length == 2) { MainCommand = Arguments[0]; GamePath = Arguments[1]; if (GamePath.EndsWith(".uproject")) { Config.ProjectFile = GamePath; } } else if (Arguments.Length >= 2) { MainCommand = Arguments[0]; GamePath = Arguments[1]; if (GamePath.EndsWith(".uproject")) { Config.ProjectFile = GamePath; } for (int ArgIndex = 2; ArgIndex < Arguments.Length; ArgIndex++) { string Arg = Arguments[ArgIndex].ToLowerInvariant(); if (Arg.StartsWith("-")) { // Behavior switches switch (Arg) { case "-verbose": Config.bVerbose = true; break; case "-strip": Config.bForceStripSymbols = true; break; case "-compress=best": Config.RecompressionSetting = (int)CompressionLevel.BestCompression; break; case "-compress=fast": Config.RecompressionSetting = (int)CompressionLevel.BestSpeed; break; case "-compress=none": Config.RecompressionSetting = (int)CompressionLevel.None; break; case "-distribution": Config.bForDistribution = true; break; case "-codebased": Config.bIsCodeBasedProject = true; break; case "-createstub": Config.bCreateStubSet = true; break; case "-sign": Config.bPerformResignWhenRepackaging = true; break; case "-cookonthefly": Config.bCookOnTheFly = true; break; case "-iterate": Config.bIterate = true; break; case "-tvos": Config.OSString = "TVOS"; break; case "-autosigning": Config.bAutomaticSigning = true; break; } // get the stage dir path if (Arg == "-stagedir") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.RepackageStagingDirectory = Arguments [++ArgIndex]; } else { return(false); } } // get the provisioning uuid else if (Arg == "-provisioninguuid") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.ProvisionUUID = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-teamID") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.TeamID = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-manifest") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.DeltaManifest = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-backup") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.FilesForBackup.Add(Arguments[++ArgIndex]); } else { return(false); } } else if (Arg == "-config") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { GameConfiguration = Arguments [++ArgIndex]; } else { return(false); } } // append a name to the bungle identifier and display name else if (Arg == "-bundlename") { if (Arguments.Length > ArgIndex + 1) { string projectName = "[PROJECT_NAME]"; string bundleId = Arguments[++ArgIndex]; // Check for an illegal bundle id for (int i = 0; i < bundleId.Length; ++i) { char c = bundleId[i]; if (c == '[') { if (bundleId.IndexOf(projectName, i) != i) { Error("Illegal character in bundle ID"); return(false); } i += projectName.Length; } else if ((c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && c != '.' && c != '-') { Error("Illegal character in bundle ID"); return(false); } } // Save the verified bundle id Config.OverrideBundleName = bundleId; } else { return(false); } } else if (Arg == "-schemename") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { SchemeName = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-schemeconfig") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { SchemeConfiguration = Arguments[++ArgIndex]; } else { return(false); } } else if (Arg == "-mac") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.OverrideMacName = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-architecture" || Arg == "-arch") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Architecture = "-" + Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-project") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.ProjectFile = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-device") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.DeviceId = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-additionalcommandline") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { AdditionalCommandline = Arguments [++ArgIndex]; } else { return(false); } } else if (Arg == "-provision") { // make sure there's at least one more arg if (Arguments.Length > ArgIndex + 1) { Config.Provision = Arguments [++ArgIndex]; Config.bProvision = !String.IsNullOrEmpty(Config.Provision); } else { return(false); } } else if (Arg == "-certificate") { if (Arguments.Length > ArgIndex + 1) { Config.Certificate = Arguments [++ArgIndex]; Config.bCert = !String.IsNullOrEmpty(Config.Certificate); } else { return(false); } } } else { // RPC command MainRPCCommand = Arguments[ArgIndex]; } } if (!SSHCommandHelper.ParseSSHProperties(Arguments)) { return(false); } } return(true); }