/// <summary> /// Restores this filter from the given xml reader. /// </summary> /// <param name="reader"></param> /// <returns></returns> public bool Restore(XmlReader reader) { var count = reader.AttributeCount; for (var i = 0; i < count; ++i) { reader.MoveToAttribute(i); switch (reader.Name) { case "id": Id = reader.ReadContentAsQuickFilterId(); break; case "type": MatchType = reader.ReadContentAsEnum <FilterMatchType>(); break; case "value": Value = reader.Value; break; case "ignorecase": IgnoreCase = reader.ReadContentAsBool(); break; case "isinclude": IsInverted = reader.ReadContentAsBool(); break; } } if (Id == QuickFilterId.Empty) { return(false); } return(true); }
/// <summary> /// Writes the given id into an attribute with the given name. /// </summary> /// <param name="writer"></param> /// <param name="localName"></param> /// <param name="id"></param> public static void WriteAttribute(this XmlWriter writer, string localName, QuickFilterId id) { writer.WriteAttributeGuid(localName, id.Value); }
/// <summary> /// Initializes this quick filter. /// </summary> public QuickFilterSettings() { Id = QuickFilterId.CreateNew(); IgnoreCase = true; IsInverted = false; }