コード例 #1
0
        public void FullTest() //test compression and decompression
        {
            string       line             = "GEM8-GEU8,F,A,0,60303042,60303042,-0.14,1156AH8,F,B,0,60306043,60306043,90.51,106AH8,F,A,0,60306043,60306043,90.57,106AH8,F,B,0,60306092,60306092,90.52,106AM8,F,B,0,60306131,60306131,89.35,16AM8,F,A,0,60306131,60306131,89.5,3GEZ9-GEM0,F,B,0,60306436,60306436,0.415,175";
            string       originalFileName = "originalTestFile";
            string       outFileName      = originalFileName + ".lzw";
            string       inflatedName     = originalFileName + ".inflated";
            StreamWriter writer           = new StreamWriter(File.Create(originalFileName));

            writer.WriteLine(line);
            writer.Close();


            PbvCompressorLZW target          = new PbvCompressorLZW(); // TODO: Initialize to an appropriate value
            string           pInputFileName  = originalFileName;
            string           pOutputFileName = outFileName;
            bool             expected        = true; // TODO: Initialize to an appropriate value
            bool             actual;

            if (actual = (target.Compress(originalFileName, outFileName) &&
                          target.Decompress(outFileName, inflatedName)))
            {
                if (!File.Exists(pOutputFileName))
                {
                    actual = false;
                }
                else
                {
                    StreamReader reader = new StreamReader(File.OpenRead(inflatedName));
                    actual = line.Equals(reader.ReadToEnd().TrimEnd());
                    reader.Close();
                }
            }

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        //public PbvCompressor()
        //{
        //    // setting this by default but we could create a facotry class to let us set the algorithm based on arguments passed to the main method
        //    // IE. "Compress.exe zip -c blah.txt" would use the zip algorithm as opposed to the default one.
        //    CompressorAlgorithm = new PbvCompressorLZW();
        //}

        static void Main(string[] args)
        {
            StartScreen();
            UltimaScreen();
            FireScreen();

            PbvCompressorLZW lzw = new PbvCompressorLZW();

            lzw.Decompress("C:\\games\\ultima_5\\temp\\ultima.16", "C:\\games\\ultima_5\\temp\\dec_res\\ultima.16.uncomp2");
        }