public virtual string ToString(WaypointToStringOption option) { if (option == WaypointToStringOption.Normal) { return(Name); } if (option == WaypointToStringOption.GPXExport) { CultureInfo en = new CultureInfo("en-us"); string gpx = string.Format("<wpt lat=\"{0}\" lon=\"{1}\">" + "<name>{2}</name>" + "<desc>{3}</desc>" + "<cmt>{4}</cmt>" + "<url>{5}</url>" + "<urlname>{6}</urlname>" + "<type>{7}</type>" + "<sym>{8}</sym>" + "<ele>{9}</ele></wpt>", Latitude.ToString(en), Longitude.ToString(en), EscapeString(Name), EscapeString(Description), EscapeString(Comment), Link.Href, EscapeString(Link.Text), Type, Symbol, Elevation); return(gpx); } return(string.Format("Name: {0}, Description: {1}", Name, Description)); }
public override string ToString(WaypointToStringOption option) { if (option == WaypointToStringOption.EmailDescription || option == WaypointToStringOption.Normal) { return(string.Format("Name: {0}\r\nSpec: {1}\r\n Link: http://coord.info/{2}", Title, SubTitle, Name)); } else if (option == WaypointToStringOption.GPXExport) { CultureInfo en = new CultureInfo("en-us"); string attrs = "<groundspeak:attributes>"; foreach (GeocacheAttribute a in Attributes) { string attr = string.Format("<groundspeak:attribute id=\"{0}\" inc=\"{1}\">{2}</groundspeak:attribute>", a.ID, a.YesState ? "1" : "0", a.Name); attrs = string.Format("{0}{1}\r\n", attrs, attr); } attrs += "</groundspeak:attributes>"; string logs = "<groundspeak:logs>"; foreach (GeocacheLog l in Logs) { string log = string.Format("<groundspeak:log>" + "<groundspeak:date>{0}</groundspeak:date>" + "<groundspeak:type>{1}</groundspeak:type>" + "<groundspeak:finder>{2}</groundspeak:finder>" + "<groundspeak:text>{3}</groundspeak:text></groundspeak:log>", l.Date.ToString(en), l.Type, EscapeString(l.Finder), EscapeString(l.Text)); logs = string.Format("{0}{1}\r\n", logs, log); } logs += "</groundspeak:logs>"; string gc = string.Format("<groundspeak:cache available=\"{0}\" xmlns:groundspeak=\"http://www.groundspeak.com/cache/1/0/1\">" + "<groundspeak:name>{1}</groundspeak:name>" + "<groundspeak:owner>{2}</groundspeak:owner>" + "<groundspeak:type>{3}</groundspeak:type>" + "<groundspeak:container>{4}</groundspeak:container>" + "<groundspeak:difficulty>{5}</groundspeak:difficulty>" + "<groundspeak:terrain>{6}</groundspeak:terrain>" + "<groundspeak:long_description html=\"True\">{7}</groundspeak:long_description>" + "<groundspeak:encoded_hints>{8}</groundspeak:encoded_hints>" + "{9}{10}</groundspeak:cache>", Available, EscapeString(Title), EscapeString(Owner), GetGPXTypeName().Replace(" Found", ""), CacheSizeToText(Container), Difficulty.ToString(en), Terrain.ToString(en), EscapeString(LongDescription), EscapeString(Hint), attrs, logs); string gpx = string.Format("<wpt lat=\"{0}\" lon=\"{1}\">" + "<name>{2}</name>" + "<desc>{3}</desc>" + "<cmt>{4}</cmt>" + "<url>{5}</url>" + "<urlname>{6}</urlname>" + "<type>{7}</type>" + "<sym>{8}</sym>" + "<ele>{9}</ele>" + "{10}</wpt>", Latitude.ToString(en), Longitude.ToString(en), Code, EscapeString(Description), EscapeString(Comment), Link.Href, EscapeString(Link.Text), GetGPXTypeName().Replace(" Found", ""), Found ? "Geocache Found" : "Geocache", Elevation, gc); foreach (Waypoint wpa in AdditionalWaypoints) { string stage = wpa.ToString(WaypointToStringOption.GPXExport); gpx = gpx + "\r\n" + stage; } return(gpx); } return(base.ToString(option)); }