Exemplo n.º 1
0
        public static void TestGZip()
        {
            string filename = @"D:\Toney\Personal\Git\toneyisnow\HeroesIII\MapLoader\maps\HoMM3 Map Pack by HoMMdb\Shadow of Death & HoMM3 Complete\Andrews Exploits.h3m";

            using (FileStream input = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                using (FileStream output = new FileStream(filename + ".out", FileMode.Create, FileAccess.Write))
                {
                    using (CompressedStreamReader compressedStream = new CompressedStreamReader(input, true))
                    {
                        ulong  bucketSize = 1024;
                        byte[] buffer     = new byte[bucketSize];
                        ulong  readSize   = 0;

                        do
                        {
                            readSize = compressedStream.Read(buffer, bucketSize);
                            if (readSize > 0)
                            {
                                output.Write(buffer, 0, (int)readSize);
                            }
                        }while (readSize > 0);
                    }
                }
            }
        }
Exemplo n.º 2
0
        static void TestZStream()
        {
            ////string filename = @"C:\Users\charl\source\repos\ConsoleApp3\bin\Debug\output\AdvEvent.txt.zip";
            string filename = @"C:\Users\charl\source\repos\ConsoleApp3\bin\Debug\output\Dwelling.txt.zip";

            using (FileStream output = new FileStream(@"D:\Temp\Dwelling.txt", FileMode.Create, FileAccess.Write))
                using (BinaryFileReader reader = new BinaryFileReader(filename))
                {
                    using (CompressedStreamReader compressedStream = new CompressedStreamReader(reader, false, 500000))
                    {
                        ulong  bucketSize = 1024;
                        byte[] buffer     = new byte[bucketSize];
                        ulong  readSize   = 0;

                        do
                        {
                            readSize = compressedStream.Read(buffer, bucketSize);
                            if (readSize > 0)
                            {
                                output.Write(buffer, 0, (int)readSize);
                                output.Flush();
                            }
                        }while (readSize > 0);
                    }
                }
        }
Exemplo n.º 3
0
        static void TestCompressedStream()
        {
            string pathSource = @"D:\Toney\Personal\Git\toneyisnow\HeroesIII\MapLoader\maps\HoMM3 Map Pack by HoMMdb\Shadow of Death & HoMM3 Complete\Andrews Exploits\Andrews Exploits";

            using (FileStream sw = new FileStream(@"D:\Temp\compressedout.out", FileMode.Create, FileAccess.Write))
            {
                using (BinaryFileReader fileReader = new BinaryFileReader(pathSource))
                {
                    using (CompressedStreamReader reader = new CompressedStreamReader(fileReader, false, 100000))
                    {
                        int    batchSize = 300;
                        byte[] tempData  = new byte[batchSize];
                        ulong  readSize  = 0;
                        int    count     = 0;
                        do
                        {
                            readSize = reader.Read(tempData, (ulong)batchSize);
                            sw.Write(tempData, 0, (int)readSize);
                        }while (readSize > 0 && count++ < 100);
                    }
                }
            }
        }