public bool ExtractFiles(string[] filesToExtract) { if (filesToExtract == null) { return(false); } if (filesToExtract.Length == 0) { return(false); } UnzipOptionsFlags opts = PrepareOptionsFlags(); UnzipUserFunctions unzipUserFunctions = PrepareCallBack(); try { UnZipError ret = NativeMethods.Wiz_SingleEntryUnzip(filesToExtract.Length, filesToExtract, 0, null, ref opts, ref unzipUserFunctions); return(ret == UnZipError.PK_OK); } catch { return(false); } }
/// <summary> /// Prepares the options and flags. /// </summary> /// <returns>Unzip options and flags structure</returns> internal UnzipOptionsFlags PrepareOptionsFlags() { UnzipOptionsFlags opts = new UnzipOptionsFlags(); opts.ExtractOnlyNewer = 0; opts.SpaceToUnderscore = 0; opts.PromptToOverwrite = 1; opts.fQuiet = 0; opts.ncflag = 0; opts.ntflag = 0; opts.nvflag = 0; opts.nfflag = 0; opts.nzflag = 0; opts.ndflag = 1; opts.noflag = 1; opts.naflag = 0; opts.nZIflag = 0; opts.C_flag = 1; opts.fPrivilege = 0; opts.ExtractDir = outputFolder; opts.ZipFN = fileName; return(opts); }
public static extern UnZipError Wiz_SingleEntryUnzip(int zipcnt, string[] zipnames, int zipncnt2, string[] zipnames2, ref UnzipOptionsFlags opts, ref UnzipUserFunctions zuf);