private ContinueType ProcessDebugOutput(ISession vmSession, int stage) { ContinueType Result = ContinueType.EXIT_DONT_CONTINUE; bool noTimeout; LogReader logReader = new LogReader(namedPipeName, debugLogFilename, vmSession, stage, vmTimeout); /* Start the logger thread */ Thread t = new Thread(new ThreadStart(logReader.Run)); t.Start(); /* Wait until it terminates or exits with a timeout */ logReader.TimeOutEvent.WaitOne(); /* Get the result */ Result = logReader.Result; if (logReader.TimedOut) { /* We hit the timeout, quit */ Console.WriteLine("[SYSREG] timeout"); Result = ContinueType.EXIT_CONTINUE; /* Force thread termination */ t.Abort(); } return(Result); }
/// <summary> /// Initializes a new lua options set. /// </summary> /// <param name="acceptBinaryNumbers"><inheritdoc cref="AcceptBinaryNumbers" path="/summary" /></param> /// <param name="acceptCCommentSyntax"><inheritdoc cref="AcceptCCommentSyntax" path="/summary" /></param> /// <param name="acceptCompoundAssignment"><inheritdoc cref="AcceptCompoundAssignment" path="/summary" /></param> /// <param name="acceptEmptyStatements"><inheritdoc cref="AcceptEmptyStatements" path="/summary" /></param> /// <param name="acceptCBooleanOperators"><inheritdoc cref="AcceptCBooleanOperators" path="/summary" /></param> /// <param name="acceptGoto"><inheritdoc cref="AcceptGoto" path="/summary" /></param> /// <param name="acceptHexEscapesInStrings"><inheritdoc cref="AcceptHexEscapesInStrings" path="/summary" /></param> /// <param name="acceptHexFloatLiterals"><inheritdoc cref="AcceptHexFloatLiterals" path="/summary" /></param> /// <param name="acceptOctalNumbers"><inheritdoc cref="AcceptOctalNumbers" path="/summary" /></param> /// <param name="acceptShebang"><inheritdoc cref="AcceptShebang" path="/summary" /></param> /// <param name="acceptUnderscoreInNumberLiterals"><inheritdoc cref="AcceptUnderscoreInNumberLiterals" path="/summary" /></param> /// <param name="useLuaJitIdentifierRules"><inheritdoc cref="UseLuaJitIdentifierRules" path="/summary" /></param> /// <param name="acceptBitwiseOperators"><inheritdoc cref="AcceptBitwiseOperators" path="/summary"/></param> /// <param name="continueType"><inheritdoc cref="ContinueType" path="/summary" /></param> public LuaSyntaxOptions( bool acceptBinaryNumbers, bool acceptCCommentSyntax, bool acceptCompoundAssignment, bool acceptEmptyStatements, bool acceptCBooleanOperators, bool acceptGoto, bool acceptHexEscapesInStrings, bool acceptHexFloatLiterals, bool acceptOctalNumbers, bool acceptShebang, bool acceptUnderscoreInNumberLiterals, bool useLuaJitIdentifierRules, bool acceptBitwiseOperators, ContinueType continueType) { AcceptBinaryNumbers = acceptBinaryNumbers; AcceptCCommentSyntax = acceptCCommentSyntax; AcceptCompoundAssignment = acceptCompoundAssignment; AcceptEmptyStatements = acceptEmptyStatements; AcceptCBooleanOperators = acceptCBooleanOperators; AcceptGoto = acceptGoto; AcceptHexEscapesInStrings = acceptHexEscapesInStrings; AcceptHexFloatLiterals = acceptHexFloatLiterals; AcceptOctalNumbers = acceptOctalNumbers; AcceptShebang = acceptShebang; AcceptUnderscoreInNumberLiterals = acceptUnderscoreInNumberLiterals; UseLuaJitIdentifierRules = useLuaJitIdentifierRules; AcceptBitwiseOperators = acceptBitwiseOperators; ContinueType = continueType; }
public void Merge(Builder other) { HasBinaryNumbers |= other.HasBinaryNumbers; HasCComments |= other.HasCComments; HasCompoundAssignments |= other.HasCompoundAssignments; HasEmptyStatements |= other.HasEmptyStatements; HasCBooleanOperators |= other.HasCBooleanOperators; HasGoto |= other.HasGoto; HasHexEscapesInStrings |= other.HasHexEscapesInStrings; HasHexFloatLiterals |= other.HasHexFloatLiterals; HasOctalNumbers |= other.HasOctalNumbers; HasShebang |= other.HasShebang; HasUnderscoreInNumericLiterals |= other.HasUnderscoreInNumericLiterals; HasLuajitIdentifiers |= other.HasLuajitIdentifiers; ContinueType |= other.ContinueType; }
public LogReader(string namedPipeName, string logName, ISession session, int stage, int vmTimeout) { debugLogFilename = logName; vmSession = session; stageNum = stage; timeOut = vmTimeout; _timedOut = true; stageCheckpoint = new String[3]; stageCheckpoint[0] = "It's the final countdown..."; stageCheckpoint[1] = "It's the final countdown..."; stageCheckpoint[2] = "SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE"; _result = ContinueType.EXIT_DONT_CONTINUE; _timeOutEvent = new AutoResetEvent(false); watchdog = new Timer(WatchdogCallback, _timeOutEvent, timeOut, Timeout.Infinite); // Connect to the named pipe of the VM to receive its debug info. pipe = new NamedPipeClientStream(".", namedPipeName, PipeDirection.InOut); }
public ContinueStatement(ContinueType continueType) {}
public ContinueStatement(ContinueType continueType) { }
/// <summary>Continues the current animation out of a current loop</summary> /// <param name="animation_index">Index of the animation to continue. Most the time this is 0</param> /// <param name="continueType">Denotes the action to be taken in order to continue the animation.</param> /// <param name="lerpSyncDuration"> The duration of the Instant continue lerp into the next state. Ignored if <paramref name="continueType"/> is set to EndOfLoop</param> /// <param name="passNextInfiniteLoop"> If muliple loops are currently active, then the next Infinite loop will be the loop that is continued</para> /// <param name="trimInterimLoops"> Any loop within the infinite loop that is being skipped, will be set to it's last iteration </param> /// <param name="animationSpeedOverride"> If continuing once all letters are at the end of the loop, this can be used to override the animation speed during this period. Default value is 1. </param> public void ContinuePastLoop(int animation_index, ContinueType continueType = ContinueType.EndOfLoop, float lerpSyncDuration = 0.5f, bool passNextInfiniteLoop = true, bool trimInterimLoops = true, float animationSpeedOverride = 1, System.Action<int> finishedCallback = null) { LetterAnimation animation = m_master_animations[animation_index]; int deepestLoopDepth = -1; ActionLoopCycle deepestLoopCycle = null; LetterSetup deepestLoopLetter = null; int furthestActionIndex = -1; int furthestActionIndexProgress = -1; int[] lowestActiveLoopIterations = new int[animation.ActionLoopCycles.Count]; bool allLettersHaveLoops = true; LetterSetup letter; foreach(int letter_idx in animation.m_letters_to_animate) { letter = m_letters[letter_idx]; if(furthestActionIndex == -1 || letter.ActionIndex > furthestActionIndex) furthestActionIndex = letter.ActionIndex; if(furthestActionIndexProgress == -1 || letter.ActionProgress > furthestActionIndexProgress) furthestActionIndexProgress = letter.ActionProgress; if(letter.ActiveLoopCycles.Count > 0) { // Record lowest active loop iteration counts for later syncing for(int loop_cycle_index = 0; loop_cycle_index < letter.ActiveLoopCycles.Count; loop_cycle_index++) { ActionLoopCycle loop_cycle = letter.ActiveLoopCycles[loop_cycle_index]; if(lowestActiveLoopIterations[loop_cycle.m_active_loop_index] == 0 || loop_cycle.m_number_of_loops < lowestActiveLoopIterations[loop_cycle.m_active_loop_index]) { lowestActiveLoopIterations[loop_cycle.m_active_loop_index] = loop_cycle.m_number_of_loops; } } } if(letter.ActiveLoopCycles.Count > 0 && (deepestLoopDepth == -1 || letter.ActiveLoopCycles.Count < deepestLoopDepth)) { // Record this new deepest loop cycle deepestLoopDepth = letter.ActiveLoopCycles.Count; deepestLoopCycle = letter.ActiveLoopCycles[0]; deepestLoopLetter = letter; } else if (letter.ActiveLoopCycles.Count == 0) allLettersHaveLoops = false; } int action_index_to_continue_to = -1; int action_progress = 0; if(deepestLoopCycle == null) { // These letters are not currently in any loops. Nothing to Continue Past return; } else { if(deepestLoopCycle.m_end_action_idx + 1 < animation.LetterActions.Count) { int offsetIdx = 1; while(animation.GetAction(deepestLoopCycle.m_end_action_idx + offsetIdx).m_action_type == ACTION_TYPE.BREAK) { if(deepestLoopCycle.m_end_action_idx + offsetIdx + 1 >= animation.LetterActions.Count) { break; } else offsetIdx++; } if(animation.GetAction(deepestLoopCycle.m_end_action_idx + offsetIdx).m_action_type != ACTION_TYPE.BREAK) { // There's a LetterAction defined beyond the end of this deepest loop. // Continue to the start of that letterAction action_index_to_continue_to = deepestLoopCycle.m_end_action_idx + offsetIdx; action_progress = 0; } } if(deepestLoopCycle.m_end_action_idx + 1 == animation.LetterActions.Count || action_index_to_continue_to == -1) { // This loop finishes with the last LetterAction, or it failed to find a non-break action beyond the end of the loop int start_action_index = (deepestLoopCycle.m_loop_type == LOOP_TYPE.LOOP || deepestLoopCycle.m_finish_at_end) ? deepestLoopCycle.m_end_action_idx : deepestLoopCycle.m_start_action_idx; int direction = (deepestLoopCycle.m_loop_type == LOOP_TYPE.LOOP || deepestLoopCycle.m_finish_at_end) ? -1 : 1; int idx = 0; while(start_action_index + (direction * idx) >= deepestLoopCycle.m_start_action_idx && start_action_index + (direction * idx) <= deepestLoopCycle.m_end_action_idx && animation.GetAction(start_action_index + (direction * idx)).m_action_type == ACTION_TYPE.BREAK) { idx++; } if(start_action_index + (direction * idx) >= deepestLoopCycle.m_start_action_idx && start_action_index + (direction * idx) <= deepestLoopCycle.m_end_action_idx) { action_index_to_continue_to = start_action_index + (direction * idx); action_progress = (deepestLoopCycle.m_loop_type == LOOP_TYPE.LOOP || deepestLoopCycle.m_finish_at_end) ? 1 : 0; } } if(!allLettersHaveLoops && furthestActionIndex > ((deepestLoopCycle.m_loop_type == LOOP_TYPE.LOOP || deepestLoopCycle.m_finish_at_end) ? deepestLoopCycle.m_end_action_idx : deepestLoopCycle.m_start_action_idx)) { // Some letters are without loops and are beyond the letters with loops action_index_to_continue_to = furthestActionIndex; action_progress = 1; deepestLoopDepth = 0; } else { // Remove any loops that have been passed by stepping through to find an appropriate action to continue to for(int loop_idx = 1; loop_idx < deepestLoopLetter.ActiveLoopCycles.Count; loop_idx++) { if(action_index_to_continue_to > deepestLoopLetter.ActiveLoopCycles[loop_idx].m_end_action_idx) { // remove this loop cycle too deepestLoopDepth --; } } } if(passNextInfiniteLoop)// && deepestLoopCycle.m_number_of_loops > 0 && deepestLoopDepth > 1) { bool infiniteLoopAlreadyPassed = false; // Check if already passed an infinite loop for(int loopDepth = 0; loopDepth < (deepestLoopLetter.ActiveLoopCycles.Count - deepestLoopDepth) + 1; loopDepth ++) { if(deepestLoopLetter.ActiveLoopCycles[loopDepth].m_number_of_loops <= 0) { infiniteLoopAlreadyPassed = true; break; } } if(!infiniteLoopAlreadyPassed) { // Supposed to be exiting the next infinite loop, but deepest active loop found isn't infinite // Search for deeper infinite active loop for(int loopDepth = m_letters[0].ActiveLoopCycles.Count - deepestLoopDepth; loopDepth < m_letters[0].ActiveLoopCycles.Count; loopDepth++) { if(m_letters[0].ActiveLoopCycles[loopDepth].m_number_of_loops <= 0) { // Found an infinite loop deeper in the active loops list // Set as new deepestLoop deepestLoopCycle = m_letters[0].ActiveLoopCycles[loopDepth]; deepestLoopDepth -= (loopDepth - (m_letters[0].ActiveLoopCycles.Count - deepestLoopDepth)); deepestLoopLetter = m_letters[0]; } } } } } // Debug.Log("action_index_to_continue_to : " +action_index_to_continue_to + ", action_progress : " + action_progress + ", furthestActionIndexProgress : " + furthestActionIndexProgress + ", deepestLoopDepth : "+ deepestLoopDepth); // Setup each letter to continue foreach(int letter_idx in animation.m_letters_to_animate) { letter = m_letters[letter_idx]; // lerpSyncDuration = 0f; letter.ContinueFromCurrentToAction(animation, action_index_to_continue_to, action_progress == 0, deepestLoopCycle == null ? action_index_to_continue_to : deepestLoopCycle.m_end_action_idx + 1, m_animate_per, m_animation_timer, lerpSyncDuration, furthestActionIndexProgress, deepestLoopDepth, continueType, trimInterimLoops, lowestActiveLoopIterations); } // Set animation speed override if(continueType == ContinueType.EndOfLoop) m_runtime_animation_speed_factor = animationSpeedOverride; if(finishedCallback != null) m_animation_continue_callback = finishedCallback; // Set state to CONTINUING animation.CurrentAnimationState = LETTER_ANIMATION_STATE.CONTINUING; }
/// <summary>Continues the current animation out of a current loop</summary> /// <param name="continueType">Denotes the action to be taken in order to continue the animation.</param> /// <param name="lerpSyncDuration"> The duration of the Instant continue lerp into the next state. Ignored if <paramref name="continueType"/> is set to EndOfLoop</param> /// <param name="passNextInfiniteLoop"> If muliple loops are currently active, then the next Infinite loop will be the loop that is continued</para> /// <param name="trimInterimLoops"> Any loop within the infinite loop that is being skipped, will be set to it's last iteration </param> /// <param name="animationSpeedOverride"> If continuing once all letters are at the end of the loop, this can be used to override the animation speed during this period. Default value is 1. </param> public void ContinuePastLoop(ContinueType continueType = ContinueType.EndOfLoop, float lerpSyncDuration = 0.5f, bool passNextInfiniteLoop = true, bool trimInterimLoops = true, float animationSpeedOverride = 1, System.Action<int> finishedCallback = null) { ContinuePastLoop (0, continueType, lerpSyncDuration, passNextInfiniteLoop, trimInterimLoops, animationSpeedOverride, finishedCallback); }
public void RunTests() { ContinueType ret = ContinueType.EXIT_DONT_CONTINUE; IProgress vmProgress; // TODO: Load settings /* Open the testing machine */ Session vmSession = new Session(); try { rosVM = vBox.FindMachine(machineName); } catch (COMException exc) { /* Opening failed. Probably we need to create it */ Console.WriteLine("Opening the vm failed: " + exc); rosVM = CreateVm(); } rosVM.LockMachine(vmSession, LockType.LockType_Write); /* Configure the virtual machine */ ConfigVm(vmSession); /* Empty or create the HDD, prepare for the first run */ EmptyHardDisk(vmSession); /* Close VM session */ vmSession.UnlockMachine(); /* Empty the debug log file */ if (logName != null) { EmptyDebugLog(); } /* Start main testing loop */ for (int stage = 0; stage < numStages; stage++) { int retries; for (retries = 0; retries < maxRetries; retries++) { /* Start the VM */ try { vmProgress = rosVM.LaunchVMProcess(vmSession, "gui", null); vmProgress.WaitForCompletion(-1); if (vmProgress.ResultCode != 0) { /* Print out error's text */ Console.WriteLine("Error starting VM: " + vmProgress.ErrorInfo.Text); /* Close VM session */ if (vmSession.State == SessionState.SessionState_Locked) { vmSession.UnlockMachine(); } break; } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("[SYSREG] Running stage {0}...", stage + 1); Console.WriteLine("[SYSREG] Domain {0} started.\n", rosVM.Name); ret = ProcessDebugOutput(vmSession, stage); /* Kill the VM if it's not already powered off */ if (vmSession.State != SessionState.SessionState_Unlocked && rosVM.State >= MachineState.MachineState_FirstOnline && rosVM.State <= MachineState.MachineState_LastOnline) { #if TRACE Console.WriteLine("[SYSREG] Killing VM (state " + rosVM.State.ToString() + ")"); #endif try { vmProgress = vmSession.Console.PowerDown(); vmProgress.WaitForCompletion(-1); } catch (System.Runtime.InteropServices.COMException comEx) { Console.WriteLine("[SYSREG] Failed to shutdown VM: " + comEx.ToString()); if (rosVM.State != MachineState.MachineState_PoweredOff) { throw; } } } try { /* Close the VM session without paying attention to any problems */ if (vmSession.State == SessionState.SessionState_Locked) { vmSession.UnlockMachine(); /* Wait till the machine state is actually closed (no vmProgress alas) */ int waitingTimeout = 0; while (vmSession.State != SessionState.SessionState_Unlocked || waitingTimeout < 5) { Thread.Sleep(1000); waitingTimeout++; } } } catch { } /* If we have a checkpoint to reach for success, assume that * the application used for running the tests (probably "rosautotest") * continues with the next test after a VM restart. */ if (stage == 2 && ret == ContinueType.EXIT_CONTINUE) { Console.WriteLine("[SYSREG] Rebooting VM (retry {0})", retries + 1); } else { /* Empty the debug log file */ if (logName != null) { EmptyDebugLog(); } break; } } catch (Exception exc) { Console.WriteLine("[SYSREG] Running the VM failed with exception: " + exc); //break; } } /* Check for a maximum number of retries */ if (retries >= maxRetries) { Console.WriteLine("[SYSREG] Maximum number of allowed retries exceeded, aborting!"); break; } /* Stop executing if asked so */ if (ret == ContinueType.EXIT_DONT_CONTINUE) { break; } } switch (ret) { case ContinueType.EXIT_CHECKPOINT_REACHED: Console.WriteLine("[SYSREG] Status: Reached the checkpoint!"); Environment.ExitCode = 0; break; case ContinueType.EXIT_CONTINUE: Console.WriteLine("[SYSREG] Status: Failed to reach the checkpoint!!"); break; case ContinueType.EXIT_DONT_CONTINUE: Console.WriteLine("[SYSREG] Status: Testing process aborted!"); break; } }
public ContinueStatement(ContinueType continueType) { this.continueType = continueType; }
void DrawEffectEditorPanel() { float gui_x_offset = 10; float gui_y_offset = WINDOW_BORDER_TOP; m_playbackButtonsScrollPosition = GUI.BeginScrollView (new Rect (0, 0, Instance.position.width - COPY_PASTE_SECTION_WIDTH, PLAYBACK_SECTION_HEIGHT), m_playbackButtonsScrollPosition, new Rect (0, 0, m_playbackButtonsAreaWidth, 40)); // if(GUI.Button(new Rect(gui_x_offset, gui_y_offset, PLAYBACK_BUTTONS_WIDTH, PLAYBACK_BUTTONS_HEIGHT), new GUIContent(!m_previewing_anim || m_paused ? "Play" : "Pause", (!m_previewing_anim || m_paused ? "Play" : "Pause") + " this animation sequence."))) if(GUI.Button(new Rect(gui_x_offset, gui_y_offset, 40, PLAYBACK_BUTTONS_HEIGHT), !m_previewing_anim || m_paused ? m_play_button_texture : m_pause_button_texture)) { if(m_previewing_anim) { PauseEditorAnimation(); } else { PlayEditorAnimation(); } } gui_x_offset += PLAYBACK_BUTTONS_WIDTH + 10; if(GUI.Button(new Rect(gui_x_offset, gui_y_offset, PLAYBACK_BUTTONS_WIDTH, PLAYBACK_BUTTONS_HEIGHT), m_reset_button_texture)) { if(m_textfx_animation_interface == null) return; m_paused = false; m_previewing_anim = false; m_animation_manager.ResetAnimation(); m_textfx_animation_interface.UpdateTextFxMesh(m_animation_manager.MeshVerts, m_animation_manager.MeshColours); SceneView.RepaintAll(); } gui_x_offset = (PLAYBACK_BUTTONS_WIDTH * 3); if(m_animation_manager.Playing) { // Draw divider line TextFxHelperMethods.DrawGUILine(new Rect(PLAYBACK_BUTTONS_WIDTH * 3 - 10, WINDOW_BORDER_TOP, 0, PLAYBACK_BUTTONS_HEIGHT), Color.gray, 3); m_playbackButtonsAreaWidth = PLAYBACK_BUTTONS_WIDTH * 2 + 20; // Continue Past Break Button if(GUI.Button(new Rect(gui_x_offset, gui_y_offset, PLAYBACK_BUTTONS_WIDTH, PLAYBACK_BUTTONS_HEIGHT), m_continue_button_texture)) { m_animation_manager.ContinuePastBreak(m_editor_continue_animation_index); // Debug.Log("Editor ContinuePastBreak"); } gui_x_offset += PLAYBACK_BUTTONS_WIDTH + 10; // Continue Past Loop Button if(GUI.Button(new Rect(gui_x_offset, gui_y_offset, PLAYBACK_BUTTONS_WIDTH, PLAYBACK_BUTTONS_HEIGHT), m_continue_past_loop_button_texture)) { m_animation_manager.ContinuePastLoop(m_editor_continue_animation_index, m_editor_continue_type, m_editor_continue_lerp_duration, m_editor_continue_pass_next_infinite_loop, m_editor_continue_shorten_interim_loops, m_editor_continue_anim_speed_override); // Debug.Log("Editor ContinuePastLoop"); // PauseEditorAnimation(); } gui_x_offset += PLAYBACK_BUTTONS_WIDTH + 10; m_playbackButtonsAreaWidth += PLAYBACK_BUTTONS_WIDTH + 10; } else m_playbackButtonsAreaWidth = PLAYBACK_BUTTONS_WIDTH * 2 + 20; #if ANIM_DESIGN_DEV_TOOLS // TODO: Display this info in a sensible non-cluttered/confusing way. gui_x_offset += 10; string[] anim_idx_select_array = new string[m_animation_manager.m_master_animations.Count]; for(int anim_idx=0; anim_idx < anim_idx_select_array.Length; anim_idx++) anim_idx_select_array[anim_idx] = "" + anim_idx; EditorGUI.LabelField (new Rect (gui_x_offset, WINDOW_BORDER_TOP - 5, 40, LINE_HEIGHT), "Anim"); m_editor_continue_animation_index = EditorGUI.Popup (new Rect (gui_x_offset + 45, WINDOW_BORDER_TOP - 5, 35, LINE_HEIGHT), m_editor_continue_animation_index, anim_idx_select_array); if(m_editor_continue_type == ContinueType.None) m_editor_continue_type = ContinueType.EndOfLoop; m_editor_continue_type = (ContinueType) (1 + EditorGUI.Popup (new Rect (gui_x_offset + 90, WINDOW_BORDER_TOP - 5, 80, LINE_HEIGHT), ((int) m_editor_continue_type) - 1, new string[]{"Instant", "End Of Loop"})); EditorGUI.LabelField (new Rect (gui_x_offset, WINDOW_BORDER_TOP + 12, 70, LINE_HEIGHT), "Exit Infinite"); m_editor_continue_pass_next_infinite_loop = EditorGUI.Toggle (new Rect (gui_x_offset + 74, WINDOW_BORDER_TOP + 12, 20, LINE_HEIGHT), m_editor_continue_pass_next_infinite_loop); if(m_editor_continue_type == ContinueType.Instant) { EditorGUI.LabelField (new Rect (gui_x_offset, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 60, LINE_HEIGHT), "Lerp Time"); m_editor_continue_lerp_duration = EditorGUI.FloatField (new Rect (gui_x_offset + 65, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 30, 15), m_editor_continue_lerp_duration); } else if(m_editor_continue_type == ContinueType.EndOfLoop) { EditorGUI.LabelField (new Rect (gui_x_offset, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 74, LINE_HEIGHT), "Anim Speed"); m_editor_continue_anim_speed_override = EditorGUI.FloatField (new Rect (gui_x_offset + 75, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 20, 15), m_editor_continue_anim_speed_override); EditorGUI.LabelField (new Rect (gui_x_offset + 100, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 70, LINE_HEIGHT), "Trim Loops"); m_editor_continue_shorten_interim_loops = EditorGUI.Toggle (new Rect (gui_x_offset + 175, WINDOW_BORDER_TOP + LINE_HEIGHT + 8, 20, 15), m_editor_continue_shorten_interim_loops); } #endif GUI.EndScrollView (); // Draw copy/paste section divider line TextFxHelperMethods.DrawGUILine(new Rect(Instance.position.width - COPY_PASTE_SECTION_WIDTH + 5, 2, 0, PLAYBACK_BUTTONS_HEIGHT + 20), Color.gray, 3); GUIStyle style = new GUIStyle(EditorStyles.miniButton); style.fontSize = 10; // COPY_PASTE_SECTION_WIDTH gui_x_offset = Instance.position.width - COPY_PASTE_SECTION_WIDTH + 13; // if(GUI.Button(new Rect(gui_x_offset, 3, 70, 20), new GUIContent("Copy [S]", "Soft Copy this TextEffect animation configuration, not including any Text settings."), style)) // { // string json_data = m_animation_manager.ExportData(); // EditorGUIUtility.systemCopyBuffer = json_data; // EditorPrefs.SetString("EffectExport", json_data); // Debug.Log("Soft Copied " + m_textfx_animation_interface.GameObject.name); // } if(GUI.Button(new Rect(gui_x_offset, WINDOW_BORDER_TOP, 40, 40), m_copy_button_texture)) { string json_data = m_animation_manager.ExportData(hard_copy: true); EditorGUIUtility.systemCopyBuffer = json_data; EditorPrefs.SetString("EffectExport", json_data); Debug.Log("Hard Copied " + m_textfx_animation_interface.GameObject.name); } if(GUI.Button(new Rect(gui_x_offset + 45, WINDOW_BORDER_TOP, 40, 40), m_paste_button_texture)) { if(EditorPrefs.HasKey("EffectExport")) { m_animation_manager.ImportData(EditorPrefs.GetString("EffectExport"), true); Debug.Log("Pasted onto " + m_textfx_animation_interface.GameObject.name); } } // if(GUI.Button(new Rect(gui_x_offset + 90, WINDOW_BORDER_TOP, 40, 40), m_save_button_texture)) // { // // SAVE animations data to a txt file // string json_data = m_animation_manager.ExportData(hard_copy: true); // // m_animation_manager.m_effect_name = TextFxHelperMethods.SaveEffect(m_animation_manager.m_effect_name, json_data); // // EditorToolsHelper.RewriteImportEffectNames(); // // AssetDatabase.Refresh(); // // LoadInPresetAnimationNames(); // // GUI.FocusControl(""); // } // Draw Playback button section divider TextFxHelperMethods.DrawGUILine(new Rect(0, PLAYBACK_SECTION_HEIGHT - 3, Instance.position.width, 0), Color.gray, 5); gui_y_offset += 55; m_editor_section_idx = GUI.Toolbar(new Rect(0, gui_y_offset, Instance.position.width, LINE_HEIGHT), m_editor_section_idx, new string[]{"Quick Setup", "Full Editor"}); //, EditorStyles.toolbarButton); if(GUI.changed) return; gui_y_offset += 25; ignore_gui_change = false; noticed_gui_change = false; edited_action_idx = -1; m_edited_data = ANIMATION_DATA_TYPE.NONE; if(m_editor_section_idx == 0) { DrawQuickSetupPanel(gui_y_offset); } else { DrawFullEditorPanel(gui_y_offset); } }
public void Run() { try { using (StreamReader sr = new StreamReader(pipe)) using (TextWriter debugLogWriter = (debugLogFilename != null) ? new StreamWriter(debugLogFilename, false) : null) { pipe.Connect(3000); string line, cacheLine = ""; int kdbgHit = 0, cacheHits = 0; bool quitLoop = false; bool kdserial = false; while (!quitLoop) { /* Read up to 512 chars */ StringBuilder buffer = new StringBuilder(512); int index = 0, read; while ((read = sr.Read()) != -1) { buffer.Append((char)read); /* Break on newlines or in case of KDBG messages (which aren't terminated by newlines) */ if (read == (int)'\n') { break; } if (buffer.ToString().Contains(KDBPROMPT) || buffer.ToString().Contains(KDBBTCONT) || buffer.ToString().Contains(KDBASSERT)) { break; } index++; if (index >= buffer.Capacity) { break; } } line = buffer.ToString(); { /* Reset the watchdog timer */ watchdog.Change(timeOut, Timeout.Infinite); Console.Write(line); if (debugLogWriter != null) { debugLogWriter.Write(line); } /* Detect whether the same line appears over and over again. * If that is the case, cancel this test after a specified number of repetitions. */ if (line == cacheLine) { cacheHits++; if (cacheHits > RegTester.maxCacheHits) { Console.WriteLine("[SYSREG] Test seems to be stuck in an endless loop, canceled!\n"); _result = ContinueType.EXIT_CONTINUE; quitLoop = true; break; } } else { cacheHits = 0; cacheLine = line; } /* Check for magic sequences */ if (line.Contains("KDSERIAL")) { #if TRACE Console.WriteLine("[SYSREG] Switching to kdserial mode"); #endif kdserial = true; continue; } if (line.Contains(KDBPROMPT)) { #if TRACE Console.Write("-[TRACE] kdb prompt hit-"); #endif kdbgHit++; if (kdbgHit == 1) { /* It happened for the first time, backtrace */ if (kdserial) { char[] bt = { 'b', 't', '\r' }; foreach (char c in bt) { pipe.WriteByte((byte)c); } } else { vmSession.Console.Keyboard.PutScancode(0x30); // b make vmSession.Console.Keyboard.PutScancode(0xb0); // b release vmSession.Console.Keyboard.PutScancode(0x14); // t make vmSession.Console.Keyboard.PutScancode(0x94); // t release vmSession.Console.Keyboard.PutScancode(0x1c); // Enter make vmSession.Console.Keyboard.PutScancode(0x9c); // Enter release } continue; } else { /* It happened once again, no reason to continue */ Console.WriteLine(); _result = ContinueType.EXIT_CONTINUE; quitLoop = true; break; } } else if (line.Contains(KDBBTCONT)) { /* Send Return to get more data from Kdbg */ if (kdserial) { pipe.WriteByte((byte)'\r'); } else { vmSession.Console.Keyboard.PutScancode(0x1c); // Enter make vmSession.Console.Keyboard.PutScancode(0x9c); // Enter release } continue; } else if (line.Contains(KDBASSERT)) { /* Break once */ if (kdserial) { pipe.WriteByte((byte)'o'); } else { vmSession.Console.Keyboard.PutScancode(0x18); // 'O' make vmSession.Console.Keyboard.PutScancode(0x98); // 'O' release } } else if (line.Contains("SYSREG_ROSAUTOTEST_FAILURE")) { quitLoop = true; break; } else if (line.Contains(stageCheckpoint[stageNum])) { _result = ContinueType.EXIT_CHECKPOINT_REACHED; quitLoop = true; break; } } } } } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("Exception occured in the LogReader.Run():"); Console.WriteLine(e.Message); } finally { pipe.Close(); Thread.Sleep(1000); } // Signal that we're done and it's not a timed out state _timedOut = false; _timeOutEvent.Set(); }