public override void Erase(StringKey key)
        {
            if (mArchive.Mode == ZipArchiveMode.Create || !Exists(key))
            {
                return;
            }

            var completeName  = mThisFolderName.Concat(key).ToString("\\");
            var existingEntry = mArchive.GetEntry(completeName);

            existingEntry.Delete();
        }
Ejemplo n.º 2
0
        internal EmbeddedBlobStoreNamespace(
            StringKeySequence baseName,
            StringKeySequence name,
            [NotNull] Assembly assembly,
            [NotNull] IDictionary <StringKey, EmbeddedBlobStoreNamespace> children,
            [NotNull] IEnumerable <StringKey> names)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            if (children == null)
            {
                throw new ArgumentNullException(nameof(children));
            }

            if (names == null)
            {
                throw new ArgumentNullException(nameof(names));
            }

            mAssembly = assembly;
            mName     = baseName.Concat(name);
            mChildren = children;
            mNames    = new HashSet <StringKey>(names);
        }
Ejemplo n.º 3
0
        protected override Stream OpenStream(StringKey key, AccessMode accessMode)
        {
            if (accessMode.HasFlag(AccessMode.Write) || accessMode.HasFlag(AccessMode.Append))
            {
                throw new NotSupportedException("Writing objects to embedded BLOB stores is not supported.");
            }

            var completeName = mName.Concat(key).ToString(".");

            var stream = mAssembly.GetManifestResourceStream(completeName);

            if (stream == null)
            {
                return(new MemoryStream());
            }

            return(stream);
        }