internal override void WriteWPTDetails(XmlWriter writer, GPXWriter gpx) { base.WriteWPTDetails(writer, gpx); if (!gpx.IncludeGroundSpeakExtensions) { return; } writer.WriteStartElement(CACHE_PREFIX, "cache", GPXWriter.NS_CACHE); if (String.IsNullOrEmpty(CacheID)) { writer.WriteAttributeString("id", gpx.GetNextGUID().ToString()); } else { writer.WriteAttributeString("id", CacheID); } writer.WriteAttributeString("available", Available.ToString()); writer.WriteAttributeString("archived", Archived.ToString()); // Temp until smart-tag like support if (HasCorrected) { writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, "(*) " + CacheName); } else { writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, CacheName); } writer.WriteElementString(CACHE_PREFIX, "placed_by", GPXWriter.NS_CACHE, PlacedBy); writer.WriteStartElement(CACHE_PREFIX, "owner", GPXWriter.NS_CACHE); writer.WriteAttributeString("id", OwnerID); writer.WriteString(CacheOwner); writer.WriteEndElement(); writer.WriteElementString(CACHE_PREFIX, "type", GPXWriter.NS_CACHE, GetCTypeString(TypeOfCache)); writer.WriteElementString(CACHE_PREFIX, "container", GPXWriter.NS_CACHE, Container); List <CacheAttribute> attrs = gpx.GetAttributes(this.Name); writer.WriteStartElement(CACHE_PREFIX, "attributes", GPXWriter.NS_CACHE); foreach (CacheAttribute curr in attrs) { writer.WriteStartElement(CACHE_PREFIX, "attribute", GPXWriter.NS_CACHE); if (!String.IsNullOrEmpty(curr.ID)) { writer.WriteAttributeString("id", curr.ID); } if (curr.Include) { writer.WriteAttributeString("inc", "1"); } else { writer.WriteAttributeString("inc", "0"); } writer.WriteString(curr.AttrValue); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteElementString(CACHE_PREFIX, "difficulty", GPXWriter.NS_CACHE, Difficulty.ToString("0.#", CultureInfo.InvariantCulture)); writer.WriteElementString(CACHE_PREFIX, "terrain", GPXWriter.NS_CACHE, Terrain.ToString("0.#", CultureInfo.InvariantCulture)); writer.WriteElementString(CACHE_PREFIX, "country", GPXWriter.NS_CACHE, Country); writer.WriteElementString(CACHE_PREFIX, "state", GPXWriter.NS_CACHE, State); StringBuilder shortDescription = new StringBuilder(); if (HasCorrected) { shortDescription.Append(Catalog.GetString("Original Coordinate:")); shortDescription.Append(Utilities.getCoordString(OrigLat, OrigLon)); shortDescription.Append("<br/>"); } if (gpx.WriteAttributes) { attrs = gpx.GetAttributes(this.Name); foreach (CacheAttribute curr in attrs) { if (curr.Include) { shortDescription.Append(Catalog.GetString("Y:")); } else { shortDescription.Append(Catalog.GetString("N:")); } shortDescription.Append(curr.AttrValue); shortDescription.Append("<br/>"); } if (attrs.Count > 0) { shortDescription.Append("<hr noshade/>"); } } if (!String.IsNullOrEmpty(Notes)) { shortDescription.Append(Notes); shortDescription.Append("<hr noshade/>"); } shortDescription.Append(ShortDesc); writer.WriteStartElement(CACHE_PREFIX, "short_description", GPXWriter.NS_CACHE); writer.WriteAttributeString("html", "True"); if (gpx.HTMLOutput == HTMLMode.GARMIN) { writer.WriteCData(Utilities.HTMLtoGarmin(shortDescription.ToString())); } else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT) { writer.WriteCData(Utilities.HTMLtoText(shortDescription.ToString())); } else { writer.WriteCData(shortDescription.ToString()); } writer.WriteEndElement(); writer.WriteStartElement(CACHE_PREFIX, "long_description", GPXWriter.NS_CACHE); writer.WriteAttributeString("html", "True"); if (gpx.HTMLOutput == HTMLMode.GARMIN) { writer.WriteCData(Utilities.HTMLtoGarmin(LongDesc)); } else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT) { writer.WriteCData(Utilities.HTMLtoText(LongDesc)); } else { writer.WriteCData(LongDesc); } writer.WriteEndElement(); writer.WriteStartElement(CACHE_PREFIX, "encoded_hints", GPXWriter.NS_CACHE); writer.WriteAttributeString("html", "True"); if (gpx.HTMLOutput == HTMLMode.GARMIN || gpx.HTMLOutput == HTMLMode.PLAINTEXT) { writer.WriteCData(Utilities.HTMLtoText(Hint)); } else { writer.WriteCData(Hint); } writer.WriteEndElement(); writer.WriteStartElement(CACHE_PREFIX, "logs", GPXWriter.NS_CACHE); if (gpx.IsMyFinds) { CacheLog log = gpx.CacheStore.GetLastFindLogBy(this.Name, gpx.MyFindsOwner); if (log.LogStatus == "find") { log.LogStatus = "Found it"; } log.WriteToGPX(writer); } else { List <CacheLog> logs = gpx.GetCacheLogs(this.Name); int iCount = 0; foreach (CacheLog log in logs) { if ((iCount >= gpx.LogLimit) && (gpx.LogLimit != -1)) { break; } else { log.WriteToGPX(writer); } iCount++; } } writer.WriteEndElement(); writer.WriteStartElement(CACHE_PREFIX, "travelbugs", GPXWriter.NS_CACHE); List <TravelBug> bugs = gpx.GetTravelBugs(this.Name); foreach (TravelBug bug in bugs) { bug.WriteToGPX(writer); } writer.WriteEndElement(); writer.WriteEndElement(); }
public override IReadOnlyList <string> MergedQualifiers() { var parameters = new List <string>(); if (Type != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "type:{0}", Type.ToParameter())); } if (In != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}", string.Join(",", In.Select(i => i.ToParameter())))); } if (Author.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "author:{0}", Author)); } if (Assignee.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "assignee:{0}", Assignee)); } if (Mentions.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "mentions:{0}", Mentions)); } if (Commenter.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "commenter:{0}", Commenter)); } if (Involves.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "involves:{0}", Involves)); } if (Team.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "team:{0}", Team)); } if (State.HasValue) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "state:{0}", State.Value.ToParameter())); } if (Labels != null) { parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:\"{0}\"", label))); } if (No.HasValue) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "no:{0}", No.Value.ToParameter())); } if (Language != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:\"{0}\"", Language.ToParameter())); } if (Is != null) { parameters.AddRange(Is.Select(x => string.Format(CultureInfo.InvariantCulture, "is:{0}", x.ToParameter()))); } if (Created != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "created:{0}", Created)); } if (Updated != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "updated:{0}", Updated)); } if (Merged != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "merged:{0}", Merged)); } if (Status.HasValue) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "status:{0}", Status.Value.ToParameter())); } if (Head.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "head:{0}", Head)); } if (Base.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "base:{0}", Base)); } if (Closed != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "closed:{0}", Closed)); } if (Comments != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "comments:{0}", Comments)); } if (User.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User)); } if (Repos.Any()) { var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat()); if (invalidFormatRepos.Any()) { throw new RepositoryFormatException(invalidFormatRepos); } parameters.AddRange(Repos.Select(x => string.Format(CultureInfo.InvariantCulture, "repo:{0}", x))); } if (Milestone.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "milestone:\"{0}\"", Milestone.EscapeDoubleQuotes())); } if (Archived != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower())); } // Add any exclusion parameters if (Exclusions != null) { parameters.AddRange(Exclusions.MergedQualifiers()); } return(new ReadOnlyCollection <string>(parameters)); }
public override IReadOnlyList <string> MergedQualifiers() { var parameters = new List <string>(); if (In != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}", string.Join(",", In))); } if (Size != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "size:{0}", Size)); } if (Forks != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "forks:{0}", Forks)); } if (Fork != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "fork:{0}", Fork.ToParameter())); } if (Stars != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "stars:{0}", Stars)); } if (Language != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:\"{0}\"", Language.ToParameter())); } if (User.IsNotBlank()) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User)); } if (Created != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "created:{0}", Created)); } if (Updated != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "pushed:{0}", Updated)); } if (Archived != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower())); } if (Topic != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "topic:{0}", Topic.ToLower())); } if (Topics != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "topics:{0}", Topics.ToString().ToLower())); } if (License != null) { parameters.Add(string.Format(CultureInfo.InvariantCulture, "license:{0}", License.ToParameter())); } return(parameters); }