public override void SetAttributes(string path, AssetAttributes attributes)
        {
            OnModifying?.Invoke();
            var desc = GetDescriptor(path);

            index[AssetPath.CorrectSlashes(path)] = desc;
            wasModified = true;
        }
        public override void DeleteFile(string path)
        {
            OnModifying?.Invoke();
            path = AssetPath.CorrectSlashes(path);
            var desc = GetDescriptor(path);

            index.Remove(path);
            trash.Add(desc);
            wasModified = true;
        }
        public override void ImportFile(string path, Stream stream, int reserve, string sourceExtension, DateTime time, AssetAttributes attributes, byte[] cookingRulesSHA1)
        {
            OnModifying?.Invoke();
            AssetDescriptor d;

            if ((attributes & AssetAttributes.Zipped) != 0)
            {
                stream = CompressAssetStream(stream, attributes);
            }
            bool reuseExistingDescriptor = index.TryGetValue(AssetPath.CorrectSlashes(path), out d) &&
                                           (d.AllocatedSize >= stream.Length) &&
                                           (d.AllocatedSize <= stream.Length + reserve);

            if (reuseExistingDescriptor)
            {
                d.Length           = (int)stream.Length;
                d.ModificationTime = time;
                d.CookingRulesSHA1 = cookingRulesSHA1;
                d.Attributes       = attributes;
                d.SourceExtension  = sourceExtension;
                index[AssetPath.CorrectSlashes(path)] = d;
                this.stream.Seek(d.Offset, SeekOrigin.Begin);
                stream.CopyTo(this.stream);
                reserve = d.AllocatedSize - (int)stream.Length;
                if (reserve > 0)
                {
                    byte[] zeroBytes = new byte[reserve];
                    this.stream.Write(zeroBytes, 0, zeroBytes.Length);
                }
            }
            else
            {
                if (FileExists(path))
                {
                    DeleteFile(path);
                }
                d = new AssetDescriptor();
                d.ModificationTime = time;
                d.CookingRulesSHA1 = cookingRulesSHA1;
                d.Length           = (int)stream.Length;
                d.Offset           = indexOffset;
                d.AllocatedSize    = d.Length + reserve;
                d.Attributes       = attributes;
                d.SourceExtension  = sourceExtension;
                index[AssetPath.CorrectSlashes(path)] = d;
                indexOffset += d.AllocatedSize;
                this.stream.Seek(d.Offset, SeekOrigin.Begin);
                stream.CopyTo(this.stream);
                byte[] zeroBytes = new byte[reserve];
                this.stream.Write(zeroBytes, 0, zeroBytes.Length);
                this.stream.Flush();
            }
            wasModified = true;
        }