IOWriteResult Write_G3Mesh(string sFilename, List <WriteMesh> vMeshes, WriteOptions options) { FileStream file_stream = File.Open(sFilename, FileMode.Create); BinaryWriter w = new BinaryWriter(file_stream); if (w.BaseStream == null) { return(new IOWriteResult(IOCode.FileAccessError, "Could not open file " + sFilename + " for writing")); } BinaryG3Writer writer = new BinaryG3Writer(); var result = writer.Write(w, vMeshes, options); w.Close(); return(result); }
IOWriteResult Write_G3Mesh(string sFilename, List <WriteMesh> vMeshes, WriteOptions options) { Stream stream = OpenStreamF(sFilename); if (stream == null) { return(new IOWriteResult(IOCode.FileAccessError, "Could not open file " + sFilename + " for writing")); } try { BinaryWriter w = new BinaryWriter(stream); BinaryG3Writer writer = new BinaryG3Writer(); var result = writer.Write(w, vMeshes, options); w.Flush(); return(result); } finally { CloseStreamF(stream); } }