// Finally save the file as compressed value public void Save(string fileName) { if (m_notCompressed != null) { m_notCompressed.Flush(); m_notCompressed.Close(); m_notCompressed = null; } if (System.IO.File.Exists(fileName)) { System.IO.File.Delete(fileName); } System.IO.File.Move(m_tempFileName, fileName); MyCompression.CompressFile(fileName); }
// Finally save the file as compressed value public void Save(out byte[] compressedBytes) { if (m_notCompressed != null) { m_notCompressed.Flush(); m_notCompressed.Close(); m_notCompressed = null; } MyCompression.CompressFile(m_tempFileName); using (FileStream fs = File.OpenRead(m_tempFileName)) { long length = fs.Length; compressedBytes = new byte[length]; using (BinaryReader br = new BinaryReader(fs)) { br.Read(compressedBytes, 0, (int)length); } } }
// Finally save the file as compressed value public static void SaveFile(string fileName) { // Compress byte array MyCompression.CompressFile(fileName); }