/// <overloads> /// Initializes a new instance of the <see cref="ReferenceCodeConfiguration"/> class. /// </overloads> /// <summary> /// Initializes a new instance of the <see cref="ReferenceCodeConfiguration"/> class /// to the default values. /// </summary> public ReferenceCodeConfiguration() { _tabSize = 4; _showLineNumbers = false; _showOutlining = false; _highlightEnabled = true; _highlightMode = "IndirectIris"; _snippetSeparator = "..."; _snippetStorage = BuildCacheStorageType.Database; }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceCodeConfiguration"/> class /// with parameters copied from the specified instance of the /// <see cref="ReferenceCodeConfiguration"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ReferenceCodeConfiguration"/> 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 ReferenceCodeConfiguration(ReferenceCodeConfiguration source) : base(source) { _tabSize = source._tabSize; _showLineNumbers = source._showLineNumbers; _showOutlining = source._showOutlining; _highlightMode = source._highlightMode; _highlightEnabled = source._highlightEnabled; _snippetStorage = source._snippetStorage; _snippetSeparator = source._snippetSeparator; }
/// <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) && 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; case "tabsize": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _tabSize = Convert.ToInt32(tempText); } break; case "showlinenumbers": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _showLineNumbers = Convert.ToBoolean(tempText); } break; case "showoutlining": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _showOutlining = Convert.ToBoolean(tempText); } break; case "highlightenabled": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _highlightEnabled = Convert.ToBoolean(tempText); } break; case "highlightmode": _highlightMode = reader.ReadString(); break; case "snippetseparator": _snippetSeparator = reader.ReadString(); break; case "snippetstorage": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _snippetStorage = BuildCacheStorageType.Parse(tempText); } break; default: // Should normally not reach here... throw new NotImplementedException(reader.GetAttribute("name")); } } 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; } 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) && 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; case "externallinkcaching": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _cacheLinks = Convert.ToBoolean(tempText); } break; case "externallinkstorage": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _linkStorage = BuildCacheStorageType.Parse(tempText); if (_linkStorage != BuildCacheStorageType.Memory && _linkStorage != BuildCacheStorageType.Database) { // If not one of the valid values, reset it... _linkStorage = BuildCacheStorageType.Database; } } break; default: // Should normally not reach here... throw new NotImplementedException(reader.GetAttribute("name")); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceLinkConfiguration"/> class /// with parameters copied from the specified instance of the /// <see cref="ReferenceLinkConfiguration"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ReferenceLinkConfiguration"/> 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 ReferenceLinkConfiguration(ReferenceLinkConfiguration source) : base(source) { _cacheLinks = source._cacheLinks; _linkStorage = source._linkStorage; }
/// <overloads> /// Initializes a new instance of the <see cref="ReferenceLinkConfiguration"/> class. /// </overloads> /// <summary> /// Initializes a new instance of the <see cref="ReferenceLinkConfiguration"/> class /// to the default values. /// </summary> public ReferenceLinkConfiguration() { _cacheLinks = true; _linkStorage = BuildCacheStorageType.Database; }