Esempio n. 1
0
        public void ExtractEmptyDirectories()
        {
            string tempFilePath = GetTempFilePath();

            Assert.IsNotNull(tempFilePath, "No permission to execute this test?");

            string name = Path.Combine(tempFilePath, "x.zip");

            EnsureTestDirectoryIsEmpty(tempFilePath);

            string targetDir = Path.Combine(tempFilePath, ZipTempDir + @"\floyd");

            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (var fs = store.CreateFile(name))
                {
                    using (ZipOutputStream zOut = new ZipOutputStream(fs))
                    {
                        zOut.PutNextEntry(new ZipEntry("floyd/"));
                    }
                }

                IsolatedFastZip fastZip = new IsolatedFastZip();
                fastZip.CreateEmptyDirectories = true;
                fastZip.ExtractZip(name, targetDir, "zz");

                store.DeleteFile(name);
                Assert.IsTrue(Directory.Exists(targetDir), "Empty directory should be created");
            }
        }
Esempio n. 2
0
        public void ExtractExceptions()
        {
            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                IsolatedFastZip fastZip      = new IsolatedFastZip();
                string          tempFilePath = GetTempFilePath();
                Assert.IsNotNull(tempFilePath, "No permission to execute this test?");

                string addFile = Path.Combine(tempFilePath, "test.zip");
                try
                {
                    fastZip.ExtractZip(addFile, @"z:\doesnt exist", null);
                }
                finally
                {
                    store.DeleteFile(addFile);
                }
            }
        }