Пример #1
0
        public static StorageRoot CreateStorage(Stream stream, Uri streamUri = null, string streamName = null, StorageOptions storageOptions = null)
        {
            var provider = new ZipStorgeProvider(stream, streamUri, streamName);
            var ret      = new StorageRoot(provider, storageOptions);

            return(ret);
        }
Пример #2
0
        public static StorageRoot CreateStorage(string zipPath, StorageOptions storageOptions = null)
        {
            var provider = new ZipStorgeProvider(zipPath);
            var ret      = new StorageRoot(provider, storageOptions);

            return(ret);
        }
Пример #3
0
        public IStorageProvider OpenStorage(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            lock (_zipArchive)
            {
                var path   = PathFromUri(uri);
                var exists = _zipArchive.Entries.Any(x => GetEntryFolderName(x.FullName).IndexOf(path, StringComparison.OrdinalIgnoreCase) == 0);
                if (!exists)
                {
                    throw new StorageNotFoundException(uri);
                }

                var ret = new ZipStorgeProvider(this, path);
                return(ret);
            }
        }
Пример #4
0
 private ZipStorgeProvider(ZipStorgeProvider parent, string path)
 {
     _path       = path;
     _zipArchive = parent._zipArchive;
 }