예제 #1
0
        public static string[] GetFileEntries(string packageFile)
        {
            if (!File.Exists(packageFile))
            {
                return(null);
            }

            var zipFile = PackageStream.GetCachedZipFile(packageFile);

            return(zipFile.Cast <ZipEntry>().Select(e => e.Name).ToArray());
        }
예제 #2
0
        public static bool IsFileExisted(string packageFile, string path)
        {
            if (!File.Exists(packageFile))
            {
                return(false);
            }

            var zipFile = PackageStream.GetCachedZipFile(packageFile);

            return(zipFile.FindEntry(path, true) != -1);
        }
예제 #3
0
        public PackageStream(string packageFile, string path)
        {
            Log.InfoFormat("open package file {0} from {1}", path, packageFile);
            var zipFile = PackageStream.GetCachedZipFile(PackageStream.NormalizePath(packageFile));

            try
            {
                var entryIndex = zipFile.FindEntry(path, true);
                _zipStream = zipFile.GetInputStream(entryIndex);
            }
            catch (Exception)
            {
                throw new FileNotFoundException($"cannot find {path} in {packageFile}");
            }
        }