private void Save(XmlWriter writer) { writer.WriteStartDocument(); writer.WriteStartElement("options"); this.SaveOption(writer, "HidePathsRoot", _hidePathsRoot); //this.SaveOption(writer, "WebSuitePath", _webSuitePath); //this.SaveOption(writer, "LocalSuitePath", this.GetPath(_localSuitePath)); this.SaveOption(writer, "SelectedValuePath", _selectedValuePath); if (_wpfSettings != null) { this.SaveOption(writer, "TextAsGeometry", _wpfSettings.TextAsGeometry); this.SaveOption(writer, "IncludeRuntime", _wpfSettings.IncludeRuntime); this.SaveOption(writer, "IgnoreRootViewbox", _wpfSettings.IgnoreRootViewbox); this.SaveOption(writer, "EnsureViewboxSize", _wpfSettings.EnsureViewboxSize); this.SaveOption(writer, "EnsureViewboxPosition", _wpfSettings.EnsureViewboxPosition); } if (_testSuites != null && _testSuites.Count != 0) { var selectedSuite = SvgTestSuite.GetSelected(_testSuites); if (selectedSuite != null) { selectedSuite.LocalSuitePath = _localSuitePath; selectedSuite.WebSuitePath = _webSuitePath; } writer.WriteStartElement("testSuites"); foreach (var testSuite in _testSuites) { testSuite.WriteXml(writer); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); }
private void Load(XmlReader reader) { var comparer = StringComparison.OrdinalIgnoreCase; List <SvgTestSuite> testSuites = new List <SvgTestSuite>(SvgTestSuite.TestSuiteCount); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (string.Equals(reader.Name, "option", comparer)) { string optionName = reader.GetAttribute("name"); string optionType = reader.GetAttribute("type"); if (string.Equals(optionType, "String", comparer)) { string optionValue = reader.ReadElementContentAsString(); switch (optionName) { case "SelectedValuePath": _selectedValuePath = optionValue; break; } } else if (string.Equals(optionType, "Boolean", comparer)) { bool optionValue = reader.ReadElementContentAsBoolean(); switch (optionName) { case "HidePathsRoot": _hidePathsRoot = optionValue; break; case "TextAsGeometry": _wpfSettings.TextAsGeometry = optionValue; break; case "IncludeRuntime": _wpfSettings.IncludeRuntime = optionValue; break; case "IgnoreRootViewbox": _wpfSettings.IgnoreRootViewbox = optionValue; break; case "EnsureViewboxSize": _wpfSettings.EnsureViewboxSize = optionValue; break; case "EnsureViewboxPosition": _wpfSettings.EnsureViewboxPosition = optionValue; break; } } } else if (string.Equals(reader.Name, "testSuite", comparer)) { if (!reader.IsEmptyElement) { SvgTestSuite testSuite = new SvgTestSuite(reader); if (testSuite.IsValid()) { testSuites.Add(testSuite); } } } } } if (testSuites.Count == SvgTestSuite.TestSuiteCount) { var selectedSuite = SvgTestSuite.GetSelected(testSuites); if (selectedSuite != null) { _localSuitePath = selectedSuite.LocalSuitePath; _webSuitePath = selectedSuite.WebSuitePath; _testSuites = testSuites; } } }