private void menuItem4_Click(object sender, System.EventArgs e) { Template t = propertyGrid1.SelectedObject as Template; Languages.Language l = t.Compile(); advancedTextBox1.Buffer.Language = l; advancedTextBox2.Text = t.generated; }
public Languages.Language Install() { Languages.Language l = Compile(); if (!Directory.Exists("Plugins")) { Directory.CreateDirectory("Plugins"); } File.Copy(Name + ".dll", "Plugins/Plugin.Language." + Name + ".dll", true); return(l); }
void Start() { fromLanguage = DialogueManager.dialogueManager.fromLanguage; toLanguage = DialogueManager.dialogueManager.toLanguage; dialogueFileFrom = new DialogueFile(name, fromLanguage.ToString()); dialogueFileTo = new DialogueFile(name, toLanguage.ToString()); conversation = dialogueFileFrom.LoadConversation(); conversationToTranslate = dialogueFileTo.LoadConversation(); VerifyDialogueData(); }
private void copyLanguagToolStripMenuItem_Click(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } Languages.Language l = new Languages.Language(); l.name = lang.GlobalLang[n].name; l.Entries = new List <string>(); for (int i = 0; i < lang.GlobalLang[n].Entries.Count; i++) { l.Entries.Add(lang.GlobalLang[n].Entries[i]); } lang.GlobalLang.Add(l); RefreshList(); }
private void listBox1_DoubleClick(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } string name = lang.GlobalLang[n].name; string result = Microsoft.VisualBasic.Interaction.InputBox("Please enter new name", "ME3 Explorer", name, 0, 0); if (result != "") { Languages.Language l = lang.GlobalLang[n]; l.name = result; lang.GlobalLang[n] = l; RefreshList(); } }
/* Function: FindLanguageEntry * Returns the entry that contains the passed language, or null if there isn't one yet. */ protected MenuEntries.Language FindLanguageEntry(Languages.Language language) { if (rootClassMenu == null) { return(null); } // If the menu only had one language and it was condensed, the root class entry may have been replaced // by that language. else if (rootClassMenu is MenuEntries.Language) { MenuEntries.Language languageEntry = (MenuEntries.Language)rootClassMenu; if (languageEntry.WrappedLanguage == language) { return(languageEntry); } else { return(null); } } // The only other possibility is a container with a flat list of languages. else { foreach (var member in rootClassMenu.Members) { if (member is MenuEntries.Language) { MenuEntries.Language languageEntry = (MenuEntries.Language)member; if (languageEntry.WrappedLanguage == language) { return(languageEntry); } } } return(null); } }
/* Function: CreateLanguageEntry * Creates an entry for the language, adds it to the class menu, and returns it. It will also create the <rootClassMenu> * container if necessary. */ protected MenuEntries.Language CreateLanguageEntry(Languages.Language language) { #if DEBUG if (FindLanguageEntry(language) != null) { throw new Exception("Tried to create a language entry that already existed in the menu."); } #endif if (rootClassMenu == null) { rootClassMenu = new MenuEntries.Container(Hierarchy.Class); rootClassMenu.Title = Engine.Locale.Get("NaturalDocs.Engine", "Menu.Classes"); } MenuEntries.Language languageEntry = new MenuEntries.Language(language, Hierarchy.Class); languageEntry.Parent = rootClassMenu; rootClassMenu.Members.Add(languageEntry); return(languageEntry); }
void tl_Popup(object sender, EventArgs e) { AdvancedTextBox atb = ServiceHost.File[ServiceHost.File.Current] as AdvancedTextBox; if (atb != null) { Languages.Language l = atb.Buffer.Language; ToolStripMenuItem[] mma = langtools[l] as ToolStripMenuItem[]; ToolStripMenuItem tl = ServiceHost.Menu["Tools"]; if (mma == null) { ArrayList mm = new ArrayList(); foreach (Type t in l.actions) { //Build.ProcessAction pa = Activator.CreateInstance(t) as Build.ProcessAction; //ToolStripMenuItem mi = new ToolStripMenuItem(pa.Name, null, new EventHandler(InvokeLangTool)); ////mi.Index = tl.MenuItems.Count; //mi.Enabled = pa.IsAvailable; //mi.Tag = pa; //mm.Add(mi); } mma = mm.ToArray(typeof(ToolStripMenuItem)) as ToolStripMenuItem[]; langtools[l] = mma; } if (lastset != null) { foreach (ToolStripMenuItem mi in lastset) { tl.DropDownItems.Remove(mi); } lastset = null; } tl.DropDownItems.AddRange(lastset = mma); } }
public void DrawManageKeys() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); Languages languages = (Languages)target; if (choices.Length > 0 && choices != null && Array.IndexOf(choices, currentLanguage) != -1) { keyName = EditorGUILayout.TextField("Name", keyName); keyText = EditorGUILayout.TextField("Text", keyText); if (GUILayout.Button("Add Key")) { languages.addTextOption(currentLanguage, keyName, keyText); keyName = ""; keyText = ""; } if (languages.langs != null) { Languages.Language selectedLanguage = languages.langs.Find(lang => lang.language == currentLanguage); List <string> keys = selectedLanguage.textValues.Select(x => x.key).ToList(); foreach (string key in keys) { Languages.TextOption textValue = selectedLanguage.textValues.Find(activeLanguage => activeLanguage.key == key); textValue.val = EditorGUILayout.TextField(key, textValue.val); if (GUILayout.Button("Delete Key")) { languages.removeTextOption(currentLanguage, key); } } } } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { if (e.Index < 0) { return; } if (gp == null) { Rectangle r = e.Bounds; int angle = 180; r.Width--; r.Height--; //r.Inflate(-1, - radius/2); //r.Offset(0, (radius/2)); gp = new GraphicsPath(); // top left gp.AddArc(r.X, r.Y, radius, radius, angle, 90); angle += 90; // top right gp.AddArc(r.Right - radius, r.Y, radius, radius, angle, 90); angle += 90; // bottom right gp.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, angle, 90); angle += 90; // bottom left gp.AddArc(r.X, r.Bottom - radius, radius, radius, angle, 90); gp.CloseAllFigures(); } if (borderpen == null) { borderpen = new Pen(SystemColors.Highlight, 1); //borderpen.Alignment = PenAlignment.Center; } bool selected = (e.State & DrawItemState.Selected) != 0; //normal AA looks bad e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //e.Graphics.PixelOffsetMode = PixelOffsetMode.None; string word1 = Text; Rectangle r2 = e.Bounds; r2.Width = r2.Height + 2; r2.X--; r2.Height += 2; r2.Y--; Rectangle r4 = e.Bounds; r4.Inflate(1, 1); //r4.Offset(-1,-1); e.Graphics.FillRectangle(SystemBrushes.Window, r4); //e.DrawBackground(); if (!(Items[e.Index] is CodeModel.ICodeElement)) { if (gradb == null) { LinearGradientBrush gb = new LinearGradientBrush(r2, SystemColors.Control, SystemColors.ControlDark, 0f); gb.SetSigmaBellShape(0.9f, 0.2f); gradb = gb; } e.Graphics.FillRectangle(gradb, r2); } int h = SystemInformation.MenuHeight; Brush b = SystemBrushes.ControlText; if (selected) { Rectangle r = e.Bounds; //Console.WriteLine(r); r.Width -= 1; r.Height -= 1; Rectangle r3 = r; r3.Width -= SystemInformation.MenuHeight; r3.X += SystemInformation.MenuHeight + 1; if (selbg == null) { r2.X -= r.Height / 2; r2.Height *= 2; LinearGradientBrush gb = new LinearGradientBrush(r2, Color.FromArgb(120, SystemColors.ControlLightLight), Color.FromArgb(120, SystemColors.Highlight), 90f); gb.SetSigmaBellShape(0.6f, 0.9f); selbg = gb; } e.Graphics.FillPath(selbg, gp); e.Graphics.DrawPath(borderpen, gp); } { Rectangle r = e.Bounds; r.Width = r.Height; r.X++; r.X++; r.Y++; r.Y++; if (!selected) { //r.X++; //r.Y++; } IImageListProviderService ips = ServiceHost.ImageListProvider; if (ips != null) { int i = ips[Items[e.Index]]; if (i >= 0) { int f = (int)((e.Bounds.Height - 16) / 2f); if ((e.State & DrawItemState.Focus) != 0) { ips.ImageList.Draw(e.Graphics, f + 3, e.Bounds.Top + f + 1, i); } else { ips.ImageList.Draw(e.Graphics, f + 3, e.Bounds.Top + f + 1, i); } } } if (!selected) { //r.X--; //r.Y--; } float fh = (float)font.FontFamily.GetCellAscent(0) / font.FontFamily.GetEmHeight(0); float bh = (float)font.FontFamily.GetCellDescent(0) / font.FontFamily.GetEmHeight(0); int hh = ((int)(float)(e.Bounds.Height - (fh - bh / 2) * font.Height) / 2); Type t = Items[e.Index] as Type; if (t == null) { t = Items[e.Index].GetType(); } Build.Project p = Items[e.Index] as Build.Project; if (p != null) { e.Graphics.DrawString(p.ProjectName, SystemInformation.MenuFont, b, r.Right + 1, e.Bounds.Top + hh); } else { Languages.Language l = Items[e.Index] as Languages.Language; if (l != null) { e.Graphics.DrawString(l.Name, SystemInformation.MenuFont, b, r.Right + 1, e.Bounds.Top + hh); } else { CodeModel.ICodeElement cl = Items[e.Index] as CodeModel.ICodeElement; if (cl != null) { e.Graphics.DrawString(cl is CodeModel.ICodeType ? cl.Fullname : ((cl is CodeModel.ICodeMethod || cl is CodeModel.ICodeField || cl is CodeModel.ICodeProperty) ? cl.ToString() : cl.Name), SystemInformation.MenuFont, b, r.Right + 1, e.Bounds.Top + hh); } else { e.Graphics.DrawString(NameAttribute.GetName(t), SystemInformation.MenuFont, b, r.Right + 1, e.Bounds.Top + hh); } } } gp.Dispose(); gp = null; if (gradb != null) { gradb.Dispose(); gradb = null; } if (selbg != null) { selbg.Dispose(); selbg = null; } } }
// Group: Functions // __________________________________________________________________________ /* Function: Language */ public Language(Languages.Language language, Hierarchy hierarchy) : base(hierarchy) { this.language = language; Title = language.Name; }
// Group: Functions // __________________________________________________________________________ /* Function: Language */ public Language(Languages.Language language) : base() { this.language = language; Title = language.Name; }
/* Function: AppendBody */ protected void AppendBody(StringBuilder output) { output.Append("<div class=\"CBody\">"); string body = context.Topic.Body; NDMarkup.Iterator iterator = new NDMarkup.Iterator(body); bool underParameterHeading = false; string parameterListSymbol = null; string altParameterListSymbol = null; StringBuilder inlineImageContent = null; int imageNumber = 1; while (iterator.IsInBounds) { switch (iterator.Type) { case NDMarkup.Iterator.ElementType.Text: // Preserve multiple whitespace chars, but skip the extra processing if there aren't any if (body.IndexOf(" ", iterator.RawTextIndex, iterator.Length) != -1) { output.Append(iterator.String.ConvertMultipleWhitespaceChars()); } else { iterator.AppendTo(output); } break; case NDMarkup.Iterator.ElementType.ParagraphTag: iterator.AppendTo(output); if (iterator.IsClosingTag && inlineImageContent != null && inlineImageContent.Length > 0) { output.Append(inlineImageContent.ToString()); inlineImageContent.Remove(0, inlineImageContent.Length); } break; case NDMarkup.Iterator.ElementType.BulletListTag: case NDMarkup.Iterator.ElementType.BulletListItemTag: case NDMarkup.Iterator.ElementType.BoldTag: case NDMarkup.Iterator.ElementType.ItalicsTag: case NDMarkup.Iterator.ElementType.UnderlineTag: case NDMarkup.Iterator.ElementType.LTEntityChar: case NDMarkup.Iterator.ElementType.GTEntityChar: case NDMarkup.Iterator.ElementType.AmpEntityChar: case NDMarkup.Iterator.ElementType.QuoteEntityChar: // These the NDMarkup directly matches the HTML tags iterator.AppendTo(output); break; case NDMarkup.Iterator.ElementType.HeadingTag: if (iterator.IsOpeningTag) { output.Append("<div class=\"CHeading\">"); underParameterHeading = (iterator.Property("type") == "parameters"); } else { output.Append("</div>"); } break; case NDMarkup.Iterator.ElementType.PreTag: string preType = iterator.Property("type"); string preLanguageName = iterator.Property("language"); iterator.Next(); NDMarkup.Iterator startOfCode = iterator; // Because we can assume the NDMarkup is valid, we can assume we were on an opening tag and that we will // run into a closing tag before the end of the text. We can also assume the next pre tag is a closing tag. while (iterator.Type != NDMarkup.Iterator.ElementType.PreTag) { iterator.Next(); } string ndMarkupCode = body.Substring(startOfCode.RawTextIndex, iterator.RawTextIndex - startOfCode.RawTextIndex); string textCode = NDMarkupCodeToText(ndMarkupCode); output.Append("<pre>"); if (preType == "code") { Languages.Language preLanguage = null; if (preLanguageName != null) { // This can return null if the language name is unrecognized. preLanguage = EngineInstance.Languages.FromName(preLanguageName); } if (preLanguage == null) { preLanguage = EngineInstance.Languages.FromID(context.Topic.LanguageID); } Tokenizer code = new Tokenizer(textCode, tabWidth: EngineInstance.Config.TabWidth); preLanguage.Parser.SyntaxHighlight(code); AppendSyntaxHighlightedText(code.FirstToken, code.LastToken, output); } else { string htmlCode = textCode.EntityEncode(); htmlCode = StringExtensions.LineBreakRegex.Replace(htmlCode, "<br />"); output.Append(htmlCode); } output.Append("</pre>"); break; case NDMarkup.Iterator.ElementType.DefinitionListTag: if (iterator.IsOpeningTag) { output.Append("<table class=\"CDefinitionList\">"); } else { output.Append("</table>"); } break; case NDMarkup.Iterator.ElementType.DefinitionListEntryTag: case NDMarkup.Iterator.ElementType.DefinitionListSymbolTag: if (iterator.IsOpeningTag) { output.Append("<tr><td class=\"CDLEntry\">"); parameterListSymbol = null; // Create anchors for symbols. We are assuming there are enough embedded topics for each <ds> // tag and that they follow their parent topic in order. if (iterator.Type == NDMarkup.Iterator.ElementType.DefinitionListSymbolTag) { #if DEBUG if (embeddedTopics == null || embeddedTopicIndex >= embeddedTopics.Count || embeddedTopics[embeddedTopicIndex].IsEmbedded == false) { throw new Exception("There are not enough embedded topics to build the definition list."); } #endif var embeddedTopic = embeddedTopics[embeddedTopicIndex]; Context embeddedTopicContext = context; embeddedTopicContext.Topic = embeddedTopic; string embeddedTopicHashPath = embeddedTopicContext.TopicOnlyHashPath; if (embeddedTopicHashPath != null) { output.Append("<a name=\"" + embeddedTopicHashPath.EntityEncode() + "\"></a>"); } output.Append("<a name=\"Topic" + embeddedTopic.TopicID + "\"></a>"); embeddedTopicIndex++; } // If we're using a Parameters: heading, store the entry symbol in parameterListSymbol if (underParameterHeading) { NDMarkup.Iterator temp = iterator; temp.Next(); StringBuilder symbol = new StringBuilder(); while (temp.IsInBounds && temp.Type != NDMarkup.Iterator.ElementType.DefinitionListEntryTag && temp.Type != NDMarkup.Iterator.ElementType.DefinitionListSymbolTag) { if (temp.Type == NDMarkup.Iterator.ElementType.Text) { temp.AppendTo(symbol); } temp.Next(); } // If the entry name starts with any combination of $, @, or % characters, strip them off. int firstNonSymbolIndex = 0; while (firstNonSymbolIndex < symbol.Length) { char charAtIndex = symbol[firstNonSymbolIndex]; if (charAtIndex != '$' && charAtIndex != '@' && charAtIndex != '%') { break; } firstNonSymbolIndex++; } if (symbol.Length > 0) { parameterListSymbol = symbol.ToString(); } else { parameterListSymbol = null; } if (firstNonSymbolIndex > 0) { symbol.Remove(0, firstNonSymbolIndex); altParameterListSymbol = symbol.ToString(); } else { altParameterListSymbol = null; } } } else // closing tag { // See if parameterListSymbol matches any of the prototype parameter names if ((parameterListSymbol != null || altParameterListSymbol != null) && context.Topic.Prototype != null) { var parsedPrototype = context.Topic.ParsedPrototype; TokenIterator start, end; int matchedParameter = -1; for (int i = 0; i < parsedPrototype.NumberOfParameters; i++) { parsedPrototype.GetParameterName(i, out start, out end); if ((parameterListSymbol != null && parsedPrototype.Tokenizer.EqualsTextBetween(parameterListSymbol, true, start, end)) || (altParameterListSymbol != null && parsedPrototype.Tokenizer.EqualsTextBetween(altParameterListSymbol, true, start, end))) { matchedParameter = i; break; } } // If so, include the type under the entry in the HTML if (matchedParameter != -1) { parsedPrototype.BuildFullParameterType(matchedParameter, out start, out end); if (start < end && // Don't include single symbol types !(end.RawTextIndex - start.RawTextIndex == 1 && (start.Character == '$' || start.Character == '@' || start.Character == '%'))) { output.Append("<div class=\"CDLParameterType\">"); AppendSyntaxHighlightedTextWithTypeLinks(start, end, output, links, linkTargets); output.Append("</div>"); } } } output.Append("</td>"); } break; case NDMarkup.Iterator.ElementType.DefinitionListDefinitionTag: if (iterator.IsOpeningTag) { output.Append("<td class=\"CDLDefinition\">"); } else { output.Append("</td></tr>"); } break; case NDMarkup.Iterator.ElementType.LinkTag: string linkType = iterator.Property("type"); if (linkType == "email") { AppendEMailLink(iterator, output); } else if (linkType == "url") { AppendURLLink(iterator, output); } else // type == "naturaldocs" { AppendNaturalDocsLink(iterator, output); } break; case NDMarkup.Iterator.ElementType.ImageTag: if (iterator.Property("type") == "standalone") { AppendStandaloneImageLink(iterator, output); } else if (iterator.Property("type") == "inline") { if (inlineImageContent == null) { inlineImageContent = new StringBuilder(); } AppendInlineImageLink(iterator, output, inlineImageContent, imageNumber); imageNumber++; } else { throw new NotImplementedException(); } break; } iterator.Next(); } output.Append("</div>"); }
/* Function: BuildBody */ protected void BuildBody() { htmlOutput.Append("<div class=\"CBody\">"); NDMarkup.Iterator iterator = new NDMarkup.Iterator(topic.Body); bool underParameterHeading = false; string parameterListSymbol = null; while (iterator.IsInBounds) { switch (iterator.Type) { case NDMarkup.Iterator.ElementType.Text: if (topic.Body.IndexOf(" ", iterator.RawTextIndex, iterator.Length) == -1) { iterator.AppendTo(htmlOutput); } else { htmlOutput.Append(iterator.String.ConvertMultipleWhitespaceChars()); } break; case NDMarkup.Iterator.ElementType.ParagraphTag: case NDMarkup.Iterator.ElementType.BulletListTag: case NDMarkup.Iterator.ElementType.BulletListItemTag: case NDMarkup.Iterator.ElementType.BoldTag: case NDMarkup.Iterator.ElementType.ItalicsTag: case NDMarkup.Iterator.ElementType.UnderlineTag: case NDMarkup.Iterator.ElementType.LTEntityChar: case NDMarkup.Iterator.ElementType.GTEntityChar: case NDMarkup.Iterator.ElementType.AmpEntityChar: case NDMarkup.Iterator.ElementType.QuoteEntityChar: iterator.AppendTo(htmlOutput); break; case NDMarkup.Iterator.ElementType.HeadingTag: if (iterator.IsOpeningTag) { htmlOutput.Append("<div class=\"CHeading\">"); underParameterHeading = (iterator.Property("type") == "parameters"); } else { htmlOutput.Append("</div>"); } break; case NDMarkup.Iterator.ElementType.PreTag: string preType = iterator.Property("type"); string preLanguageName = iterator.Property("language"); iterator.Next(); NDMarkup.Iterator startOfCode = iterator; // Because we can assume the NDMarkup is valid, we can assume we were on an opening tag and that we will // run into a closing tag before the end of the text. We can also assume the next pre tag is a closing tag. while (iterator.Type != NDMarkup.Iterator.ElementType.PreTag) { iterator.Next(); } string ndMarkupCode = topic.Body.Substring(startOfCode.RawTextIndex, iterator.RawTextIndex - startOfCode.RawTextIndex); string textCode = NDMarkupCodeToText(ndMarkupCode); htmlOutput.Append("<pre>"); if (preType == "code") { Languages.Language preLanguage = null; if (preLanguageName != null) { // This can return null if the language name is unrecognized. preLanguage = EngineInstance.Languages.FromName(preLanguageName); } if (preLanguage == null) { preLanguage = EngineInstance.Languages.FromID(topic.LanguageID); } Tokenizer code = new Tokenizer(textCode, tabWidth: EngineInstance.Config.TabWidth); preLanguage.SyntaxHighlight(code); BuildSyntaxHighlightedText(code.FirstToken, code.LastToken); } else { string htmlCode = textCode.EntityEncode(); htmlCode = StringExtensions.LineBreakRegex.Replace(htmlCode, "<br />"); htmlOutput.Append(htmlCode); } htmlOutput.Append("</pre>"); break; case NDMarkup.Iterator.ElementType.DefinitionListTag: if (iterator.IsOpeningTag) { htmlOutput.Append("<table class=\"CDefinitionList\">"); } else { htmlOutput.Append("</table>"); } break; case NDMarkup.Iterator.ElementType.DefinitionListEntryTag: case NDMarkup.Iterator.ElementType.DefinitionListSymbolTag: if (iterator.IsOpeningTag) { htmlOutput.Append("<tr><td class=\"CDLEntry\">"); parameterListSymbol = null; // Create anchors for symbols. We are assuming there are enough embedded topics for each <ds> // tag and that they follow their parent topic in order. if (iterator.Type == NDMarkup.Iterator.ElementType.DefinitionListSymbolTag) { #if DEBUG if (embeddedTopics == null || embeddedTopicIndex >= embeddedTopics.Count || embeddedTopics[embeddedTopicIndex].IsEmbedded == false) { throw new Exception("There are not enough embedded topics to build the definition list."); } #endif string topicHashPath = HTMLBuilder.Source_TopicHashPath(embeddedTopics[embeddedTopicIndex], topicPage.IncludeClassInTopicHashPaths); if (topicHashPath != null) { htmlOutput.Append("<a name=\"" + topicHashPath.EntityEncode() + "\"></a>"); } htmlOutput.Append("<a name=\"Topic" + embeddedTopics[embeddedTopicIndex].TopicID + "\"></a>"); embeddedTopicIndex++; } // If we're using a Parameters: heading, store the entry symbol in parameterListSymbol if (underParameterHeading) { NDMarkup.Iterator temp = iterator; temp.Next(); StringBuilder symbol = new StringBuilder(); while (temp.IsInBounds && temp.Type != NDMarkup.Iterator.ElementType.DefinitionListEntryTag && temp.Type != NDMarkup.Iterator.ElementType.DefinitionListSymbolTag) { if (temp.Type == NDMarkup.Iterator.ElementType.Text) { temp.AppendTo(symbol); } temp.Next(); } // If the entry name starts with any combination of $, @, or % characters, strip them off. int firstNonSymbolIndex = 0; while (firstNonSymbolIndex < symbol.Length) { char charAtIndex = symbol[firstNonSymbolIndex]; if (charAtIndex != '$' && charAtIndex != '@' && charAtIndex != '%') { break; } firstNonSymbolIndex++; } if (firstNonSymbolIndex > 0) { symbol.Remove(0, firstNonSymbolIndex); } if (symbol.Length > 0) { parameterListSymbol = symbol.ToString(); } } } else // closing tag { // See if parameterListSymbol matches any of the prototype parameter names if (parameterListSymbol != null && topic.Prototype != null) { TokenIterator start, end; int matchedParameter = -1; for (int i = 0; i < topic.ParsedPrototype.NumberOfParameters; i++) { topic.ParsedPrototype.GetParameterName(i, out start, out end); if (topic.ParsedPrototype.Tokenizer.EqualsTextBetween(parameterListSymbol, true, start, end)) { matchedParameter = i; break; } } // If so, include the type under the entry in the HTML if (matchedParameter != -1) { TokenIterator extraModifierStart, extraModifierEnd, prefixStart, prefixEnd, suffixStart, suffixEnd; topic.ParsedPrototype.GetFullParameterType(matchedParameter, out start, out end, out extraModifierStart, out extraModifierEnd, out prefixStart, out prefixEnd, out suffixStart, out suffixEnd); if (start < end && // Don't include single symbol types (end.RawTextIndex - start.RawTextIndex > 1 || (start.Character != '$' && start.Character != '@' && start.Character != '%'))) { htmlOutput.Append("<div class=\"CDLParameterType\">"); if (extraModifierStart < extraModifierEnd) { BuildTypeLinkedAndSyntaxHighlightedText(extraModifierStart, extraModifierEnd); htmlOutput.Append(' '); } BuildTypeLinkedAndSyntaxHighlightedText(start, end); BuildTypeLinkedAndSyntaxHighlightedText(prefixStart, prefixEnd); BuildTypeLinkedAndSyntaxHighlightedText(suffixStart, suffixEnd); htmlOutput.Append("</div>"); } } } htmlOutput.Append("</td>"); } break; case NDMarkup.Iterator.ElementType.DefinitionListDefinitionTag: if (iterator.IsOpeningTag) { htmlOutput.Append("<td class=\"CDLDefinition\">"); } else { htmlOutput.Append("</td></tr>"); } break; case NDMarkup.Iterator.ElementType.LinkTag: string linkType = iterator.Property("type"); if (linkType == "email") { BuildEMailLink(iterator); } else if (linkType == "url") { BuildURLLink(iterator); } else // type == "naturaldocs" { BuildNaturalDocsLink(iterator); } break; case NDMarkup.Iterator.ElementType.ImageTag: // xxx if (iterator.Property("type") == "standalone") { htmlOutput.Append("<p>"); } htmlOutput.Append(iterator.Property("originaltext").ToHTML()); if (iterator.Property("type") == "standalone") { htmlOutput.Append("</p>"); } break; } iterator.Next(); } htmlOutput.Append("</div>"); }
public Languages.Language Compile() { Generate(); Process p = new Process(); ProcessStartInfo psi = new ProcessStartInfo("Tools/cs_lex.exe", name + ".lex"); psi.UseShellExecute = false; psi.RedirectStandardError = psi.RedirectStandardOutput = true; psi.CreateNoWindow = true; p.StartInfo = psi; p.Start(); p.WaitForExit(); Trace.WriteLine(p.StandardError.ReadToEnd()); Trace.WriteLine(p.StandardOutput.ReadToEnd()); string outfn = name + ".lex.cs"; bool dbg = Debugger.IsAttached; string cmd = ServiceHost.Discovery.NetRuntimeRoot + "\\csc.exe"; string args = string.Format("-nologo -out:{0} {1} -t:library -r:xacc.dll -d:STANDALONE -nowarn:0162 {2}", name + ".dll", dbg ? "-debug" : "-o", outfn); psi = new ProcessStartInfo(cmd, args); psi.CreateNoWindow = true; psi.UseShellExecute = false; psi.RedirectStandardError = true; psi.RedirectStandardOutput = true; p = Process.Start(psi); p.WaitForExit(); Trace.WriteLine(p.StandardError.ReadToEnd()); Trace.WriteLine(p.StandardOutput.ReadToEnd()); byte[] data = null; byte[] dbgdata = null; using (Stream s = File.OpenRead(name + ".dll")) { data = new byte[s.Length]; s.Read(data, 0, data.Length); } if (File.Exists(name + ".pdb")) { using (Stream s = File.OpenRead(name + ".pdb")) { dbgdata = new byte[s.Length]; s.Read(dbgdata, 0, dbgdata.Length); } } Assembly ass = Assembly.Load(data, dbgdata); ServiceHost.Plugin.LoadAssembly(ass); Languages.Language l = ServiceHost.Language.GetLanguage(name); return(l); }