public UpdateBatch(XmlProfileStore store) { _store = store; _document = new XmlDocument(); if (store._filename != null) { _document.Load(store._filename); } else { if (!store._stream.CanWrite) { throw new InvalidOperationException("Stream cannot be written to."); } if (!store._stream.CanSeek) { throw new InvalidOperationException("Stream cannot seek."); } store._stream.Seek(0, SeekOrigin.Begin); _document.Load(store._stream); store._stream.Seek(0, SeekOrigin.Begin); } }
protected ProfileNode(XmlProfileStore store, ProfileNode parent, string child) : base(parent, child) { _store = store; }
public ProfileNode(XmlProfileStore store, ProfilePath path) : base(path) { _store = store; }
public UpdateBatch(XmlProfileStore store) { _store = store; _document = new XmlDocument(); if ( store._filename != null ) _document.Load(store._filename); else { if ( !store._stream.CanWrite ) throw new InvalidOperationException("Stream cannot be written to."); if ( !store._stream.CanSeek ) throw new InvalidOperationException("Stream cannot seek."); store._stream.Seek(0, SeekOrigin.Begin); _document.Load(store._stream); store._stream.Seek(0, SeekOrigin.Begin); } }
protected ProfileNode(XmlProfileStore store, ProfileNode parent, string child) : base(parent, child) { _store = store; }
public ProfileNode(XmlProfileStore store, ProfilePath path) : base(path) { _store = store; }
public void UnderwriteStream() { string xml = "<root><A><B><C value=\"1234567890\" /></B></A></root>"; byte[] bytes = System.Text.Encoding.ASCII.GetBytes(xml); System.IO.Stream stream = new System.IO.MemoryStream(); stream.Write(bytes, 0, bytes.Length); XmlProfileStore store = new XmlProfileStore(stream); IProfile root = store["/"]; root["A/B/C"].Value = "5"; store.Flush(); stream.Seek(0, SeekOrigin.Begin); StreamReader reader = new StreamReader(stream); string newxml = reader.ReadToEnd(); reader.Close(); Assert.AreNotEqual(newxml, xml); System.Xml.XmlDocument doc = new XmlDocument(); doc.LoadXml(newxml); AssertXml.Matches("<root><A><B><C value=\"5\" /></B></A></root>", doc.DocumentElement); }