public SnippetItem(BuildDirectoryPath source) : this() { BuildExceptions.NotNull(source, "source"); _source = source; }
protected override void OnWriteXml(XmlWriter writer) { BuildFilePath.WriteLocation(_compilerFile, "compilerFile", writer); BuildDirectoryPath.WriteLocation(_compilerDir, "compilerDirectory", writer); writer.WriteStartElement("plugin"); // start - plugin writer.WriteAttributeString("flatToc", _pluginTocFlat.ToString()); writer.WriteTextElement("title", _pluginTitle); writer.WriteStartElement("parents"); // start - parents if (_pluginParents != null && _pluginParents.Count != 0) { for (int i = 0; i < _pluginParents.Count; i++) { writer.WriteTextElement("parent", _pluginParents[i]); } } writer.WriteEndElement(); // end - parents writer.WriteStartElement("children"); // start - children if (_pluginChildren != null && _pluginChildren.Count != 0) { for (int i = 0; i < _pluginChildren.Count; i++) { writer.WriteTextElement("child", _pluginChildren[i]); } } writer.WriteEndElement(); // end - children writer.WriteEndElement(); // end - plugin }
public FormatHxs(FormatHxs source) : base(source) { _keepSources = source._keepSources; _separateIndex = source._separateIndex; _includeStopWords = source._includeStopWords; _compilerFile = source._compilerFile; _compilerDir = source._compilerDir; _helpTitleId = source._helpTitleId; // Plugin properties... _pluginTocFlat = source._pluginTocFlat; _pluginTitle = source._pluginTitle; _pluginParents = source._pluginParents; _pluginChildren = source._pluginChildren; // Named Url Properties... _homePage = source._homePage; _defaultPage = source._defaultPage; _navFailPage = source._navFailPage; _aboutPageInfo = source._aboutPageInfo; _aboutPageIcon = source._aboutPageIcon; _filterEditPage = source._filterEditPage; _helpPage = source._helpPage; _supportPage = source._supportPage; _sampleDirPage = source._sampleDirPage; _searchHelpPage = source._searchHelpPage; }
/// <summary> /// This writes the current state or attributes of this object, /// in the <c>XML</c> format, to the media or storage accessible by the given writer. /// </summary> /// <param name="writer"> /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state /// is written. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void WriteXml(XmlWriter writer) { BuildExceptions.NotNull(writer, "writer"); writer.WriteStartElement(TagName); // start - TagName writer.WriteAttributeString("name", ConfigurationName); // Write the general properties writer.WriteStartElement("propertyGroup"); // start - propertyGroup; writer.WriteAttributeString("name", "General"); writer.WritePropertyElement("Enabled", this.Enabled); writer.WriteEndElement(); // end - propertyGroup BuildDirectoryPath.WriteLocation(_workingDir, "workingDirectory", writer); // Write out the expressions writer.WriteStartElement("expressions"); // start - expressions WriteExpression(writer, "Root", _rootExpression); WriteExpression(writer, "Assembly", _assemblyExpression); WriteExpression(writer, "Summary", _summaryExpression); WriteExpression(writer, "Parameters", _parametersExpression); WriteExpression(writer, "ParameterContent", _parameterContentExpression); WriteExpression(writer, "Templates", _templatesExpression); WriteExpression(writer, "TemplateContent", _templateContentExpression); WriteExpression(writer, "Returns", _returnsExpression); WriteExpression(writer, "Exception", _exceptionExpression); WriteExpression(writer, "ExceptionCref", _exceptionCrefExpression); WriteExpression(writer, "Enumeration", _enumerationExpression); WriteExpression(writer, "EnumerationApi", _enumerationApiExpression); WriteExpression(writer, "MemberSummary", _memberSummaryExpression); writer.WriteEndElement(); // end - expressions writer.WriteEndElement(); // end - TagName }
public SnippetItem(string source) : this() { BuildExceptions.PathMustExist(source, "source"); _source = new BuildDirectoryPath(source); }
private void ReadContents(XmlReader reader) { // Read the version information of the file format... string nodeText = reader.GetAttribute("version"); if (!String.IsNullOrEmpty(nodeText)) { _contentVersion = new Version(nodeText); } XmlNodeType nodeType = XmlNodeType.None; string nodeName = null; while (reader.Read()) { nodeType = reader.NodeType; if (nodeType == XmlNodeType.Element) { nodeName = reader.Name; if (String.Equals(nodeName, "location", StringComparison.OrdinalIgnoreCase)) { if (!reader.IsEmptyElement) { _contentDir = BuildDirectoryPath.ReadLocation(reader); } } else if (String.Equals(nodeName, "propertyGroup", StringComparison.OrdinalIgnoreCase)) { this.ReadPropertyGroup(reader); } else if (String.Equals(nodeName, "categories", StringComparison.OrdinalIgnoreCase)) { this.ReadCategories(reader); } else if (String.Equals(nodeName, "topics", StringComparison.OrdinalIgnoreCase)) { this.ReadTopics(reader); } else if (String.Equals(nodeName, "relatedTopics", StringComparison.OrdinalIgnoreCase)) { this.ReadRelatedTopics(reader); } } else if (nodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName)) { break; } } } }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceDirectorySource"/> class /// with parameters copied from the specified instance of the /// <see cref="ReferenceDirectorySource"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ReferenceDirectorySource"/> class from which the /// initialization parameters or values will be copied. /// </param> /// <exception cref="ArgumentNullException"> /// If the parameter <paramref name="source"/> is <see langword="null"/>. /// </exception> public ReferenceDirectorySource(ReferenceDirectorySource source) : base(source) { _excludeSet = source._excludeSet; _sourcePath = source._sourcePath; _isRecursive = source._isRecursive; _searchPattern = source._searchPattern; _frameworkType = source._frameworkType; }
public SnippetItem(string source, string itemId) : this() { BuildExceptions.PathMustExist(source, "source"); if (!String.IsNullOrEmpty(itemId)) { _itemId = itemId; } _source = new BuildDirectoryPath(source); }
public void AddDirectory(BuildDirectoryPath path) { BuildExceptions.NotNull(path, "path"); if (_paths == null) { _paths = new BuildList <BuildDirectoryPath>(); } _paths.Add(path); }
public SnippetItem(BuildDirectoryPath source, string itemId) : this() { BuildExceptions.NotNull(source, "source"); if (!String.IsNullOrEmpty(itemId)) { _itemId = itemId; } _source = source; }
public void Load(BuildPathResolver resolver) { BuildExceptions.NotNull(resolver, "resolver"); if (_isLoaded) { return; } if (String.IsNullOrEmpty(_contentFile) || File.Exists(_contentFile) == false) { return; } if (_contentDir == null) { _contentDir = new BuildDirectoryPath( Path.GetDirectoryName(_contentFile)); } XmlReader reader = null; try { XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; settings.IgnoreWhitespace = true; settings.IgnoreProcessingInstructions = true; reader = XmlReader.Create(_contentFile, settings); reader.MoveToContent(); string resolverId = BuildPathResolver.Push(resolver); { this.ReadXml(reader); BuildPathResolver.Pop(resolverId); } _isLoaded = true; this.Modified = false; } finally { if (reader != null) { reader.Close(); reader = null; } } }
public ResourceItem(string source, string destination) { if (!String.IsNullOrEmpty(source)) { _source = new BuildDirectoryPath(source); } if (!String.IsNullOrEmpty(destination)) { _destination = new BuildDirectoryPath(destination); } }
public ConceptualContent(string contentFile, string contentDir) : this() { BuildExceptions.PathMustExist(contentFile, "contentFile"); if (String.IsNullOrEmpty(contentDir)) { contentDir = Path.GetDirectoryName(contentFile); } _contentFile = new BuildFilePath(contentFile); _contentDir = new BuildDirectoryPath(contentDir); }
public MediaContent(MediaContent source) : base(source) { _isLoaded = source._isLoaded; _contentId = source._contentId; _contentDir = source._contentDir; _contentFile = source._contentFile; _outputPath = source._outputPath; _outputLink = source._outputLink; _outputBase = source._outputBase; _dicItems = source._dicItems; _contentVersion = source._contentVersion; }
/// <summary> /// This writes the current state or attributes of this object, /// in the <c>XML</c> format, to the media or storage accessible by the given writer. /// </summary> /// <param name="writer"> /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state /// is written. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void WriteXml(XmlWriter writer) { BuildExceptions.NotNull(writer, "writer"); if (this.IsEmpty) { return; } writer.WriteStartElement(TagName); // start - attribute BuildDirectoryPath.WriteLocation(_source, "source", writer); BuildDirectoryPath.WriteLocation(_destination, "destination", writer); writer.WriteEndElement(); // end - attribute }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { Debug.Assert(false, String.Format( "The element name '{0}' does not match the expected '{1}'.", reader.Name, TagName)); return; } if (reader.IsEmptyElement) { return; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name.ToLower()) { case "source": _source = BuildDirectoryPath.ReadLocation(reader); break; case "destination": _destination = BuildDirectoryPath.ReadLocation(reader); break; } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
public ReferenceContent(ReferenceContent source) : base(source) { _isLoaded = source._isLoaded; _contentId = source._contentId; _contentVersion = source._contentVersion; _contentFile = source._contentFile; _contentDir = source._contentDir; _frameworkType = source._frameworkType; _tocContent = source._tocContent; _dependencies = source._dependencies; _commentContent = source._commentContent; _typeFilters = source._typeFilters; _attributeFilters = source._attributeFilters; }
public ConceptualContent(ConceptualContent source) : base(source) { _isLoaded = source._isLoaded; _documentExists = source._documentExists; _companionFiles = source._companionFiles; _defaultTopic = source._defaultTopic; _contentVersion = source._contentVersion; _contentFile = source._contentFile; _contentDir = source._contentDir; _categories = source._categories; _listFilters = source._listFilters; _relatedTopics = source._relatedTopics; _dicItems = source._dicItems; _contentId = source._contentId; _hasFilter = source._hasFilter; }
public void Save() { if (String.IsNullOrEmpty(_contentFile)) { return; } if (_contentDir == null) { _contentDir = new BuildDirectoryPath( Path.GetDirectoryName(_contentFile)); } BuildPathResolver resolver = BuildPathResolver.Create( Path.GetDirectoryName(_contentFile), _contentId); this.Save(resolver); }
/// <summary> /// This writes the current state or attributes of this object, /// in the <c>XML</c> format, to the media or storage accessible by the given writer. /// </summary> /// <param name="writer"> /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state /// is written. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void WriteXml(XmlWriter writer) { BuildExceptions.NotNull(writer, "writer"); writer.WriteStartElement(TagName); // start - TagName writer.WriteAttributeString("name", ConfigurationName); // Write the general properties writer.WriteStartElement("propertyGroup"); // start - propertyGroup; writer.WriteAttributeString("name", "General"); writer.WritePropertyElement("Enabled", this.Enabled); writer.WriteEndElement(); // end - propertyGroup BuildDirectoryPath.WriteLocation(_workingDir, "workingDirectory", writer); writer.WriteEndElement(); // end - TagName }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { return; } _itemId = reader.GetAttribute("id"); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, BuildFilePath.TagName, StringComparison.OrdinalIgnoreCase)) { if (_source == null) { _source = new BuildDirectoryPath(); } _source.ReadXml(reader); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
/// <summary> /// Initializes a new instance of the <see cref="ConceptualIntelliSenseConfiguration"/> class /// with parameters copied from the specified instance of the /// <see cref="ConceptualIntelliSenseConfiguration"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ConceptualIntelliSenseConfiguration"/> class from which the /// initialization parameters or values will be copied. /// </param> /// <exception cref="ArgumentNullException"> /// If the parameter <paramref name="source"/> is <see langword="null"/>. /// </exception> public ConceptualIntelliSenseConfiguration( ConceptualIntelliSenseConfiguration source) : base(source) { _outputDir = source._outputDir; _workingDir = source._workingDir; _rootExpression = source._rootExpression; _assemblyExpression = source._assemblyExpression; _summaryExpression = source._summaryExpression; _parametersExpression = source._parametersExpression; _parameterContentExpression = source._parameterContentExpression; _templatesExpression = source._templatesExpression; _templateContentExpression = source._templateContentExpression; _returnsExpression = source._returnsExpression; _exceptionExpression = source._exceptionExpression; _exceptionCrefExpression = source._exceptionCrefExpression; _enumerationExpression = source._enumerationExpression; _enumerationApiExpression = source._enumerationApiExpression; _memberSummaryExpression = source._memberSummaryExpression; }
public override void Deployment(BuildLogger logger, BuildDirectoryPath sourcePath) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceIntelliSenseConfiguration"/> class /// with parameters copied from the specified instance of the /// <see cref="ReferenceIntelliSenseConfiguration"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ReferenceIntelliSenseConfiguration"/> class from which the /// initialization parameters or values will be copied. /// </param> /// <exception cref="ArgumentNullException"> /// If the parameter <paramref name="source"/> is <see langword="null"/>. /// </exception> public ReferenceIntelliSenseConfiguration(ReferenceIntelliSenseConfiguration source) : base(source) { _outputDir = source._outputDir; _workingDir = source._workingDir; }
public void Load(BuildPathResolver resolver) { BuildExceptions.NotNull(resolver, "resolver"); if (_isLoaded) { return; } if (String.IsNullOrEmpty(_contentFile) || File.Exists(_contentFile) == false) { return; } if (_contentDir == null) { _contentDir = new BuildDirectoryPath( Path.GetDirectoryName(_contentFile)); } _hasFilter = false; if (_listFilters != null && _listFilters.Count != 0) { int itemCount = _listFilters.Count; for (int i = 0; i < itemCount; i++) { ConceptualFilter filter = _listFilters[i]; if (filter != null && filter.IsValid && filter.Enabled) { _hasFilter = true; break; } } } XmlReader reader = null; try { XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; settings.IgnoreWhitespace = true; settings.IgnoreProcessingInstructions = true; reader = XmlReader.Create(_contentFile, settings); reader.MoveToContent(); string resolverId = BuildPathResolver.Push(resolver); { this.ReadXml(reader); BuildPathResolver.Pop(resolverId); } if (String.IsNullOrEmpty(_defaultTopic)) { // If not set, use the first topic... if (this.Count != 0) { _defaultTopic = this[0].TopicId; } } _isLoaded = true; this.Modified = false; } finally { if (reader != null) { reader.Close(); reader = null; } } }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { Debug.Assert(false, String.Format( "The element name '{0}' does not match the expected '{1}'.", reader.Name, TagName)); return; } string tempText = reader.GetAttribute("name"); if (String.IsNullOrEmpty(tempText) || !String.Equals(tempText, ConfigurationName, StringComparison.OrdinalIgnoreCase)) { throw new BuildException(String.Format( "ReadXml: The current name '{0}' does not match the expected name '{1}'.", tempText, ConfigurationName)); } if (reader.IsEmptyElement) { return; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, "property", StringComparison.OrdinalIgnoreCase)) { switch (reader.GetAttribute("name").ToLower()) { case "enabled": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { this.Enabled = Convert.ToBoolean(tempText); } break; default: // Should normally not reach here... throw new NotImplementedException(reader.GetAttribute("name")); } } else if (String.Equals(reader.Name, "expression", StringComparison.OrdinalIgnoreCase)) { switch (reader.GetAttribute("name").ToLower()) { case "root": _rootExpression = reader.ReadString(); break; case "assembly": _assemblyExpression = reader.ReadString(); break; case "summary": _summaryExpression = reader.ReadString(); break; case "parameters": _parametersExpression = reader.ReadString(); break; case "parametercontent": _parameterContentExpression = reader.ReadString(); break; case "templates": _templatesExpression = reader.ReadString(); break; case "templatecontent": _templateContentExpression = reader.ReadString(); break; case "returns": _returnsExpression = reader.ReadString(); break; case "exception": _exceptionExpression = reader.ReadString(); break; case "exceptioncref": _exceptionCrefExpression = reader.ReadString(); break; case "enumeration": _enumerationExpression = reader.ReadString(); break; case "enumerationapi": _enumerationApiExpression = reader.ReadString(); break; case "membersummary": _memberSummaryExpression = reader.ReadString(); break; default: // Should normally not reach here... throw new NotImplementedException(reader.GetAttribute("name")); } } else if (String.Equals(reader.Name, "workingDirectory", StringComparison.OrdinalIgnoreCase)) { _workingDir = BuildDirectoryPath.ReadLocation(reader); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { Debug.Assert(false, String.Format( "The element name '{0}' does not match the expected '{1}'.", reader.Name, TagName)); return; } if (reader.IsEmptyElement) { return; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, "propertyGroup", StringComparison.OrdinalIgnoreCase)) { this.ReadPropertyGroup(reader); } else if (String.Equals(reader.Name, "location", StringComparison.OrdinalIgnoreCase)) { _sourcePath = BuildDirectoryPath.ReadLocation(reader); } else if (String.Equals(reader.Name, "excludes", StringComparison.OrdinalIgnoreCase)) { this.ReadExcludes(reader); } else if (String.Equals(reader.Name, "contents", StringComparison.OrdinalIgnoreCase)) { this.ReadContents(reader); } else if (String.Equals(reader.Name, "filters", StringComparison.OrdinalIgnoreCase)) { this.ReadFilters(reader); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
private void ResolveDependency(ReferenceGroupContext sourceContext, ReferenceContent referenceContent) { BuildContext context = this.Context; BuildLogger logger = context.Logger; BuildFramework framework = sourceContext.Framework; if (framework == null) { throw new BuildException("No valid framework is specified."); } DependencyContent dependencies = referenceContent.Dependencies; _resolveContent = new DependencyContent(); _listReference = new List <ReferenceItem>(); _dictionary = new Dictionary <string, bool>( StringComparer.OrdinalIgnoreCase); _dictDependency = new Dictionary <string, bool>( StringComparer.OrdinalIgnoreCase); _dictReference = new Dictionary <string, bool>( StringComparer.OrdinalIgnoreCase); if (dependencies != null && dependencies.Count != 0) { for (int i = 0; i < dependencies.Count; i++) { DependencyItem depItem = dependencies[i]; if (!depItem.IsEmpty) { _dictDependency[depItem.Location] = true; } } } // Index the reference items to prevent cross referencing... if (referenceContent != null && referenceContent.Count != 0) { for (int i = 0; i < referenceContent.Count; i++) { ReferenceItem refItem = referenceContent[i]; if (!refItem.IsEmpty && !refItem.IsCommentOnly) { string refAssembly = refItem.Assembly; if (!_dictReference.ContainsKey(refAssembly)) { _dictReference[refAssembly] = true; _listReference.Add(refItem); } } } } GeneralAssemblyResolver resolver = new GeneralAssemblyResolver(); // Add the reference item directories, the most likely place to // find the dependencies for (int i = 0; i < _listReference.Count; i++) { resolver.AddSearchDirectory( Path.GetDirectoryName(_listReference[i].Assembly)); } // Add specified dependency directories, if any... IList <BuildDirectoryPath> dependencyPaths = dependencies.Paths; if (dependencyPaths != null && dependencyPaths.Count != 0) { for (int i = 0; i < dependencyPaths.Count; i++) { BuildDirectoryPath dependencyPath = dependencyPaths[i]; if (dependencyPath.Exists) { resolver.AddSearchDirectory(dependencyPath); } } } Version version = framework.Version; // Add, for the Silverlight, known installation directories... BuildFrameworkKind frameworkKind = framework.FrameworkType.Kind; if (frameworkKind == BuildFrameworkKind.Silverlight) { resolver.UseGac = false; string programFiles = PathUtils.ProgramFiles32; string searchDir = Path.Combine(programFiles, @"Microsoft Silverlight\" + version.ToString()); if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); } searchDir = Path.Combine(programFiles, @"Reference Assemblies\Microsoft\Framework\Silverlight\v" + version.ToString(2)); if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); } else { if (version.Major == 5 && version.Minor > 0) { // For Silverlight 5.1, the assemblies are in different places... searchDir = Path.Combine(programFiles, @"Reference Assemblies\Microsoft\Framework\Silverlight\v5.0"); if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); } } } searchDir = Path.Combine(programFiles, @"Microsoft SDKs\Silverlight\v" + version.ToString(2)); if (!Directory.Exists(searchDir)) { if (version.Major == 5 && version.Minor > 0) { // For Silverlight 5.1, the assemblies are in different places... searchDir = Path.Combine(programFiles, @"Microsoft SDKs\Silverlight\v5.0"); } } if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); string tempDir = String.Copy(searchDir); searchDir = Path.Combine(tempDir, @"Libraries\Client"); if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); } searchDir = Path.Combine(tempDir, @"Libraries\Server"); if (Directory.Exists(searchDir)) { resolver.AddSearchDirectory(searchDir); } } if (version.Major == 3) { // 3. The Expression 3.0 Blend SDK... string otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend 3\Interactivity\Libraries\Silverlight"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend 3\Prototyping\Libraries\Silverlight"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } else if (version.Major == 4) { // Consider the extension libraries... // 1. The RIA Services... string otherDir = Path.Combine(programFiles, @"Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } // 2. For the Silverlight Toolkit... otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Silverlight\v4.0\Toolkit"); if (Directory.Exists(otherDir)) { // Get the latest installed version... string[] dirs = Directory.GetDirectories(otherDir); if (dirs != null && dirs.Length != 0) { string dir = String.Empty; DateTime latestDt = DateTime.MinValue; for (int j = 0; j < dirs.Length; j++) { string latestDir = Path.GetFileName(dirs[j]); DateTime dt; if (DateTime.TryParse(latestDir, out dt)) { if (dt > latestDt) { latestDt = dt; dir = latestDir; } } } otherDir = Path.Combine(otherDir, dir + @"\Bin"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } } // 3. The Expression 4.0 Blend SDK... otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } else if (version.Major == 5) { // Consider the extension libraries... // 1. The RIA Services... string otherDir = Path.Combine(programFiles, @"Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } // 2. For the Silverlight Toolkit... otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Silverlight\v5.0\Toolkit"); if (Directory.Exists(otherDir)) { // Get the latest installed version... string[] dirs = Directory.GetDirectories(otherDir); if (dirs != null && dirs.Length != 0) { string dir = String.Empty; DateTime latestDt = DateTime.MinValue; for (int j = 0; j < dirs.Length; j++) { string latestDir = Path.GetFileName(dirs[j]); DateTime dt; if (DateTime.TryParse(latestDir, out dt)) { if (dt > latestDt) { latestDt = dt; dir = latestDir; } } } otherDir = Path.Combine(otherDir, dir + @"\Bin"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } } // 3. The Expression 5.0 Blend SDK... otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend\Silverlight\v5.0\Libraries"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } } else if (frameworkKind == BuildFrameworkKind.Portable) { resolver.UseGac = false; resolver.AddSearchDirectory(framework.AssemblyDir); } else if (frameworkKind == BuildFrameworkKind.ScriptSharp) { resolver.UseGac = false; resolver.AddSearchDirectory(framework.AssemblyDir); } else if (frameworkKind == BuildFrameworkKind.Compact) { resolver.UseGac = false; resolver.AddSearchDirectory(framework.AssemblyDir); } else if (frameworkKind == BuildFrameworkKind.DotNet) { string programFiles = Environment.GetFolderPath( Environment.SpecialFolder.ProgramFiles); if (version.Major == 3) { // 3. The Expression 3.0 Blend SDK... string otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend 3\Interactivity\Libraries\.NETFramework"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } else if (version.Major == 4) { string otherDir = Path.Combine(programFiles, @"Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries"); if (Directory.Exists(otherDir)) { resolver.AddSearchDirectory(otherDir); } } } else { throw new NotSupportedException(String.Format( "The framework kind '{0}' is not supported.", frameworkKind.ToString())); } // Finally, we look inside the binding sources if we are dealing // with link sources... if (sourceContext.IsLinkGroup || sourceContext.IsEmbeddedGroup) { IList <string> bindingSources = sourceContext.BindingSources; if (bindingSources != null && bindingSources.Count != 0) { foreach (string bindingSource in bindingSources) { if (!String.IsNullOrEmpty(bindingSource) && Directory.Exists(bindingSource)) { resolver.AddSearchDirectory(bindingSource); } } } } for (int i = 0; i < _listReference.Count; i++) { ReferenceItem refItem = _listReference[i]; AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly( refItem.Assembly); ModuleDefinition modDef = asmDef.MainModule; // Try resolving all the dependencies... if (modDef.HasAssemblyReferences) { IList <AssemblyNameReference> asmRefs = modDef.AssemblyReferences; if (asmRefs != null && asmRefs.Count != 0) { for (int j = 0; j < asmRefs.Count; j++) { this.Resolve(logger, asmRefs[j], resolver, frameworkKind); } } } // Try resolving all the XmlnsDefinitionAttribute attributes... if (asmDef.HasCustomAttributes && refItem.XamlSyntax) { this.ResolveXmlnsDefinitions(sourceContext, asmDef, modDef.Name); } } string[] searchDirs = resolver.GetSearchDirectories(); if (searchDirs != null && searchDirs.Length != 0) { if (_searchDirectories == null) { _searchDirectories = new HashSet <string>(StringComparer.OrdinalIgnoreCase); } for (int i = 0; i < searchDirs.Length; i++) { string searchDir = Path.GetFullPath(String.Copy(searchDirs[i])); if (!searchDir.EndsWith("\\")) { searchDir += "\\"; } _searchDirectories.Add(searchDir); } } }
public SnippetItem(SnippetItem source) : base(source) { _itemId = source._itemId; _source = source._source; }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { Debug.Assert(false, String.Format( "The element name '{0}' does not match the expected '{1}'.", reader.Name, TagName)); return; } if (reader.IsEmptyElement) { return; } this.Clear(); if (_paths == null) { _paths = new BuildList <BuildDirectoryPath>(); } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, "paths", StringComparison.OrdinalIgnoreCase) && !reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, BuildDirectoryPath.TagName, StringComparison.OrdinalIgnoreCase)) { BuildDirectoryPath path = new BuildDirectoryPath(); path.ReadXml(reader); this.AddDirectory(path); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, "paths", StringComparison.OrdinalIgnoreCase)) { break; } } } } else if (String.Equals(reader.Name, "items", StringComparison.OrdinalIgnoreCase) && !reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, DependencyItem.TagName, StringComparison.OrdinalIgnoreCase)) { DependencyItem item = new DependencyItem(); item.Content = this; item.ReadXml(reader); this.Add(item); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, "items", StringComparison.OrdinalIgnoreCase)) { break; } } } } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }