Beispiel #1
0
        private void CompressFile(string fileName)
        {
            try
            {
                byte[] uncompressedData = StreamHelper.ReadFile(fileName);
                byte[] compressedData;
                if (this.type11ToolStripMenuItem.Checked)
                {
                    compressedData = CompressionManager.CompressOnz(uncompressedData);
                }
                else
                {
                    compressedData = CompressionManager.CompressLzss(uncompressedData);
                }

                string outFileName = fileName;
                if (!this.overwriteToolStripMenuItem.Checked)
                {
                    outFileName += ".compressed";
                }

                StreamHelper.WriteFile(outFileName, compressedData);
            }
            catch (SystemException exc)
            {
                this.errors.Add(string.Format(CultureInfo.CurrentCulture, "[{0}]: {1}", fileName, exc.Message));
            }
        }