private void ShowScript(string script, string title) { var viewer = new ScriptViewer { TextScript = { Text = script }, Title = title }; viewer.Show(); }
private void bScriptExplorer_Click(object sender, EventArgs e) { if (m_ScriptExplorer == null) { m_ScriptExplorer = new ScriptViewer(); if (m_ScriptExplorer.GetFolderInfo()) { m_ScriptExplorer.Closed += m_ScriptExplorer_Closed; m_ScriptExplorer.Show(); } else { m_ScriptExplorer.Dispose(); m_ScriptExplorer = null; } } else { m_ScriptExplorer.BringToFront(); } }
private void fsv_OnNewWindow(object sender, ScriptViewer.svEventsArgs e) { //MessageBox.Show("new window"); }
// // Called when the verify output listview has an item activated. The // item text is parsed to discern whenther the message activated was a // compiler message; if so, an editor window is opened up to the script // namd in the message. // private void OnVerifyOutputListViewItemActivated(object sender, EventArgs e) { ListView OutputListView = (ListView)sender; foreach (object Item in OutputListView.SelectedItems) { INWN2Viewer Viewer; NWN2ScriptViewer ScriptViewer; NWN2GameScript Script; IResourceEntry ResEntry; ListViewItem LvItem = (ListViewItem)Item; string ItemText = LvItem.Text; string ResName; string LineString; string MsgString; int Line; int i; // // Try and parse out the file name and line number of the error // message, if it appears to be a compiler error. // // script1.nss(5): Warning: Usage of switch blocks inside of do/while scopes generates incorrect code with the standard compiler; consider avoiding the use of do/while constructs to ensure correct code generation with the standard compiler i = ItemText.IndexOf('.'); if (i == -1) { continue; } ResName = ItemText.Substring(0, i); LineString = ItemText.Substring(i + 1).ToLower(); if (!LineString.StartsWith("nss(")) { continue; } i = LineString.IndexOf(')', 4); if (i < 5) { continue; } MsgString = LineString.Substring(i + 1); if (!MsgString.StartsWith(": error: ") && !MsgString.StartsWith(": warning: ")) { continue; } try { Line = Convert.ToInt32(LineString.Substring(4, i - 4)); } catch { continue; } // // Look up the resource in the resource system. // ResEntry = ResourceManager.Instance.GetEntry( new OEIResRef(ResName), (ushort)ResTypes.ResNSS); if (ResEntry is MissingResourceEntry) { continue; } // // Find the toolset data item for the script in question. // Script = null; try { Viewer = NWN2ToolsetMainForm.App.GetViewerForResource( ResEntry.FullName); if (Viewer != null) { Script = (NWN2GameScript)Viewer.ViewedResource; } if (Script == null) { Script = NWN2ToolsetMainForm.App.Module.Scripts[ResName]; if (Script == null) { NWN2Campaign Campaign = NWN2CampaignManager.Instance.ActiveCampaign; if (Campaign != null) { Script = Campaign.Scripts[ResName]; } } if (Script == null) { Script = new NWN2GameScript(ResEntry); } } } catch { Script = null; } if (Script == null) { continue; } // // If a viewer isn't open for the script yet, then open one // now. // Viewer = NWN2ToolsetMainForm.App.GetViewerForResource(Script); if (Viewer == null) { NWN2ToolsetMainForm.App.ShowResource(Script); Viewer = NWN2ToolsetMainForm.App.GetViewerForResource(Script); if (Viewer == null) { continue; } } else { // // Bring the viewer to the front. // NWN2ToolsetMainForm.App.ShowResource(Script); } if (!(Viewer is NWN2ScriptViewer)) { continue; } ScriptViewer = (NWN2ScriptViewer)Viewer; // // Highlight the error line. // ScriptViewer.HighlightLine(Line); } }
private void m_ScriptExplorer_Closed(object sender, EventArgs e) { m_ScriptExplorer.Dispose(); m_ScriptExplorer = null; }
private void scriptViewer_btn_Click(object sender, EventArgs e) { DatDigger.Sections.Script.LuaFile lf = new DatDigger.Sections.Script.LuaFile(); lf.LoadFile(new BinaryReaderEx(File.OpenRead((string)charaSelector.SelectedNode.Tag))); if (lf == null) { Trace.TraceInformation("Not a valid LUA file."); return; } ScriptViewer sv = new ScriptViewer(lf); sv.Show(); }