public CodeEditingForm(string docname) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // Sets the L# language syntax document SyntaxDefinitionList list = new SyntaxDefinitionList(); if (!System.IO.File.Exists(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location) + "\\LSharp.syn")) { // create from Embedded Resource string embeddedName = String.Format("LSharp.Studio.Core.LSharp.syn"); var me = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream StreAm = me.GetManifestResourceStream(embeddedName); FileStream fs = new FileStream(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location) + "\\LSharp.syn", FileMode.Create); StreAm.CopyTo(fs); fs.Close(); StreAm.Close(); } System.Collections.Generic.List<SyntaxDefinition>l2 = list.GetSyntaxDefinitions(); l2.Add(new SyntaxDefinitionLoader().Load(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location) + "\\LSharp.syn")); Alsing.SourceCode.SyntaxDefinition def = l2[0]; syntaxDocument1.Parser.Init(def); Filename = LSharp.Studio.Core.Properties.Settings.Default.DefaultSaveLocation + "\\" + docname; }
public LanguageForm(SyntaxDefinitionList LangList) { InitializeComponent(); trvFileTypes.Nodes.Clear(); foreach (SyntaxDefinition syntax in LangList.GetSyntaxDefinitions()) { TreeNode tn = trvFileTypes.Nodes.Add(syntax.Name); tn.Tag = syntax; } trvFileTypes.SelectedNode = trvFileTypes.Nodes[0]; }