示例#1
0
        /// <summary>
        /// Extract the contents of a zip file located in the specified path to a temp directory
        /// </summary>
        /// <returns>path of the temporary directory</returns>
        public static string ExtractToTempDirectory(string zipFilePath)
        {
            if (!File.Exists(zipFilePath))
            {
                throw new ArgumentException("Zip file must exist.", "zipFilePath");
            }

            string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            Directory.CreateDirectory(tempPath);

            ZipUtilities.ExtractToDirectory(zipFilePath, tempPath);

            return(tempPath);
        }