public void AddRelated(ReferenceVersionRelated relatedVersion) { BuildExceptions.NotNull(relatedVersion, "relatedVersion"); if (_listRelated == null) { _listRelated = new BuildKeyedList <ReferenceVersionRelated>(); } _listRelated.Add(relatedVersion); }
public void AddSource(ReferenceVersionSource source) { BuildExceptions.NotNull(source, "source"); if (_listSources == null) { _listSources = new BuildKeyedList <ReferenceVersionSource>(); } _listSources.Add(source); }
public override void Add(BuildTopicTocInfo item) { if (item == null) { return; } if (_listTopics == null) { _listTopics = new BuildKeyedList <BuildTopicTocInfo>(); } _listTopics.Add(item); }
public virtual void AddRelated(ConceptualRelatedTopic item) { if (item == null) { return; } if (_relatedTopics == null) { _relatedTopics = new BuildKeyedList <ConceptualRelatedTopic>(); } if (!_relatedTopics.Contains(item.TopicId)) { _relatedTopics.Add(item); } }
public override void OnWriteTopic(ConceptualItem item) { ConceptualItemType itemType = item.ItemType; if (itemType == ConceptualItemType.Topic || itemType == ConceptualItemType.Related) { _manifestWriter.WriteStartElement("topic"); // start-fileAsset _manifestWriter.WriteAttributeString("id", item.TopicId); _manifestWriter.WriteEndElement(); // end-fileAsset } else if (itemType == ConceptualItemType.Html) { _context[item.TopicId] = item.TopicTitle; } else if (itemType == ConceptualItemType.Marker) { if (_listMarkers == null) { _listMarkers = new BuildKeyedList <ConceptualMarkerTopic>(); } _listMarkers.Add((ConceptualMarkerTopic)item); } }
private void ReadTopic(XmlReader reader, BuildTopicTocInfo parent) { XmlNodeType nodeType = XmlNodeType.None; while (reader.Read()) { nodeType = reader.NodeType; if (nodeType == XmlNodeType.Element && String.Equals(reader.Name, "topic", StringComparison.OrdinalIgnoreCase)) { string topicId = reader.GetAttribute("id"); string topicFile = reader.GetAttribute("file"); string topicContainer = reader.GetAttribute("project"); if (!String.IsNullOrEmpty(topicId) && !String.IsNullOrEmpty(topicFile)) { BuildTopicTocInfo topic = new BuildTopicTocInfo( topicId, topicFile, parent); topic.Container = topicContainer; if (String.Equals(topicContainer, "_Namespaces", StringComparison.OrdinalIgnoreCase)) { _listNamespaces.Add(topic); } parent.Add(topic); if (!reader.IsEmptyElement) { // Read the sub-topics... this.ReadTopic(reader, topic); } } } else if (nodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, BuildTopicTocInfo.TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
public SnippetContent(string name) { _name = String.IsNullOrEmpty(name) ? Guid.NewGuid().ToString() : name; _excludedUnitFolders = new BuildList <string>(); _languages = new BuildKeyedList <SnippetLanguage>(); _languages.Add(new SnippetLanguage("VB", "VisualBasic", ".vb")); _languages.Add(new SnippetLanguage("CS", "CSharp", ".cs")); _languages.Add(new SnippetLanguage("CPP", "ManagedCPlusPlus", ".cpp")); _languages.Add(new SnippetLanguage("FS", "FSharp", ".fs")); _languages.Add(new SnippetLanguage("JS", "JScript", ".js")); _languages.Add(new SnippetLanguage("JSL", "JSharp", ".java")); _languages.Add(new SnippetLanguage("Common", "None", "")); _languages.Add(new SnippetLanguage("XAML", "XAML", ".xaml")); }
public override void Add(ConceptualItem item) { BuildExceptions.NotNull(item, "item"); if (_listItems == null) { _listItems = new BuildKeyedList <ConceptualItem>(); } Debug.Assert(this.Content != null); item.Content = this.Content; _listItems.Add(item); }
public void Add(ReferenceGroupContext groupContext) { BuildExceptions.NotNull(groupContext, "groupContext"); if (this.IsInitialized) { BuildContext context = this.Context; groupContext.Initialize(context); //context.GroupContexts.Add(groupContext); this.SetValue(groupContext.Id, groupContext); } _contexts.Add(groupContext); }
private bool OnBeginMultiple(BuildContext context) { BuildLogger logger = context.Logger; ReferenceGroupContext groupContext = context.GroupContexts[_group.Id] as ReferenceGroupContext; if (groupContext == null) { throw new BuildException( "The group context is not provided, and it is required by the build system."); } string apiVersionsDir = Path.Combine(context.WorkingDirectory, groupContext["$ApiVersionsFolder"]); if (!Directory.Exists(apiVersionsDir)) { Directory.CreateDirectory(apiVersionsDir); } _listVersions = new BuildKeyedList <ReferenceVersions>(); ReferenceVersionInfo versionInfo = _group.VersionInfo; // For the main version information... ReferenceVersions versions = new ReferenceVersions(versionInfo.PlatformId, versionInfo.PlatformTitle); ReferenceVersionSource mainSource = new ReferenceVersionSource( versionInfo.VersionId); mainSource.Content = _group.Content; mainSource.VersionLabel = versionInfo.VersionLabel; versions.Add(mainSource); for (int i = 0; i < versionInfo.Count; i++) { ReferenceVersionSource source = versionInfo[i]; if (source != null && source.IsValid) { versions.Add(source); } } _listVersions.Add(versions); // For the related versions information... IList <ReferenceVersionRelated> listRelated = versionInfo.RelatedVersions; if (listRelated != null && listRelated.Count != 0) { for (int j = 0; j < listRelated.Count; j++) { ReferenceVersionRelated related = listRelated[j]; if (related == null || related.IsEmpty) { continue; } versions = new ReferenceVersions(related.PlatformId, related.PlatformTitle); for (int i = 0; i < related.Count; i++) { ReferenceVersionSource source = related[i]; if (source != null && source.IsValid) { versions.Add(source); } } _listVersions.Add(versions); } } // Now, we prepare the various platforms and contexts... for (int i = 0; i < _listVersions.Count; i++) { versions = _listVersions[i]; string indexText = String.Empty; if (_listVersions.Count > 1) { indexText = (i + 1).ToString(); } string versionsDir = Path.Combine(apiVersionsDir, "Platform" + indexText); if (!Directory.Exists(versionsDir)) { Directory.CreateDirectory(versionsDir); } versions.PlatformDir = versionsDir; int itemCount = versions.Count; for (int j = 0; j < itemCount; j++) { ReferenceVersionSource source = versions[j]; ReferenceGroupContext versionsContext = new ReferenceGroupContext(_group, source.SourceId); indexText = String.Empty; if (itemCount > 1) { indexText = (j + 1).ToString(); } string workingDir = Path.Combine(versionsDir, "Version" + indexText); if (!Directory.Exists(workingDir)) { Directory.CreateDirectory(workingDir); } versions.VersionDirs.Add(workingDir); versionsContext["$GroupIndex"] = groupContext["$GroupIndex"]; versionsContext["$VersionsIndex"] = indexText; versionsContext["$VersionsDir"] = versionsDir; versionsContext["$WorkingDir"] = workingDir; versionsContext.CreateProperties(String.Empty); groupContext.Add(versionsContext); } } groupContext.Versions = _listVersions; return(true); }