public void SaveToFile() { STLDocument stl = null; STLDocument stlText = null; STLDocument stlBinary = null; string stlTextPath = Path.GetTempFileName(); string stlBinaryPath = Path.GetTempFileName(); using (Stream stream = GetData("ASCII.stl")) stl = STLDocument.Read(stream); stl.SaveAsText(stlTextPath); stlText = STLDocument.Open(stlTextPath); stl.SaveAsBinary(stlBinaryPath); stlBinary = STLDocument.Open(stlBinaryPath); ValidateSTL(stlText); ValidateSTL(stlBinary); try { File.Delete(stlTextPath); } catch { } try { File.Delete(stlBinaryPath); } catch { } }