public void ReportVgsError(int errorCode, string message = "") { if (HasReportedError) { return; } var logMessage = errorCode + (string.IsNullOrEmpty(message) ? "" : " (" + message + ")"); if (Instance.IsVgsJob == true) { var vgsJobId = CommandLineArgs.GetArgumentValue("jobID"); var masterServerSessionId = CommandLineArgs.GetArgumentValue("MSSID"); if (!string.IsNullOrEmpty(vgsJobId) && !string.IsNullOrEmpty(masterServerSessionId)) { Network.Instance.SendRequest("localhost:8004/JobResult/" + vgsJobId + "/" + masterServerSessionId + "/" + errorCode); } else { Debug.LogError("Intended to report VGS error, but could not get job or session id: " + logMessage); } HasReportedError = true; } else { Debug.LogError("VGS Error Reported, but not in VGS job: " + logMessage); } }
private void Start() { if (!CommandLineArgs.IsPresent(UseLabelString)) { EnableRoot.SetActive(false); return; } foreach (var roundLabel in GameObject.FindObjectsOfType <RoundLabelBehaviour>()) { roundLabel.DisabledByAbnormal = true; } var text = string.Empty; if (CommandLineArgs.IsPresent("useRoundAsRoundLabel")) { text = CommandLineArgs.GetArgumentValue("round"); } if (string.IsNullOrEmpty(text)) { text = CommandLineArgs.GetArgumentValue("roundLabel"); } TextComponent.text = text ?? string.Empty; if (string.IsNullOrEmpty(text)) { EnableRoot.SetActive(false); } }
public void ReportVgsVideoDuration() { var vgsJobId = CommandLineArgs.GetArgumentValue("jobID"); var masterServerSessionId = CommandLineArgs.GetArgumentValue("MSSID"); if (!string.IsNullOrEmpty(vgsJobId) && !string.IsNullOrEmpty(masterServerSessionId)) { Network.Instance.SendRequest("localhost:8004/VideoDuration/" + vgsJobId + "/" + masterServerSessionId + "/" + RecordingLord.FrameTotal + "/" + RecordingLord.Duration); } else { Debug.LogError("Intended to report VGS video duration, but could not get job or session id"); } }
private void Start() { var text = string.Empty; if (CommandLineArgs.IsPresent(ArgumentName)) { text = CommandLineArgs.GetArgumentValue(ArgumentName); } TextComponent.text = text ?? string.Empty; if (string.IsNullOrEmpty(text)) { EnableRoot.SetActive(false); } }
private void PopulateSubSteps() { var foundValue = CommandLineArgs.GetArgumentValue(ArgumentName); //"(10.0,00.0,10.0):(1,0,0):2:1|10.0,2.0,10.0):(1,0,0):2:1|10.0,-2.0,10.0):(1,0,0):2:1|(10.0,1.0,10.0):(1,0,0):2:1"; var tokens = foundValue.Split('|'); CameraSubSteps.Clear(); if (tokens.Length > 0 && tokens[0].Contains(':')) { foreach (var token in tokens) { CameraSubSteps.Add(CameraSubStep.GenerateFromString(token)); } } }
public override IEnumerator ReceivePayload(VisualPayload payload) { string foundValue = CommandLineArgs.GetArgumentValue(ParameterName.GetFirstValue(payload.Data)); bool found = !string.IsNullOrEmpty(foundValue); ParameterTarget.SetValue(!found ? DefaultValue.GetFirstValue(payload.Data) : foundValue, payload.Data); var iterator = Router.TransmitAll(payload); while (iterator.MoveNext()) { yield return(null); } }
public void Play() { if (State == LockedState) { return; } if (EvaluateOnPlay && State != WaitingForEvalState) { if (ChainView.Instance.Chain.HasError) { if (HaxxisGlobalSettings.Instance.IsVgsJob == true) { VgsJobId = CommandLineArgs.GetArgumentValue("jobID"); MasterServerSessionId = CommandLineArgs.GetArgumentValue("MSSID"); HaxxisGlobalSettings.Instance.ReportVgsError(8, "HP has chain errors"); } PlayStopped(); return; } State = WaitingForEvalState; ChainView.Instance.EvaluateChain(); return; } if (HideChainViewOnPlay) { WasChainViewOpen = ChainView.Instance.Visible; ChainView.Instance.Visible = false; } if (MinimizeOnPlay) { Minimize(true); } Timeline.Play(); }
public static void PerformAutoBuild() { var buildName = CommandLineArgs.GetArgumentValue("buildName"); Debug.Log("PerformAutoBuild running for build name \"" + buildName + "\""); BuildManagerWindow bmw = ScriptableObject.CreateInstance("BuildManagerWindow") as BuildManagerWindow; Debug.Log("Loading manifest at " + bmw.ManifestPath); bmw.LoadManifest(); BuildEntry buildEntry = bmw.Manifest.Builds.Find(e => e.Name == buildName); if (buildEntry == null) { Debug.Log("Failure: Haxxis build entry not found."); EditorApplication.Exit(1); return; } //buildEntry.DoCopyFolders = true; buildEntry.DoCopyLocalFolders = true; buildEntry.DoCopyLocalFiles = true; buildEntry.DoDeploy = false; Debug.Log("Starting the build"); BuildPathEnvironmentVariable candidateBuildRootEnvVar = new BuildPathEnvironmentVariable( @"CGC_CANDIDATE_BUILD_ROOT", "Value should be the path where candidate builds should be placed (only used by Build Server)."); var success = buildEntry.Build(candidateBuildRootEnvVar); if (!success) { Debug.Log("PerformAutoBuild failed"); EditorApplication.Exit(1); return; } Debug.Log("Finished running PerformAutoBuild"); }
private void Start() { DevCommandManager.Instance.RegisterDevCommand(this); var scriptName = CommandLineArgs.GetArgumentValue(StartupScriptCommandLineArg); if (!string.IsNullOrEmpty(scriptName)) { DevCommandManager.Instance.QueueDevCommand("test " + scriptName); } else { if (File.Exists(TestScriptsDirectoryPath + "StartupLocal.txt")) { DevCommandManager.Instance.QueueDevCommand("test StartupLocal.txt"); } else { DevCommandManager.Instance.QueueDevCommand("test Startup.txt"); } } }
private void HandleChainViewIsEvaluatingChanged(bool chainViewIsEvaluating) { EvaluatingIndicatorComponent.IsTurnedOn = chainViewIsEvaluating; if (chainViewIsEvaluating == false) { if (State == WaitingForEvalState) { if (HaxxisGlobalSettings.Instance.IsVgsJob == true) { NumRecordingsStartedThisPlayback = 0; VgsJobId = CommandLineArgs.GetArgumentValue("jobID"); MasterServerSessionId = CommandLineArgs.GetArgumentValue("MSSID"); if (!string.IsNullOrEmpty(VgsJobId) && !string.IsNullOrEmpty(MasterServerSessionId)) { TimelineDuration = Timeline.RecursiveDuration; if (TimelineDuration <= 0.0f) { TimelineDuration = 0.001f; // Avoid divide by zero later } TimelineDurationIsEstimated = Timeline.RecursiveDurationIsEstimated; var stepCount = Timeline.RecursiveStepCount; if (stepCount <= 1) { HaxxisGlobalSettings.Instance.ReportVgsError(5, "HP has no choreography"); } TimeStarted = Time.time; StartCoroutine(PeriodicProgressUpdate(VgsJobId, MasterServerSessionId, 3.0f)); } } Play(); } } }
private void UpdateRoundLabel() { if (DisabledByAbnormal) { EnableRoot.SetActive(false); return; } var text = string.Empty; if (CommandLineArgs.IsPresent("useRoundAsRoundLabel")) { text = CommandLineArgs.GetArgumentValue("round"); } if (string.IsNullOrEmpty(text)) { text = CommandLineArgs.GetArgumentValue("roundLabel"); } TextComponent.text = text ?? string.Empty; EnableRoot.SetActive(!string.IsNullOrEmpty(text)); }
protected override IEnumerator ExecuteStep() { if (!TemporarilyDisable) { if (!Timeline.IsSeeking) { Debug.Log("Starting recording!"); var filename = CommandLineArgs.GetArgumentValue("VideoFilename"); if (string.IsNullOrEmpty(filename)) { filename = "Choreography.mp4"; } RecordingLord.StartRecording(filename); TimelineViewBehaviour.Instance.NumRecordingsStartedThisPlayback++; } } Router.FireEvent(EndEventName); yield return(null); }
public static void PerformAutoDeploy() { // This is a call designed to be made externally, to do just the 'deploy' step on an already-built local build. var buildName = CommandLineArgs.GetArgumentValue("buildName"); Debug.Log("PerformAutoDeploy running for build name \"" + buildName + "\""); BuildManagerWindow bmw = ScriptableObject.CreateInstance("BuildManagerWindow") as BuildManagerWindow; Debug.Log("Loading manifest at " + bmw.ManifestPath); bmw.LoadManifest(); BuildEntry buildEntry = bmw.Manifest.Builds.Find(e => e.Name == buildName); if (buildEntry == null) { Debug.Log("Failure: Haxxis build entry not found."); EditorApplication.Exit(1); return; } buildEntry.DoDeploy = true; BuildPathEnvironmentVariable candidateBuildRootEnvVar = new BuildPathEnvironmentVariable( @"CGC_CANDIDATE_BUILD_ROOT", "Value should be the path where candidate builds should be placed (only used by Build Server)."); var path = Path.Combine(candidateBuildRootEnvVar.Value, buildEntry.Name); var filename = Path.Combine(path, BuildEntry.LastBuildMadeFilename); string lastBuildDirName = File.ReadAllText(filename); Debug.Log("Starting the deploy"); var relativePath = Path.Combine(buildEntry.Name, lastBuildDirName); buildEntry.Deploy(relativePath, candidateBuildRootEnvVar); Debug.Log("Finished running PerformAutoDeploy"); }
public bool Execute() { var mc = NetworkSystem.Network.Instance; if (UrlText.IsPresent) { var urlText = (string)UrlText.Value; var singleReqTimeout = Single.MaxValue; // Default is 'no timeout' if (TimeoutOption.IsPresent) { singleReqTimeout = (float)TimeoutOption.Arguments[0].Value; } if (ResolveCmdLineArgsOption.IsPresent) { int openBraceDelim; while ((openBraceDelim = urlText.IndexOf('{')) >= 0) { var closeBraceDelim = urlText.IndexOf('}'); var oldString = urlText.Substring(openBraceDelim, (closeBraceDelim - openBraceDelim) + 1); var keyName = oldString.Substring(1, oldString.Length - 2); var newString = CommandLineArgs.GetArgumentValue(keyName); if (string.IsNullOrEmpty(newString)) { Debug.Log("Error: Could not convert command line argument with key " + keyName); return(false); } urlText = urlText.Replace(oldString, newString); } } if (ResolveProcessIDOption.IsPresent) { const string processIdKeyword = "PROCESS_ID"; var processIdKeywordIndex = urlText.IndexOf(processIdKeyword); if (processIdKeywordIndex < 0) { Debug.Log("Error: -resolveProcessID was used but no keyword PROCESS_ID was found in the given URL"); return(false); } else { var processIdValueString = Process.GetCurrentProcess().Id.ToString(); urlText = urlText.Replace(processIdKeyword, processIdValueString); } } var id = mc.SendRequest(urlText, SilentOption.IsPresent, singleReqTimeout, LifelineOption.IsPresent); if (WaitOption.IsPresent) { // Add the ID of the request we just made, to the 'waiting for' list, and set the wait gate RequestsToWaitFor.Add(id); DevCommandManager.Instance.StartWait(); } } if (WaitAllOption.IsPresent) { // Go through all pending requests, and add them to our 'waiting for' list. If there are any, set the wait gate var requests = mc.PendingRequests; foreach (var r in requests) { RequestsToWaitFor.Add(r.Id); } if (requests.Any()) { DevCommandManager.Instance.StartWait(); } } if (CancelLifelineOption.IsPresent) { var requests = mc.PendingRequests; var countBefore = requests.Count; requests.RemoveAll(r => r.LifelineRequest); Debug.Log("Cancelled " + (countBefore - requests.Count) + " pending lifeline request(s)"); } if (ListOption.IsPresent) { var requests = mc.PendingRequests; foreach (var r in requests) { var s = String.Format("ID:{0,4} ", r.Id); s += "Silent:" + (r.Silent ? "Y" : "N"); s += " Timeout:" + (r.TimeoutSecs >= Single.MaxValue ? String.Format("{0,8}", "None ") : String.Format("{0,7:F2}s", r.TimeoutSecs)); s += " URL:" + r.Request.url; Debug.Log(s); } Debug.Log(requests.Count + " pending requests"); } if (WaitingIndicatorOnOption.IsPresent) { mc.WaitingIndicatorDisplayOverride = true; } if (WaitingIndicatorOffOption.IsPresent) { mc.WaitingIndicatorDisplayOverride = false; } return(true); }
public bool Execute() { if (NewOption.IsPresent) { ChainView.LoadNewChain(); } if (ChainView == null) { return(false); } var loadFilename = ""; if (LoadOption.IsPresent) { loadFilename = (string)LoadOption.Arguments[0].Value; } if (LoadFromCmdLineArgOption.IsPresent) { loadFilename = CommandLineArgs.GetArgumentValue((string)LoadFromCmdLineArgOption.Arguments[0].Value); if (String.IsNullOrEmpty(loadFilename)) { Debug.Log("Cannot load because that command line argument was not found or had no value"); return(false); } } if (!String.IsNullOrEmpty(loadFilename)) { var fullPath = Path.Combine(HaxxisPackage.RootPath, loadFilename); ChainView.LoadPackage(new ChainView.PackageRequest(fullPath, null)); } if (ImportOption.IsPresent) { var filename = (string)LoadOption.Arguments[0].Value; var fullPath = Path.Combine(HaxxisPackage.RootPath, filename); ChainView.ImportFile(fullPath); } if (SaveOption.IsPresent) { if (string.IsNullOrEmpty(ChainView.LoadedPackagePath)) { Debug.Log("Cannot save because there is no file name; try -saveAs instead"); return(false); } ChainView.SavePackage(new ChainView.PackageRequest(ChainView.LoadedPackagePath, null)); } if (SaveAsOption.IsPresent) { var filename = (string)SaveAsOption.Arguments[0].Value; var fullPath = Path.Combine(HaxxisPackage.RootPath, filename); ChainView.SavePackage(new ChainView.PackageRequest(fullPath, null)); } if (EvalOption.IsPresent) { if (!ChainView.Chain.HasError) { ChainView.EvaluateChain(); } else { Debug.Log("Cannot eval because chain has error"); } } if (OnOption.IsPresent) { ChainView.Visible = true; } if (OffOption.IsPresent) { ChainView.Visible = false; } if (InfoOption.IsPresent) { ChainView.DumpInfo(); } return(true); }
protected override bool CheckArgument() { var foundValue = CommandLineArgs.GetArgumentValue(ArgumentName); return(StringsToMatch.ToLowerInvariant().Split(',').Contains(foundValue)); }
public bool Execute() { var videoCodecSet = false; //var videoCodecIndex = -1; if (SetVideoCodecOption.IsPresent) { var name = (string)SetVideoCodecOption.Arguments[0].Value; if (RecordingLord.CheckCodec(name)) { videoCodecSet = true; RecordingLord.Vcodec = name; } else { Debug.Log("Error: No match found for video codec \"" + name + "\""); return(false); } } if (SetVideoCodecFromCmdLineArgOption.IsPresent) { var videoCodecString = CommandLineArgs.GetArgumentValue((string)SetVideoCodecFromCmdLineArgOption.Arguments[0].Value); if (string.IsNullOrEmpty(videoCodecString)) { // Commenting this out to help avoid confusion //Debug.Log("Error: Cannot set video codec because that command line argument was not found or had no value"); return(true); // Don't report this as an error } if (RecordingLord.CheckCodec(videoCodecString)) { videoCodecSet = true; RecordingLord.Vcodec = videoCodecString; } else { Debug.Log("Error: No match found for video codec \"" + videoCodecString + "\""); return(false); } } if (videoCodecSet) { Debug.Log("Video codec index set to " + RecordingLord.Vcodec); } var frameRateSet = false; var frameRate = 30; if (FrameRateOption.IsPresent) { frameRate = (int)FrameRateOption.Arguments[0].Value; frameRateSet = true; } if (FrameRateFromCmdLineArgOption.IsPresent) { var frameRateString = CommandLineArgs.GetArgumentValue((string)FrameRateFromCmdLineArgOption.Arguments[0].Value); if (string.IsNullOrEmpty(frameRateString)) { //Debug.Log("Error: Cannot set frame rate because that command line argument was not found or had no value"); return(false); } object value = null; if (!frameRateString.StringToValueOfType(typeof(int), ref value, true)) { return(false); } frameRate = (int)value; frameRateSet = true; } if (frameRateSet) { RecordingLord.FrameRate = frameRate; Debug.Log("Movie frame rate set to " + RecordingLord.FrameRate); } var jqualitySet = false; var jquality = 100; if (JpegQualityOption.IsPresent) { jquality = (int)JpegQualityOption.Arguments[0].Value; jqualitySet = true; } if (JpegQualityFromCmdLineArgOption.IsPresent) { var jqualityString = CommandLineArgs.GetArgumentValue((string)JpegQualityFromCmdLineArgOption.Arguments[0].Value); if (string.IsNullOrEmpty(jqualityString)) { //Debug.Log("Error: Cannot set frame rate because that command line argument was not found or had no value"); return(false); } object value = null; if (!jqualityString.StringToValueOfType(typeof(int), ref value, true)) { return(false); } jquality = (int)value; jqualitySet = true; } if (jqualitySet) { RecordingLord.JpegQuality = jquality; Debug.Log("Movie JPEG quality set to " + RecordingLord.JpegQuality); } if (StartOption.IsPresent) { if (!RecordingLord.IsRecording()) { // We start recording in a job, which happens as a coroutine. This fixes (11/10/2015) an issue where videos // were black for several seconds at the beginning, which I think was related to choreography-triggered // video recording that were also being started in jobs. var filename = (string)StartOption.Arguments[0].Value; JobManager.Instance.StartJob(StartRecordingMovie(filename), jobName: "RecordMovieFromDevCmd"); } else { Debug.Log("Error: Movie already being captured"); return(false); } } if (StopOption.IsPresent) { if (RecordingLord.IsRecording()) { RecordingLord.StopRecording(); Debug.Log("Frames captured: " + RecordingLord.FrameTotal + "; total duration " + RecordingLord.Duration + " seconds"); } else { Debug.Log("Error: No movie being captured"); return(false); } } if (PauseOption.IsPresent) { if (!RecordingLord.IsRecording()) { Debug.Log("Error: No movie being captured"); return(false); } if (RecordingLord.IsPaused()) { Debug.Log("Warning: Pause request made but movie recording is already paused"); return(true); } RecordingLord.PauseRecording(); Debug.Log("Movie recording paused; duration so far is " + RecordingLord.Duration + " seconds"); } if (ResumeOption.IsPresent) { if (!RecordingLord.IsRecording()) { Debug.Log("Error: No movie being captured"); return(false); } if (!RecordingLord.IsPaused()) { Debug.Log("Warning: Resume request made but movie recording is not paused"); return(true); } RecordingLord.ResumeRecording(); Debug.Log("Movie recording resumed"); } return(true); }
public bool Execute() { if (AddOption.IsPresent) { foreach (DevCommandManager.Argument arg in AddOption.Arguments.Where(arg => arg.IsPresent)) { AddCLA((string)arg.Value); } } if (DeleteOption.IsPresent) { DeleteMatchingCLAs((string)DeleteOption.Arguments[0].Value); } if (DeleteAllOption.IsPresent) { var numDeleted = CommandLineArgs.DeleteAllCommandLineArguments(); Debug.Log("Deleted all " + numDeleted + " added command line arguments"); } if (ReplaceOption.IsPresent) { var newCla = (string)ReplaceOption.Arguments[0].Value; var equalSignIndex = newCla.IndexOf('='); var oldKey = equalSignIndex < 0 ? newCla : newCla.Substring(0, equalSignIndex); DeleteMatchingCLAs(oldKey); AddCLA(newCla); } if (DumpOption.IsPresent) { var args = CommandLineArgs.GetCommandLineArguments(); foreach (var arg in args) { Debug.Log(arg); } Debug.Log(args.Count + " command line arguments total"); } // This is meant for copying from VGS web interface 'parameters' box if (AddFromClipboardOption.IsPresent || CopyFromClipboardOption.IsPresent) { if (CopyFromClipboardOption.IsPresent) { CommandLineArgs.DeleteAllCommandLineArguments(); } var allText = Clipboard.GetText(); if (!string.IsNullOrEmpty(allText)) { var text = new string(allText.TakeWhile(c => c != '\n').ToArray()); // Just take the first line of text Debug.Log("Parsing this text from clipboard: " + text); // example: -ShowPolls=false -title="SCORES BY ROUND" -isVGSJob -foo=Bar // translates to: ShowPolls=false title=SCORES BY ROUND isVGSJob foo=Bar while (true) { text = text.Trim(); var hyphenIndex = text.IndexOf('-'); if (hyphenIndex < 0) { if (!string.IsNullOrEmpty(text)) { Debug.Log("Warning: Ignoring extra text: " + text); } break; } if (hyphenIndex > 0) { Debug.Log("Warning: Ignoring extra text: " + text.Substring(0, hyphenIndex)); } text = text.Substring(hyphenIndex + 1); // Hyphen found; now look for the next equals sign, OR space (for a CLA with no value) var equalsIndex = text.IndexOf('='); var spaceIndex = text.IndexOf(' '); if (equalsIndex < 0 && spaceIndex < 0) // Neither { AddCLA(text); break; } if ((equalsIndex < 0) || // Space only (spaceIndex >= 0 && spaceIndex < equalsIndex)) // Both space and equals were found { // Found a CLA with no value (e.g. -isVGSJob) AddCLA(text.Substring(0, spaceIndex)); text = text.Substring(spaceIndex + 1); continue; } // There is an equals, and it came before any space. Now look for quotes in the value var quoteIndex = text.IndexOf('"'); var onePastValueIndex = spaceIndex; if (quoteIndex >= 0 && quoteIndex == equalsIndex + 1) { var nextQuoteIndex = text.IndexOf('"', quoteIndex + 1); if (nextQuoteIndex < 0) { Debug.Log("Error parsing CLAs from clipboard: missing closing quote after " + text); return(false); } // Remote the quotes text = text.Substring(0, quoteIndex) + text.Substring(quoteIndex + 1, (nextQuoteIndex - quoteIndex) - 1) + text.Substring(nextQuoteIndex + 1); onePastValueIndex = nextQuoteIndex - 2 + 1; } if (onePastValueIndex < 0) { AddCLA(text); break; } AddCLA(text.Substring(0, onePastValueIndex)); if (onePastValueIndex < text.Length - 1) { text = text.Substring(onePastValueIndex + 1); } else { break; } } } else { Debug.Log("Error: Clipboard did not contain text"); return(false); } } if (DumpToClipboardOption.IsPresent) // This is meant for copy TO VGS web interface 'parameters' box { var text = ""; foreach (var cla in CommandLineArgs.AddedCommandLineArgs) { var formattedCla = cla; var spaceIndex = cla.IndexOf(' '); if (spaceIndex >= 0) { var equalsIndex = cla.IndexOf('='); if (equalsIndex >= 0) { formattedCla = cla.Substring(0, equalsIndex + 1) + '"' + cla.Substring(equalsIndex + 1, (cla.Length - equalsIndex) - 1) + '"'; } else { Debug.Log("Error: Command line argument has a space but not an equals sign"); // This should not happen } } text += " -" + formattedCla; } if (string.IsNullOrEmpty(text)) { text = "(No parameters)"; } Clipboard.SetText(text); Debug.Log("Copied this string to Windows clipboard: " + text); } if (TestOption.IsPresent) { var value = CommandLineArgs.GetArgumentValue((string)TestOption.Arguments[0].Value); Debug.Log("Value found: " + value); } return(true); }
public bool Execute() { var changeRes = false; var changeFullScreenMode = false; var newFullScreenMode = Screen.fullScreen; int newWidth = 0; int newHeight = 0; if (ShowAvailableResolutionsOption.IsPresent) { Resolution[] resolutions = Screen.resolutions; foreach (var res in resolutions) { Debug.Log(res.width + "x" + res.height + "; " + res.refreshRate + "hz"); } } if (DumpOption.IsPresent) { var s = string.Format("Resolution: {0}x{1}; {2}", Screen.width, Screen.height, Screen.fullScreen ? "Full screen" : "Windowed"); Debug.Log(s); } if (FullScreenOnOption.IsPresent) { changeFullScreenMode = true; newFullScreenMode = true; } if (FullScreenOffOption.IsPresent) { changeFullScreenMode = true; newFullScreenMode = false; } if (SetFullScreenFromCmdLineArgOption.IsPresent) { var fullScreenModeArg = CommandLineArgs.GetArgumentValue((string)SetFullScreenFromCmdLineArgOption.Arguments[0].Value).ToLower(); if (string.IsNullOrEmpty(fullScreenModeArg)) { Debug.Log("Cannot set full screen mode because that command line argument was not found or had no value"); return(false); } if (fullScreenModeArg.Equals("on")) { changeFullScreenMode = true; newFullScreenMode = true; } else if (fullScreenModeArg.Equals("off")) { changeFullScreenMode = true; newFullScreenMode = false; } else { Debug.Log("Error: Full screen mode argument value must be \"on\" or \"off\""); return(false); } } if (changeFullScreenMode) { if (newFullScreenMode) { if (Screen.fullScreen) { Debug.Log("Already in full screen mode"); changeFullScreenMode = false; // Cancel the operation (but don't return error...this is really just a warning) } else { Debug.Log("Setting full screen mode"); } } else { if (!Screen.fullScreen) { Debug.Log("Already in windowed mode"); changeFullScreenMode = false; // Cancel the operation (but don't return error...this is really just a warning) } else { Debug.Log("Setting windowed mode"); } } } var resString = ""; if (SetResolutionOption.IsPresent) { resString = ((string)SetResolutionOption.Arguments[0].Value).ToLower(); } if (SetResFromCmdLineArgOption.IsPresent) { resString = CommandLineArgs.GetArgumentValue((string)SetResFromCmdLineArgOption.Arguments[0].Value); if (string.IsNullOrEmpty(resString)) { Debug.Log("Cannot set resolution because that command line argument was not found or had no value"); return(false); } } if (!string.IsNullOrEmpty(resString)) { var numbers = resString.Split('x'); if (numbers.Count() != 2) { Debug.Log("Error in screen resolution specification; must use correct format as in 1920x1600"); return(false); } newWidth = Convert.ToInt32(numbers[0]); newHeight = Convert.ToInt32(numbers[1]); Resolution[] resolutions = Screen.resolutions; var found = resolutions.Any(res => res.width == newWidth && res.height == newHeight); if (found) { changeRes = true; } else { Debug.Log("Error: That resolution is not supported"); return(false); } } // We have this 'combo' logic because if we're changing full screen mode AND resolution at the same time, we have to coordinate if (changeFullScreenMode && !changeRes) { Screen.fullScreen = newFullScreenMode; } else if (changeRes) // Res only, or Res >and< full screen mode... { Screen.SetResolution(newWidth, newHeight, newFullScreenMode); } return(true); }
public bool Execute() { DoingJustCurrentHPValidation = !Arguments[0].IsPresent; if (!DoingJustCurrentHPValidation) // (Otherwise, we want to validate just the currently loaded HP (skip the load, but do everything else)) { var fileNameSpec = (string)Arguments[0].Value; if (FromCmdLineArgOption.IsPresent) { fileNameSpec = CommandLineArgs.GetArgumentValue(fileNameSpec); if (String.IsNullOrEmpty(fileNameSpec)) { Debug.Log("That command line argument was not found or had no value"); return(false); } } var dir = "HaxxisPackages"; var lastBackslashIndex = fileNameSpec.LastIndexOf('\\'); if (lastBackslashIndex >= 0) { dir += ("\\" + fileNameSpec.Substring(0, lastBackslashIndex)); fileNameSpec = fileNameSpec.Substring(lastBackslashIndex + 1, (fileNameSpec.Length - lastBackslashIndex) - 1); } if (!Path.HasExtension(fileNameSpec)) { fileNameSpec += ".json"; } var files = Directory.GetFiles(dir, fileNameSpec, SearchOption.AllDirectories).ToList(); if (files.Count == 0) { Debug.Log("No matches found for \"" + fileNameSpec + "\""); return(false); } Packages.Clear(); foreach (var file in files) { var package = new Package(); package.Filename = file; package.Result = ResultCode.Success; Packages.Add(package); } } if (ListOnlyOption.IsPresent) { if (DoingJustCurrentHPValidation) { Debug.Log("Error: -listOnly option must be used with a file spec (e.g. *.json)"); return(false); } foreach (var package in Packages) { Debug.Log(package.Filename); } Debug.Log(Packages.Count + " matches found"); } else { ChainView.ErrorOccurred += HandleErrorOccurred; ChainView.IsBusyChanged += HandleIsBusyChanged; TimelineView.PlayStarted += HandleTimelineViewPlayStarted; TimelineView.PlayStopped += HandleTimelineViewPlayStopped; SavedJobManagerVerbosityLevel = JobManager.Instance.ExceptionVerbosityLevel; JobManager.Instance.ExceptionVerbosityLevel = VerboseOption.IsPresent ? 3 : 0; if (DoingJustCurrentHPValidation) { // Just validate the currently-loaded HP; in this case, we 'pretend' we just loaded the HP: Stage = ValidationStage.Load; ErrorInLastStage = false; CurrentFileName = "the current package"; HandleIsBusyChanged(false); } else { CurrentFileIndex = 0; TotalPackagesAttempted = 0; TotalSuccessfulLoads = 0; TotalSuccessfulChains = 0; TotalSuccessfulEvals = 0; TotalSuccessfulChoreography = 0; TotalSuccessfulSaves = 0; StartNextFileValidation(); } } return(true); }