Пример #1
0
        public void forceCloseResourceFile(String filename)
        {
            CachedResource cachedResource = this[filename];

            if (cachedResource != null)
            {
                cachedResource.AllowClose = true;
                closeResource(cachedResource.File);
            }
        }
        public Stream openFile(string filename)
        {
            CachedResource cachedResource = ResourceCache[filename];

            if (cachedResource != null)
            {
                return(cachedResource.openStream());
            }
            else
            {
                return(backingProvider.openFile(filename));
            }
        }
        public void addFile(string path, string targetDirectory)
        {
            String filename        = Path.GetFileName(path);
            String destinationPath = Path.Combine(targetDirectory, filename);

            backingProvider.addFile(path, targetDirectory);
            CachedResource cachedResource = ResourceCache[destinationPath];

            if (cachedResource != null)
            {
                cachedResource.AllowClose = true;
                ResourceCache.closeResource(path);
            }
        }
Пример #4
0
        public void add(CachedResource resource)
        {
            String file = fixPath(resource.File);

            if (!cachedResources.ContainsKey(file))
            {
                cachedResources.Add(file, resource);
            }
            else
            {
                cachedResources[file] = resource;
            }
            if (CachedResourceAdded != null)
            {
                CachedResourceAdded.Invoke(this, resource);
            }
        }
Пример #5
0
 public void addCachedResource(CachedResource cachedResource)
 {
     resourceProvider.ResourceCache.add(cachedResource);
 }