public void Update() { //uEmuera.Logger.Info("MainWindow.Update"); if (console_ == null) { return; } if (console_.IsInitializing) { ShowProcess(); if (!dirty_) { return; } } else if (console_.IsInProcess) { CheckProcess(); if (wait_process && !EmueraThread.instance.IsSkipFlag) { return; } if (!dirty_) { return; } } else if (!dirty_) { return; } uEmuera.Logger.Info("MainWindow.Update Dirty"); dirty_ = false; GenericUtils.SetBackgroundColor(console_.bgColor); var console_count = console_.GetDisplayLinesCount(); if (console_count == 0) { //清空 GenericUtils.ClearText(); return; } bool need_update_flag = false; int prev = GenericUtils.GetTextMaxLineNo() - 1; int dis_lineno = prev; int index = 0; if (dis_lineno >= 0) { var cl = console_.GetDisplayLinesForuEmuera(console_count - 1); var con_lineno = cl.LineNo; var clindex = console_count - 1; //LineNo 匹配 if (con_lineno > dis_lineno) { clindex -= (con_lineno - dis_lineno); } else { dis_lineno = con_lineno; } var min_lineno = GenericUtils.GetTextMinLineNo(); while (dis_lineno >= min_lineno) { cl = console_.GetDisplayLinesForuEmuera(clindex); if (cl == null) { break; } var tl = GenericUtils.GetText(dis_lineno); if (cl == tl) { break; } clindex -= 1; dis_lineno -= 1; } if (prev > dis_lineno) { var remove = prev - dis_lineno; GenericUtils.RemoveTextCount(remove); need_update_flag = true; } index = clindex + 1; } while (index < console_count) { var line = console_.GetDisplayLinesForuEmuera(index); if (line != null) { GenericUtils.AddText(line, line.LineNo <= prev); } index += 1; } if (console_.IsWaitingEnterKey || console_.IsInProcess) { GenericUtils.SetLastButtonGeneration(-1); } else { GenericUtils.SetLastButtonGeneration(console_.LastButtonGeneration); } if (need_update_flag) { GenericUtils.TextUpdate(); } GenericUtils.ShowIsInProcess(false); last_process_tic = 0; }