/// <summary> /// Returns a string that represents the current object. /// </summary> /// <returns> /// A string that represents the current object. /// </returns> public override string ToString() { string l; if (Picture == null) { l = '"' + GetDescription(NodeType) + "\n\n" + Caption.Replace(Environment.NewLine, "\\n") + '"'; } else { // save image to working directory string imageFilename = Id + ".png"; Picture.Save(imageFilename, System.Drawing.Imaging.ImageFormat.Png); l = "<<TABLE border=\"0\" cellborder=\"0\"><TR><TD><IMG SRC=\"" + imageFilename + "\" scale=\"true\"/></TD><TD>" + GetDescription(NodeType) + "<BR/><BR/>" + Caption.Replace(Environment.NewLine, "<BR/>") + "</TD></TR></TABLE>>"; } return(Id + "[ " + "color=black, margin=0 shape=box, style=filled, fillcolor=" + GetDescription(FrameColor) + ", fontsize=20, fontname=Arial" + " label = " + l + "];"); }
public string GenerateHtmlForTags(string[] tags) { StringBuilder htmlBuilder = new StringBuilder(); for (int i = 0; i < tags.Length; i++) { string tag = tags[i]; string encodedTags; if (String.IsNullOrEmpty(EncodingName)) { encodedTags = HttpUtility.UrlEncode(tag); } else { encodedTags = HttpUtility.UrlEncode(tag, Encoding.GetEncoding(EncodingName)); } string finalHtml = HtmlFormat.Replace(TAG_TOKEN, HttpUtility.HtmlEncode(tag)); finalHtml = finalHtml.Replace(TAG_ENCODED_TOKEN, HttpUtility.HtmlEncode(encodedTags)); htmlBuilder.Append(finalHtml); if (i < (tags.Length - 1)) { htmlBuilder.Append(Separator); } } string tagGroup = htmlBuilder.ToString(); if (Caption.IndexOf(TAG_GROUP_TOKEN) > -1) { return(Caption.Replace(TAG_GROUP_TOKEN, tagGroup)); } else { return(Caption + tagGroup); } }
public string ToDataString() { return(string.Format("{0}|{1}|{2}|{3}", Uri, RotationDeg, Caption == null ? "" : Caption.Replace("|", "[!-!]").Replace("\n", "").Replace("\r", "<!br!>"), Description == null ? "" : Description.Replace("|", "[!-!]").Replace("\n", "").Replace("\r", "<!br!>"))); }