Example #1
0
        /// <summary>
        /// Saves the document at the given URI</summary>
        /// <param name="document">Document to save</param>
        /// <param name="uri">New document URI</param>
        public void Save(IDocument document, Uri uri)
        {
            CircuitDocument circuitDocument = (CircuitDocument)document;
            string          filePath        = uri.LocalPath;
            FileMode        fileMode        = File.Exists(filePath) ? FileMode.Truncate : FileMode.OpenOrCreate;

            using (FileStream stream = new FileStream(filePath, fileMode))
            {
                var writer = new CircuitWriter(m_schemaLoader.TypeCollection);
                writer.Write(circuitDocument.DomNode, stream, uri);
            }
        }
Example #2
0
 /// <summary>
 /// Saves the document at the given URI</summary>
 /// <param name="document">Document to save</param>
 /// <param name="uri">New document URI</param>
 public void Save(IDocument document, Uri uri)
 {
     CircuitDocument circuitDocument = (CircuitDocument)document;
     string filePath = uri.LocalPath;
     FileMode fileMode = File.Exists(filePath) ? FileMode.Truncate : FileMode.OpenOrCreate;
     using (FileStream stream = new FileStream(filePath, fileMode))
     {
         var writer = new CircuitWriter(m_schemaLoader.TypeCollection);
         writer.Write(circuitDocument.DomNode, stream, uri);
     }
 }