Exemplo n.º 1
0
        private void _Internal_ReadEncryptedZips(bool correctPw)
        {
            if (!WinZipIsPresent)
            {
                throw new Exception("no winzip!");
            }

            string[] cryptoArg = new string[] { "-ycAES128", "-ycAES256", };
            for (int m = 0; m < cryptoArg.Length; m++)
            {
                Directory.SetCurrentDirectory(TopLevelDir);

                // get a set of files to zip up
                string   subdir = Path.Combine(TopLevelDir, "files" + m);
                string[] filesToZip;
                Dictionary <string, byte[]> checksums;
                Compatibility.CreateFilesAndChecksums(subdir, out filesToZip, out checksums);
                string   password  = TestUtilities.GenerateRandomPassword();
                string[] dirsToZip = new string[]
                {
                    subdir + "\\*.*",
                };
                string zipFileToCreate = String.Format("WZA_ReadZips-{0}.zip", m);
                WinzipCreate(zipFileToCreate, dirsToZip, cryptoArg[m], password);

                _Internal_ReadZip(zipFileToCreate, (correctPw) ? password : null, filesToZip.Length);
            }
        }