コード例 #1
0
        public void DotNetZip_CompressSmallFile()
        {
            var inputDirectory  = @"C:\Dev\CompressionLibraryResearch\CompressionLibraryResearchTests\Data\Raw\benchmark_phonebook.json";
            var outputDirectory = Path.GetTempPath();
            var destination     = Path.Join(outputDirectory, "demo.zip");;

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }
            DotNetZip.CompressFile(inputDirectory, destination);

            // Sometimes the Sfx test locks the .exe file for a few milliseconds.
            for (var n = 0; n < 10; n++)
            {
                try
                {
                    Directory.Delete(outputDirectory, true);
                    break;
                }
                catch
                {
                    Thread.Sleep(20);
                }
            }
        }
コード例 #2
0
        public void DotNetZip_CompressLargeFile()
        {
            var inputDirectory  = @"C:\Dev\CompressionLibraryResearch\CompressionLibraryResearchTests\Data\Raw\city of towers.db";
            var outputDirectory = Path.GetTempPath();
            var outputFile      = Path.Join(outputDirectory, "demo.zip");;

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            DotNetZip.CompressFile(inputDirectory, outputFile);

            // Sometimes the Sfx test locks the .exe file for a few milliseconds.
            for (var n = 0; n < 10; n++)
            {
                try
                {
                    Directory.Delete(outputDirectory, true);
                    break;
                }
                catch
                {
                    Thread.Sleep(20);
                }
            }
        }