Azavea.NijPredictivePolicing.Common.FileUtilities.UnzipFileTo C# (CSharp) Method

UnzipFileTo() public static method

Uses Ionic.Zip library to expand a file (without overwriting) to a given location
public static UnzipFileTo ( string basePath, string zipFileName ) : bool
basePath string
zipFileName string
return bool
        public static bool UnzipFileTo(string basePath, string zipFileName)
        {
            try
            {
                _log.DebugFormat("Unzipping {0}", Path.GetFileName(zipFileName));
                FileUtilities.SafePathEnsure(basePath);

                var zipFile = new ZipFile(zipFileName);
                zipFile.ExtractAll(basePath, ExtractExistingFileAction.DoNotOverwrite);

                _log.Debug("Unzipping... Done!");

                if (Settings.ShowFilePaths)
                {
                    _log.InfoFormat("Unzipped \"{0}\" to \"{1}\"", Path.GetFileName(zipFileName), basePath);
                }

                return true;
            }
            catch (Exception ex)
            {
                _log.Error("Error while unzipping file", ex);
            }
            return false;
        }