public void Save(PackFileContainer pf, string path, bool createBackup) { if (pf.IsCaPackFile) { throw new Exception("Can not save ca pack file"); } if (createBackup) { SaveHelper.CreateFileBackup(path); } pf.SystemFilePath = path; using (MemoryStream memoryStream = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(memoryStream)) Save(pf, writer); File.WriteAllBytes(path, memoryStream.ToArray()); pf.UpdateAllDataSourcesAfterSave(); } }