public PackageStream(string packageFile, string path) { #if !MOBILE log.InfoFormat("open package file {0} from {1}", path, packageFile); #endif var zipFile = PackageStream.GetZipFile(PackageStream.NormalizePath(packageFile)); if (zipFile == null) { throw PackageStream.FileNotFoundException(path, packageFile); } var entryIndex = zipFile.FindEntry(path, true); if (entryIndex == -1) { throw PackageStream.FileNotFoundException(path, packageFile); } try { _zipStream = zipFile.GetInputStream(entryIndex); } catch (Exception ex) { throw new IOException(string.Format("failed to open {0} in {1}", path, packageFile), ex); } }
public static long?GetCrc(string packageFile, string path) { #if !MOBILE log.InfoFormat("open package file {0} from {1}", path, packageFile); #endif var zipFile = PackageStream.GetZipFile(PackageStream.NormalizePath(packageFile)); try { var entryIndex = zipFile.FindEntry(path, true); var entry = zipFile[entryIndex]; return(entry.HasCrc ? entry.Crc : (long?)null); } catch (Exception) { throw PackageStream.FileNotFoundException(path, packageFile); } }