//Entry Point public Main(string path, bool openSession) { InitailzeDock(); InitializeComponent(); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Culture); PluginHelper.PluginsDirectory = Path.Combine(Application.StartupPath, "Plugins"); if (openSession == true) { this.Opensession(path); } else if (openSession == false) { if (path != string.Empty) { this.OpenFile(path, new object(), new EventArgs()); } else { if (string.IsNullOrEmpty(Settings.Default.File)) { Editor edit = new Editor(); edit.Text = "New" + num; num = num + 1; edit.Show(dockPanel, DockState.Document); } else { if (Settings.Default.OpenPreviousFile == true) OpenFile(Settings.Default.File, new object(), new EventArgs()); } } } try { ActiveEditor.codebox.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(codebox_TextChangedDelayed); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } ApplySkins(); }
private void fromRTFToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog o = new OpenFileDialog(); o.Filter = "RTF Files (*.rtf)|*.rtf"; o.ShowDialog(); if (o.FileName != "") { Editor edit = new Editor(); edit.codebox.Text = ConvertToText(File.ReadAllText(o.FileName)); edit.Name = o.FileName; edit.Text = Path.GetFileName(o.FileName); edit.Show(dockPanel, DockState.Document); } }
private void cloneDocumentToolStripMenuItem_Click(object sender, EventArgs e) { Editor edit = new Editor(); edit.codebox.SourceTextBox = ActiveEditor.codebox; edit.Name = ActiveEditor.Name; edit.Text = ActiveEditor.Text; edit.Show(dockPanel, DockState.Float); edit.DockHandler.FloatPane.DockTo(dockPanel.DockWindows[DockState.Document]); }
//Open's File public void OpenFile(string file, object sender, EventArgs e) { try { string ext = System.IO.Path.GetExtension(file); Editor edit = new Editor(); edit.Text = Path.GetFileName(file); edit.Name = file; edit.codebox.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(codebox_TextChangedDelayed); edit.Show(dockPanel, DockState.Document); if (ext == ".html" | ext == ".htm" | ext == ".xhtml" | ext == ".shtml"| ext == ".HTML" | ext == ".HTM") { mihtml_Click(sender, e); } else if (ext == ".php") { miphp_Click(sender, e); } //Javascript else if (ext == ".js"| ext == ".json") { mijs_Click(sender, e); } //ASP else if (ext == ".aspx" | ext == ".asp") { miasp_Click(sender, e); } //XML else if (ext == ".xml" | ext == ".XML") { mixml_Click(sender, e); } else if (ext == ".xsd") { mixml_Click(sender, e); } //Batch else if (ext == ".bat" | ext == ".cmd") { mibatch_Click(sender, e); } //SQL else if (ext == ".sql") { misql_Click(sender, e); } //CSS else if (ext == ".css") { micss_Click(sender, e); } else if (ext == ".as" | ext == ".AS") { mias_Click(sender, e); } else if (ext == ".py" | ext == ".PY" | ext == ".pyw") { mipython_Click(sender, e); } else if (ext == ".rb" | ext == ".ruby" | ext == ".rbw") { miruby_Click(sender, e); } else if (ext == ".lua" | ext == ".LUA") { luaToolStripMenuItem_Click(sender, e); } else if (ext == ".bas" | ext == ".BAS") { miqb_Click(sender, e); } else if (ext == ".vb" | ext == ".VB") { mivb_Click(sender, e); } else if (ext == ".cs" | ext == ".CS") { mics_Click(sender, e); } else if (ext == ".java" | ext == ".JAVA") { mijava_Click(sender, e); } else if (ext == ".cpp" | ext == ".h" | ext == ".cxx" | ext == ".hpp" | ext == ".hxx" | ext == ".cc") { micpp_Click(sender, e); } else if (ext == ".c" | ext == ".C") { micpp_Click(sender, e); } switch(Settings.Default.Encoding) { case "ANSI": edit.codebox.Text = File.ReadAllText(file, Encoding.Default); break; case "ASCII": edit.codebox.Text = File.ReadAllText(file, Encoding.ASCII); break; case "Unicode": edit.codebox.Text = File.ReadAllText(file, Encoding.Unicode); break; case "UTF7": edit.codebox.Text = File.ReadAllText(file, Encoding.UTF7); break; case "UTF32": edit.codebox.Text = File.ReadAllText(file, Encoding.UTF32); break; case "UnicodeBigEndian": edit.codebox.Text = File.ReadAllText(file, Encoding.BigEndianUnicode); break; case "UTF8": edit.codebox.Text = File.ReadAllText(file, Encoding.UTF8); break; //BOM case "UnicodeWithoutBOM": edit.codebox.Text = File.ReadAllText(file, UnicodeWithoutBOM); break; case "UnicodeBigEndianWithoutBOM": edit.codebox.Text = File.ReadAllText(file, UnicodeBigEndianWithoutBOM); break; case "UTF8WithoutBOM": edit.codebox.Text = File.ReadAllText(file, UTF8WithoutBOM); break; } edit.codebox.ClearUndo(); codebox_TextChangedDelayed(sender, new TextChangedEventArgs(edit.codebox.Range)); edit.codebox.OnSyntaxHighlight(new TextChangedEventArgs(edit.codebox.Range)); edit.codebox.IsChanged = false; AddRecentFile(file); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void OpenBinding_Click(object sender, EventArgs e) { OpenFileDialog o = new OpenFileDialog(); o.Filter = "All Files(*.*)|*.*|Text Files(*.txt)|*.txt|XML Files (*.xml)|*.xml|XML Schema Definition File(*.xsd)|*.xsd|Log File (*.log)|*.log|HTML Document (*.html),(*.xhtml),(*.shtml)|*.html;*.xhtml;*.shtml|ASP.NET File(*.asp),(*.aspx)|*.asp;*.aspx|PHP Document (*.php)|*.php|Cascading Style Sheet (*.css)|*.css|Javascript File (*.js)|*.js|QBasic File(*.bas)|*.bas|Visual Basic File (*.vb)|*.vb|Python File (*.py)|*.py|Ruby File(*.ruby)|*.ruby|Lua File(*.lua)|Flash Actionscript file(*.as)|*.as|C# Source File(*.cs)|*.cs|C Source File(*.c)|C++ Source File (*.cpp)|*.cpp|C++ Header File(*.h)|*.h"; o.Title = "Open Binding File"; o.ShowDialog(); if (!(string.IsNullOrEmpty(o.FileName))) { Editor edit = new Editor(); edit.Text = Path.GetFileName(o.FileName); edit.Name = o.FileName; edit.codebox.OpenBindingFile(o.FileName, Encoding.Default); edit.Show(dockPanel); } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { Editor edit = new Editor(); edit.Text = "New" + num; num = num + 1; edit.codebox.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(codebox_TextChangedDelayed); edit.Show(dockPanel, DockState.Document); }
private void Manager_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e) { Editor edit = new Editor(); edit.codebox.Text = e.Result; edit.Text = this.toolStripTextBox1.Text; edit.Name = "Editor"; edit.Show(dockPanel, DockState.Document); Stats.Text = "Ready"; }