public override bool TestUnZip(string filePath) { try { using (var stream = File.OpenRead(filePath)) { IReader reader = null; if (IsEncryptFile(filePath)) { if (ZipArchive.IsZipFile(filePath)) { reader = ZipReader.Open(stream, new ReaderOptions { Password = "******" }); } else if (RarArchive.IsRarFile(filePath)) { reader = RarReader.Open(stream, new ReaderOptions { Password = "******" }); } } else { reader = ReaderFactory.Open(stream); } var subGuidDir = new DirectoryInfo(Path.Combine(ZipBase.UnZipRootDir, Guid.NewGuid().ToString("N"))); subGuidDir.Create(); if (reader != null) { while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { reader.WriteEntryToDirectory(subGuidDir.FullName, new ExtractionOptions { ExtractFullPath = true, Overwrite = true }); } } return(VerifyManager.Verify(subGuidDir.FullName)); } } } catch (Exception ex) { Debug.WriteLine(ex); } return(false); }
public bool Verify(bool showError = false) { var result = VerifyManager.Verify(this); if (!result && showError) { _hasError = true; ShowErrorTip(); } else { RemoveErrorTip(); _hasError = false; } return(result); }
public bool Verify(bool showError = false) { return(VerifyManager.Verify(this)); }