internal void OpenFile(string file) { if (!File.Exists(file)) { MessageBox.Show("File '" + file + "' not found. Sad Trombone."); return; } if (file.EndsWith(".shrp")) { OpenProject(file); } else { var content = File.ReadAllText(file); var tabName = Path.GetFileName(file); editorTabs.TabPages.Add(new TabPage(DocumentManager.AddDocument(tabName, file, content))); _suppressTabChanged = true; editorTabs.SelectedIndex = editorTabs.TabPages.Count - 1; saveStateTimer.Enabled = true; } editor.Focus(); }
private void MainForm_Load(object sender, EventArgs e) { Text += " interpreter version " + Interpreter.Version; CurrentForm = this; DocumentManager.Editor = editor; Interpreter.Output = s => { SafeWrite(s); }; Interpreter.LoadModule = (m, s) => { if (s.ToLower() == "shiro-project") { ShiroProject.Libs = new List <string>(); if (!Shiro.IsFunctionName("sh-project")) { new ShiroProject().RegisterAutoFunctions(Shiro); } } else { return(Interpreter.DefaultModuleLoader(m, s)); } return(true); }; cleanMenu_Click(null, null); txtInput.Hide(); SetupScintilla(); SafeWrite("Your output will go here. Shiro Version: " + Interpreter.Version + Environment.NewLine + Environment.NewLine); Show(); if (Program.ThingToOpen != null) { OpenFile(Program.ThingToOpen); } else { editorTabs.TabPages.Add("new"); DocumentManager.AddDocument("new"); } editor.Focus(); }
private void newMenu_Click(object sender, EventArgs e) { editorTabs.TabPages.Add(new TabPage(DocumentManager.AddDocument("new"))); _suppressTabChanged = true; editorTabs.SelectedIndex = editorTabs.TabPages.Count - 1; }