public override byte[] GetBytes(ID3v2TagVersion tagVersion) { if (Items.Count == 0) { return(new byte[0]); } // Set TextEncoding to Unicode/UTF8 if required if (TextEncoding == EncodingType.ISO88591) { foreach (ILanguageItem languageItem in Items) { byte[] languageCodeData = ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, languageItem.LanguageCode, true); this.RequiresFix(tagVersion, languageItem.LanguageCode, languageCodeData); } } using (MemoryStream frameData = new MemoryStream()) { frameData.WriteByte((byte)TextEncoding); bool isTerminated = true; //(tagVersion == TagVersion.ID3v24); for (int i = 0; i < Items.Count; i++) { ILanguageItem languageItem = Items[i]; if (i == Items.Count - 1) { isTerminated = false; } frameData.Write(ID3v2Utils.GetStringBytes(tagVersion, TextEncoding, languageItem.LanguageCode, isTerminated)); } return(_frameHeader.GetBytes(frameData, tagVersion, GetFrameID(tagVersion))); } }
public LanguageItemWindow (ILanguageItem item, IParserContext ctx, Ambience ambience, string errorInformations) : base (WindowType.Popup) { Name = "gtk-tooltips"; // Approximate value for usual case StringBuilder s = new StringBuilder(150); if (item != null) { if (item is IParameter) { s.Append ("<small><i>"); s.Append (paramStr); s.Append ("</i></small>\n"); s.Append (ambience.Convert ((IParameter)item, WindowConversionFlags)); } else if (item is LocalVariable) { s.Append ("<small><i>"); s.Append (localStr); s.Append ("</i></small>\n"); s.Append (ambience.Convert ((LocalVariable)item, WindowConversionFlags)); } else if (item is IField) { s.Append ("<small><i>"); s.Append (fieldStr); s.Append ("</i></small>\n"); s.Append (ambience.Convert ((IField)item, WindowConversionFlags)); } else if (item is IProperty) { s.Append ("<small><i>"); s.Append (propertyStr); s.Append ("</i></small>\n"); s.Append (ambience.Convert ((IProperty)item, WindowConversionFlags)); } else if (item is Namespace) { s.Append ("namespace <b>"); s.Append (item.Name); s.Append ("</b>"); } else s.Append (ambience.Convert (item, WindowConversionFlags)); string doc = GetDocumentation (item.Documentation).Trim ('\n'); if (!string.IsNullOrEmpty (doc)) { s.Append ("\n<small>"); s.Append (doc); s.Append ("</small>"); } } if (!string.IsNullOrEmpty (errorInformations)) { if (s.Length != 0) s.Append ("\n\n"); s.Append ("<small>"); s.Append (errorInformations); s.Append ("</small>"); } Label lab = new Label (); lab.Markup = s.ToString (); lab.Xalign = 0; lab.Xpad = 3; lab.Ypad = 3; Add (lab); }
internal void MonodocResolverUpdate(CommandInfo cinfo) { TextIter insertIter = buf.GetIterAtMark(buf.InsertMark); ILanguageItem languageItem = GetLanguageItem(insertIter); if (languageItem == null) { cinfo.Bypass = true; } }
internal void MonodocResolver() { TextIter insertIter = buf.GetIterAtMark(buf.InsertMark); ILanguageItem languageItem = GetLanguageItem(insertIter); if (languageItem != null) { IdeApp.HelpOperations.ShowHelp(MonoDevelop.Projects.Services.DocumentationService.GetHelpUrl(languageItem)); } }
bool ShowTooltip() { ModifierType mask; // ignored int xloc, yloc; string errorInfo; showTipScheduled = false; this.GetWindow(TextWindowType.Text).GetPointer(out xloc, out yloc, out mask); TextIter ti = this.GetIterAtLocation(xloc + this.VisibleRect.X, yloc + this.VisibleRect.Y); ILanguageItem item = GetLanguageItem(ti); if (item != null) { // Tip already being shown for this language item? if (languageItemWindow != null && tipItem != null && tipItem.Equals(item)) { return(false); } langTipX = xloc; langTipY = yloc; tipItem = item; HideLanguageItemWindow(); IParserContext pctx = GetParserContext(); if (pctx == null) { return(false); } DoShowTooltip(new LanguageItemWindow(tipItem, pctx, GetAmbience(), GetErrorInformationAt(ti)), langTipX, langTipY); } else if (!string.IsNullOrEmpty((errorInfo = GetErrorInformationAt(ti)))) { // Error tooltip already shown if (languageItemWindow != null && tiItem == ti.Line) { return(false); } tiItem = ti.Line; HideLanguageItemWindow(); DoShowTooltip(new LanguageItemWindow(null, null, null, errorInfo), xloc, yloc); } else { HideLanguageItemWindow(); } return(false); }
public void ResolveNamespace() { ILanguageItem languageItem = parserContext.ResolveIdentifier("System", 1, 9, testFileName, testFileContents); Assert.IsTrue(languageItem is Namespace); Assert.AreEqual("System", (languageItem as Namespace).Name); languageItem = parserContext.ResolveIdentifier("System.IO", 2, 14, testFileName, testFileContents); Assert.IsTrue(languageItem is Namespace); Assert.AreEqual("System.IO", (languageItem as Namespace).Name); }
public byte[] GetBytes(ID3v2TagVersion tagVersion) { if (this.Items.Count == 0) { return(new byte[0]); } using (MemoryStream stream1 = new MemoryStream()) { stream1.WriteByte((byte)this.TextEncoding); bool flag1 = true; for (int num1 = 0; num1 < this.Items.Count; num1++) { ILanguageItem item1 = this.Items[num1]; if (num1 == (this.Items.Count - 1)) { flag1 = false; } Utils.Write(stream1, Utils.GetStringBytes(tagVersion, this.TextEncoding, item1.LanguageCode, flag1)); } return(this.m_FrameHeader.GetBytes(stream1, tagVersion, this.GetFrameID(tagVersion))); } }
public LanguageItem(PropertyInfo propertyInfo, ILanguageItem languageItem) { Property = propertyInfo; InnerLanguageItem = languageItem; }
public LanguageItemWindow(ILanguageItem item, IParserContext ctx, Ambience ambience, string errorInformations) : base(WindowType.Popup) { Name = "gtk-tooltips"; // Approximate value for usual case StringBuilder s = new StringBuilder(150); if (item != null) { if (item is IParameter) { s.Append("<small><i>"); s.Append(paramStr); s.Append("</i></small>\n"); s.Append(ambience.Convert((IParameter)item, WindowConversionFlags)); } else if (item is LocalVariable) { s.Append("<small><i>"); s.Append(localStr); s.Append("</i></small>\n"); s.Append(ambience.Convert((LocalVariable)item, WindowConversionFlags)); } else if (item is IField) { s.Append("<small><i>"); s.Append(fieldStr); s.Append("</i></small>\n"); s.Append(ambience.Convert((IField)item, WindowConversionFlags)); } else if (item is IProperty) { s.Append("<small><i>"); s.Append(propertyStr); s.Append("</i></small>\n"); s.Append(ambience.Convert((IProperty)item, WindowConversionFlags)); } else if (item is Namespace) { s.Append("namespace <b>"); s.Append(item.Name); s.Append("</b>"); } else { s.Append(ambience.Convert(item, WindowConversionFlags)); } string doc = GetDocumentation(item.Documentation).Trim('\n'); if (!string.IsNullOrEmpty(doc)) { s.Append("\n<small>"); s.Append(doc); s.Append("</small>"); } } if (!string.IsNullOrEmpty(errorInformations)) { if (s.Length != 0) { s.Append("\n\n"); } s.Append("<small>"); s.Append(errorInformations); s.Append("</small>"); } Label lab = new Label(); lab.Markup = s.ToString(); lab.Xalign = 0; lab.Xpad = 3; lab.Ypad = 3; Add(lab); }
bool ShowTooltip () { ModifierType mask; // ignored int xloc, yloc; string errorInfo; showTipScheduled = false; this.GetWindow (TextWindowType.Text).GetPointer (out xloc, out yloc, out mask); TextIter ti = this.GetIterAtLocation (xloc + this.VisibleRect.X, yloc + this.VisibleRect.Y); ILanguageItem item = GetLanguageItem (ti); if (item != null) { // Tip already being shown for this language item? if (languageItemWindow != null && tipItem != null && tipItem.Equals (item)) return false; langTipX = xloc; langTipY = yloc; tipItem = item; HideLanguageItemWindow (); IParserContext pctx = GetParserContext (); if (pctx == null) return false; DoShowTooltip (new LanguageItemWindow (tipItem, pctx, GetAmbience (), GetErrorInformationAt (ti)), langTipX, langTipY); } else if (!string.IsNullOrEmpty ((errorInfo = GetErrorInformationAt(ti)))) { // Error tooltip already shown if (languageItemWindow != null && tiItem == ti.Line) return false; tiItem = ti.Line; HideLanguageItemWindow (); DoShowTooltip (new LanguageItemWindow (null, null, null, errorInfo), xloc, yloc); } else HideLanguageItemWindow (); return false; }
void UpdateComboTip (ComboBox combo, ILanguageItem it) { MonoDevelop.Projects.Ambience.Ambience am = se.View.GetAmbience (); string txt; if (it != null) txt = am.Convert (it, MonoDevelop.Projects.Ambience.ConversionFlags.All); else txt = null; tips.SetTip (combo.Parent, txt, txt); }