public void Save() { #if UNITY_EDITOR var mydocs = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); dxfDocument.Save(Path.Combine(mydocs, "testDXFBinary.dxf"), true); return; #endif using (var stream = new MemoryStream()) { if (dxfDocument.Save(stream)) { JavascriptMethodCaller.DownloadByteArrayAsFile(stream.ToArray(), stream.ToArray().Length, "testfile.dxf"); } else { Debug.Log("cant write file"); } } }
public void Save(string filename = "") { #if UNITY_EDITOR var mydocs = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); File.WriteAllText(Path.Combine(mydocs, (filename != "") ? filename : "ColladaExport.dae"), stringWriter.ToString()); stringWriter = null; writer = null; return; #endif if (stringWriter != null) { byte[] byteArray = Encoding.UTF8.GetBytes(stringWriter.ToString()); stringWriter = null; writer = null; JavascriptMethodCaller.DownloadByteArrayAsFile(byteArray, byteArray.Length, (filename != "") ? filename : "ColladaExport.dae"); } else { Debug.Log("cant write file"); } }