protected override void SaveAndClose(EditorForm form, TextureFile textureFile, File file) { using (new WaitCursor(form)) { var resourceFile = new ResourceFile(); using (var ms = new MemoryStream(file.GetData())) { resourceFile.Read(ms); } var msSystem = new MemoryStream(resourceFile.SystemMemData); var msGraphics = new MemoryStream(resourceFile.GraphicsMemData); try { textureFile.Save(msSystem, msGraphics); } finally { msSystem.Close(); msGraphics.Close(); } using (var resMS = new MemoryStream()) { resourceFile.Write(resMS); file.SetData(resMS.ToArray()); } } form.Close(); }
protected virtual void SaveAndClose(EditorForm form, TextureFile textureFile, File file) { using (new WaitCursor(form)) { var msSave = new MemoryStream(); try { textureFile.Save(msSave); file.SetData(msSave.ToArray()); } finally { msSave.Close(); } } form.Close(); }