Exemplo n.º 1
0
        public void AlgorithmsTest()
        {
            LZWCompressor.Compress(_inputFilePath, _archivedFilePath);
            HuffmanDeCompressor.DeCompress(_archivedFilePath, _outputFilePath);
            CompareFiles();

            HuffmanTestWithDifferentFilesLength(25);
        }
Exemplo n.º 2
0
        private void AlgorithmsCompressDecompressWithLength(int count)
        {
            var str                   = CreateStringWithLength(count);
            var newFileLocation       = Data.Location + count;
            var newOutputFileLocation = newFileLocation + "out";

            File.WriteAllText(Data.Location + count, str);

            LZWCompressor.Compress(newFileLocation, _archivedFilePath);
            HuffmanDeCompressor.DeCompress(_archivedFilePath, newOutputFileLocation);
            CompareFiles(newFileLocation, newOutputFileLocation);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            //string inputFilePath = "";
            //string archivedFilePath = "";
            //switch (args.Length)
            //{
            //    case 2:
            //        inputFilePath = args[0];
            //        archivedFilePath = args[1];
            //        break;
            //    case 4:
            //        switch (args[0])
            //        {
            //            case "-i":
            //                inputFilePath = args[1];
            //                archivedFilePath = args[3];
            //                break;
            //            case "-o":
            //                archivedFilePath = args[1];
            //                inputFilePath = args[3];
            //                break;
            //            default:
            //                ThrowWrongInput();
            //                return;
            //        }
            //        break;
            //    default:
            //        ThrowWrongInput();
            //        return;
            //}

            var stopWatch = new Stopwatch();

            stopWatch.Start();
            HuffmanDeCompressor.DeCompress(Data.ArchivedFilePath, Data.OutputFilePath);
            stopWatch.Stop();
            Console.WriteLine(stopWatch.ElapsedMilliseconds);

            //stopWatch.Start();
            //LZWDeCompressor.DeCompress(Data.Location + "archived.txt", Data.Location + "deCompressed.txt");
            //stopWatch.Stop();
            //Console.WriteLine(stopWatch.ElapsedMilliseconds);
        }