//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="cache">The cache with which this indexed document is associated</param> /// <param name="file">The file to index</param> public IndexedDocument(IndexedCache cache, string file) { foreach (var kv in cache.GetValues(file)) { index[kv.Key] = kv.Value; } }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="parent">The parent build component</param> /// <param name="sourceIndex">The source index</param> /// <param name="keyXPath">The key XPath expression</param> /// <param name="sourceXPath">The source XPath expression</param> /// <param name="targetXPath">The target XPath expression</param> /// <param name="isAttribute">True if the targets are to be added as attributes, false if they are to be /// added as elements</param> /// <param name="ignoreCase">True to ignore case on the keys when retrieving index values</param> public CopyFromIndexCommand(BuildComponentCore parent, IndexedCache sourceIndex, string keyXPath, string sourceXPath, string targetXPath, bool isAttribute, bool ignoreCase) : base(parent, sourceXPath, targetXPath) { this.SourceIndex = sourceIndex; this.Key = XPathExpression.Compile(keyXPath); this.IsAttribute = isAttribute; this.IgnoreCase = ignoreCase; }
//===================================================================== /// <inheritdoc /> public override void Initialize(XPathNavigator configuration, IDictionary<string, object> data) { // Get the copy command XPathNavigator copyNode = configuration.SelectSingleNode("copy"); if(copyNode == null) base.ParentBuildComponent.WriteMessage(MessageLevel.Error, "A copy element is required to " + "define the indexes from which to obtain comments and reflection information"); // Get the comments info string sourceName = copyNode.GetAttribute("name", string.Empty); if(String.IsNullOrEmpty(sourceName)) base.ParentBuildComponent.WriteMessage(MessageLevel.Error, "Each copy command must specify " + "an index to copy from"); // Get the reflection info string reflectionName = copyNode.GetAttribute("use", String.Empty); if(String.IsNullOrEmpty(reflectionName)) base.ParentBuildComponent.WriteMessage(MessageLevel.Error, "Each copy command must specify " + "an index to get reflection information from"); this.commentsIndex = (IndexedCache)data[sourceName]; this.reflectionIndex = (IndexedCache)data[reflectionName]; }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="cache">The cache with which this indexed document is associated</param> /// <param name="file">The file to index</param> public IndexedDocument(IndexedCache cache, string file) { foreach(var kv in cache.GetValues(file)) index[kv.Key] = kv.Value; }