private void buttonRun_Click(object sender, EventArgs e) { // Clear all info _dirsToScan = new List <string>(); _scenesToProcess = new List <string>(); _dirsScanned = 0; _dirsFound = 1; _dirsToScan.Add(SelectedPath); _scenesFound = 0; _scenesProcessed = 0; State = State_e.Running; // Scan for all scene files with a BackgroundWorker EditorManager.Progress.Percentage = 0; EditorManager.Progress.IsAbortable = true; EditorManager.Progress.ProgressDialogEnabled = false; EditorManager.Progress.StatusString = "Scanning for scene files..."; _worker = new BackgroundWorker(); _worker.WorkerReportsProgress = true; _worker.DoWork += new DoWorkEventHandler(this.on_DoDirScan); _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.on_DirScanCompleted); _worker.ProgressChanged += new ProgressChangedEventHandler(this.on_DirScanProgress); _worker.RunWorkerAsync(); // ... Continued in on_DirScanCompleted }
// public void AddLine(string line) { if (line == "") { return; } this.rows.Add(line); int st = isClassStart(line); if (st > 0) { if (st == 2) { _title = rows[rows.Count - 3] + "\n" + rows[rows.Count - 2]; // } else { _title = rows[rows.Count - 2]; } //从前一行中,处理声明? _stat = State_e.State_Begin; } else if (isClassEnd(line)) { setEnd();// _stat = State_e.State_End; } else if (_stat == State_e.State_Begin) { if (line.StartsWith(" ")) { line = line.Substring(4); //先去掉 handleLine(line); } else { LogError("未识别的行 " + line); } } else { //private FaeriaButtonDock craftModeButton; if (line.StartsWith("public ") || line.StartsWith("private ") || line.StartsWith("protected ")) { Match m = rgx_memb_dec.Match(line); if (m != null && m.Success) { Log("找到一个成员: " + line); string dec = m.Groups[1].ToString(); string ret = m.Groups[2].ToString(); string func = m.Groups[3].ToString(); if (!string.IsNullOrEmpty(ret) && !string.IsNullOrEmpty(func)) { setEnd(); } } } // LogError("未识别的行 " + line); } }
public override bool SeekExact(BytesRef text) { Debug.Assert(text.IsValid()); if (base.SeekExact(text)) { State = State_e.POSITIONED; return(true); } else { State = State_e.UNPOSITIONED; return(false); } }
public override SeekStatus SeekCeil(BytesRef term) { Debug.Assert(term.IsValid()); SeekStatus result = base.SeekCeil(term); if (result == SeekStatus.END) { State = State_e.UNPOSITIONED; } else { State = State_e.POSITIONED; } return(result); }
// TODO: we should separately track if we are 'at the end' ? // someone should not call next() after it returns null!!!! public override BytesRef Next() { Debug.Assert(State == State_e.INITIAL || State == State_e.POSITIONED, "next() called on unpositioned TermsEnum"); BytesRef result = base.Next(); if (result == null) { State = State_e.UNPOSITIONED; } else { Debug.Assert(result.IsValid()); State = State_e.POSITIONED; } return(result); }
private void buttonCancel_Click(object sender, EventArgs e) { // If we have a canceable subprocess running, notify it if (EditorManager.Progress.IsAbortable) { EditorManager.Progress.WantsAbort = true; } // If we're doing something, set to cancelling, otherwise close immediately if (_state != State_e.None) { State = State_e.Cancelling; } else { this.Close(); } }
private void on_DirScanCompleted(object sender, RunWorkerCompletedEventArgs e) { _worker.DoWork -= new DoWorkEventHandler(this.on_DoDirScan); _worker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(this.on_DirScanCompleted); _worker.ProgressChanged -= new ProgressChangedEventHandler(this.on_DirScanProgress); textBoxLog.Text = ""; EditorManager.Progress.HideProgressDialog(); EditorManager.Progress.Reset(); // Aborted? if (_dirsScanned != _dirsFound) { State = State_e.None; return; } _scenesFound = _scenesToProcess.Count; DoExport(); }
public override void SeekExact(long ord) { base.SeekExact(ord); State = State_e.POSITIONED; }
public override void SeekExact(BytesRef term, TermState state) { Debug.Assert(term.Valid); base.SeekExact(term, state); this.State = State_e.POSITIONED; }
public override bool SeekExact(BytesRef text) { Debug.Assert(text.Valid); if (base.SeekExact(text)) { State = State_e.POSITIONED; return true; } else { State = State_e.UNPOSITIONED; return false; } }
public override SeekStatus SeekCeil(BytesRef term) { Debug.Assert(term.Valid); SeekStatus result = base.SeekCeil(term); if (result == SeekStatus.END) { State = State_e.UNPOSITIONED; } else { State = State_e.POSITIONED; } return result; }
public void setEnd() { _stat = State_e.State_End; }
/// <summary> /// Exports all found scene files /// </summary> private void DoExport() { // Enter the testing mode (since we don't want any user dialogs etc.) TestManager.IsRunning = true; while (_scenesToProcess.Count > 0 && _state != State_e.Cancelling) { // Get one scene from the queue _currentScene = _scenesToProcess[0]; _scenesToProcess.RemoveAt(0); textBoxLog.Text += string.Format("Processing {0}: ", _currentScene); // Load the scene TestManager.Helpers.OpenSceneFromFile(_currentScene); TestManager.Helpers.ProcessEvents(); // Force the folder type to version controlled, since we didn't have a chance to when loading the scene EditorManager.Project.FolderType = IProject.FolderType_e.RCS; EditorManager.Project.UpdateRCSStatus(true); TestManager.Helpers.ProcessEvents(); // Actual export unless cancel has been clicked while loading if (_state != State_e.Cancelling) { // Check if the exported scene file name is correct string exportedSceneFile = Path.GetFileName(EditorManager.Scene.CurrentExportProfile.ExportPath); string defaultExportName = Path.GetFileName(Path.ChangeExtension(_currentScene, CSharpFramework.Scene.SceneExportProfile.FILE_EXTENSION_EXPORT)); bool showExportDialog = false; if (exportedSceneFile != defaultExportName) { textBoxLog.Text += string.Format("\r\nScene name mismatch: {0} instead of {1}: ", exportedSceneFile, defaultExportName); if (radioMismatch_Dialog.Checked) { showExportDialog = true; } else if (radioMismatch_Revert.Checked) { string subDir = Path.GetDirectoryName(EditorManager.Scene.CurrentExportProfile.ExportPath); EditorManager.Scene.CurrentExportProfile.ExportPath = Path.Combine(subDir, defaultExportName); textBoxLog.Text += string.Format("Reverted.\r\n"); } else { textBoxLog.Text += string.Format("Ignoring.\r\n"); } } // Always export all zones foreach (Zone zone in EditorManager.Scene.Zones) { zone.Export = true; } if (checkBoxMoveToCamera.Checked) { // TODO: Move camera to a sensible position } EditorManager.Progress.Percentage = 0; // Export the scene EditorManager.GUI.UIUpdateLock++; EditorManager.Scene.ExportScene(null, showExportDialog); EditorManager.GUI.UIUpdateLock--; if (showExportDialog) textBoxLog.Text += string.Format("Manually set to {0}.\r\n", Path.GetFileName(EditorManager.Scene.CurrentExportProfile.ExportPath)); textBoxLog.Text += string.Format("Export done. "); TestManager.Helpers.ProcessEvents(); // Resave scene if (checkBoxResaveScene.Checked) { EditorManager.Scene.Save(); textBoxLog.Text += string.Format("Scene file resaved. "); TestManager.Helpers.ProcessEvents(); } textBoxLog.Text += string.Format("\r\n"); } // Close the project TestManager.Helpers.CloseActiveProject(); TestManager.Helpers.ProcessEvents(); _scenesProcessed++; } if (State == State_e.Cancelling) { textBoxLog.Text += string.Format("\r\nAborted.\r\n"); } // Reset state _currentScene = null; State = State_e.None; EditorManager.Progress.StatusString = ""; EditorManager.Progress.Percentage = 0; EditorManager.Progress.ProgressDialogEnabled = true; // Go back to normal operation mode TestManager.IsRunning = false; }
private void buttonRun_Click(object sender, EventArgs e) { // Clear all info _dirsToScan = new List<string>(); _scenesToProcess = new List<string>(); _dirsScanned = 0; _dirsFound = 1; _dirsToScan.Add(SelectedPath); _scenesFound = 0; _scenesProcessed = 0; State = State_e.Running; // Scan for all scene files with a BackgroundWorker EditorManager.Progress.Percentage = 0; EditorManager.Progress.IsAbortable = true; EditorManager.Progress.ProgressDialogEnabled = false; EditorManager.Progress.StatusString = "Scanning for scene files..."; _worker = new BackgroundWorker(); _worker.WorkerReportsProgress = true; _worker.DoWork += new DoWorkEventHandler(this.on_DoDirScan); _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.on_DirScanCompleted); _worker.ProgressChanged += new ProgressChangedEventHandler(this.on_DirScanProgress); _worker.RunWorkerAsync(); // ... Continued in on_DirScanCompleted }
private void buttonCancel_Click(object sender, EventArgs e) { // If we have a canceable subprocess running, notify it if(EditorManager.Progress.IsAbortable) EditorManager.Progress.WantsAbort = true; // If we're doing something, set to cancelling, otherwise close immediately if (_state != State_e.None) { State = State_e.Cancelling; } else { this.Close(); } }
/// <summary> /// Exports all found scene files /// </summary> private void DoExport() { // Enter the testing mode (since we don't want any user dialogs etc.) TestManager.IsRunning = true; while (_scenesToProcess.Count > 0 && _state != State_e.Cancelling) { // Get one scene from the queue _currentScene = _scenesToProcess[0]; _scenesToProcess.RemoveAt(0); textBoxLog.Text += string.Format("Processing {0}: ", _currentScene); // Load the scene TestManager.Helpers.OpenSceneFromFile(_currentScene); TestManager.Helpers.ProcessEvents(); // Force the folder type to version controlled, since we didn't have a chance to when loading the scene EditorManager.Project.FolderType = IProject.FolderType_e.RCS; EditorManager.Project.UpdateRCSStatus(true); TestManager.Helpers.ProcessEvents(); // Actual export unless cancel has been clicked while loading if (_state != State_e.Cancelling) { // Check if the exported scene file name is correct string exportedSceneFile = Path.GetFileName(EditorManager.Scene.CurrentExportProfile.ExportPath); string defaultExportName = Path.GetFileName(Path.ChangeExtension(_currentScene, CSharpFramework.Scene.SceneExportProfile.FILE_EXTENSION_EXPORT)); bool showExportDialog = false; if (exportedSceneFile != defaultExportName) { textBoxLog.Text += string.Format("\r\nScene name mismatch: {0} instead of {1}: ", exportedSceneFile, defaultExportName); if (radioMismatch_Dialog.Checked) { showExportDialog = true; } else if (radioMismatch_Revert.Checked) { string subDir = Path.GetDirectoryName(EditorManager.Scene.CurrentExportProfile.ExportPath); EditorManager.Scene.CurrentExportProfile.ExportPath = Path.Combine(subDir, defaultExportName); textBoxLog.Text += string.Format("Reverted.\r\n"); } else { textBoxLog.Text += string.Format("Ignoring.\r\n"); } } EditorScene scene = EditorManager.Scene as EditorScene; if (showExportDialog) { // Open export dialog using (ExportDialog dlg = new ExportDialog()) { scene.CurrentExportProfile.ExportedLayersFromScene(); // retrieve current status dlg.Settings = scene.CurrentExportProfile; // clones the settings dlg.AutoSaveExportProfile = scene.Settings.AutoSaveExportProfile; // Show dialog if (dlg.ShowDialog() != DialogResult.OK) { continue; } // Get back settings scene.CurrentExportProfile = dlg.Settings; scene.Settings.ExportProfileName = scene.CurrentExportProfile.ProfileName; scene.Settings.AutoSaveExportProfile = dlg.AutoSaveExportProfile; } } // Always export all zones foreach (Zone zone in EditorManager.Scene.Zones) { zone.Export = true; } if (checkBoxMoveToCamera.Checked) { // TODO: Move camera to a sensible position } EditorManager.Progress.Percentage = 0; // Export all profiles List <string> assetProfiles = new List <string>(); foreach (IProfileManager.Profile profile in EditorManager.ProfileManager.GetProfiles()) { assetProfiles.Add(profile.ToString()); } // Export the scene EditorManager.GUI.UIUpdateLock++; EditorManager.Scene.ExportScene(null, assetProfiles); EditorManager.GUI.UIUpdateLock--; if (showExportDialog) { textBoxLog.Text += string.Format("Manually set to {0}.\r\n", Path.GetFileName(EditorManager.Scene.CurrentExportProfile.ExportPath)); } textBoxLog.Text += string.Format("Export done. "); TestManager.Helpers.ProcessEvents(); // Resave scene if (checkBoxResaveScene.Checked) { EditorManager.Scene.Save(); textBoxLog.Text += string.Format("Scene file resaved. "); TestManager.Helpers.ProcessEvents(); } textBoxLog.Text += string.Format("\r\n"); } // Close the project TestManager.Helpers.CloseActiveProject(); TestManager.Helpers.ProcessEvents(); _scenesProcessed++; } if (State == State_e.Cancelling) { textBoxLog.Text += string.Format("\r\nAborted.\r\n"); } // Reset state _currentScene = null; State = State_e.None; EditorManager.Progress.StatusString = ""; EditorManager.Progress.Percentage = 0; EditorManager.Progress.ProgressDialogEnabled = true; // Go back to normal operation mode TestManager.IsRunning = false; }
public override void SeekExact(BytesRef term, TermState state) { Debug.Assert(term.IsValid()); base.SeekExact(term, state); this.State = State_e.POSITIONED; }
// TODO: we should separately track if we are 'at the end' ? // someone should not call next() after it returns null!!!! public override BytesRef Next() { Debug.Assert(State == State_e.INITIAL || State == State_e.POSITIONED, "next() called on unpositioned TermsEnum"); BytesRef result = base.Next(); if (result == null) { State = State_e.UNPOSITIONED; } else { Debug.Assert(result.Valid); State = State_e.POSITIONED; } return result; }