internal ZipResourceProxy CreateZipResourceProxy(string key, IFileSystemResourceAccessor zipFileResourceAccessor)
        {
            ZipResourceProxy result = new ZipResourceProxy(key, zipFileResourceAccessor);

            result.Orphaned += OnZipResourceProxyOrphaned;
            return(result);
        }
Example #2
0
 public void Dispose()
 {
     if (_zipProxy == null)
     {
         return;
     }
     _zipProxy.DecUsage();
     _zipProxy = null;
 }
 void OnZipResourceProxyOrphaned(ZipResourceProxy proxy)
 {
   lock (_syncObj)
   {
     if (proxy.UsageCount > 0)
       // Double check if the proxy was reused when the lock was not set
       return;
     _zipUsages.Remove(proxy.Key);
     proxy.Dispose();
   }
 }
 void OnZipResourceProxyOrphaned(ZipResourceProxy proxy)
 {
     lock (_syncObj)
     {
         if (proxy.UsageCount > 0)
         {
             // Double check if the proxy was reused when the lock was not set
             return;
         }
         _zipUsages.Remove(proxy.Key);
         proxy.Dispose();
     }
 }
    public ZipResourceAccessor(ZipResourceProvider zipProvider, ZipResourceProxy zipProxy, string pathToDirOrFile)
    {
      _zipProvider = zipProvider;
      _zipProxy = zipProxy;
      _pathToDirOrFile = pathToDirOrFile;

      _zipProxy.IncUsage();
      try
      {
        ReadCurrentDirectory();
        if (!_isDirectory && _zipEntry == null)
        {
          _zipProxy.DecUsage();
          throw new IllegalCallException("ZipResourceAccessor: Cannot find zip entry for path '{0}' in ZIP file '{1}'",
              pathToDirOrFile, _zipProxy.ZipFileResourceAccessor.CanonicalLocalResourcePath);
        }
      }
      catch (Exception)
      {
        _zipProxy.DecUsage();
        throw;
      }
    }
Example #6
0
        public ZipResourceAccessor(ZipResourceProvider zipProvider, ZipResourceProxy zipProxy, string pathToDirOrFile)
        {
            _zipProvider     = zipProvider;
            _zipProxy        = zipProxy;
            _pathToDirOrFile = pathToDirOrFile;

            _zipProxy.IncUsage();
            try
            {
                ReadCurrentDirectory();
                if (!_isDirectory && _zipEntry == null)
                {
                    _zipProxy.DecUsage();
                    throw new IllegalCallException("ZipResourceAccessor: Cannot find zip entry for path '{0}' in ZIP file '{1}'",
                                                   pathToDirOrFile, _zipProxy.ZipFileResourceAccessor.CanonicalLocalResourcePath);
                }
            }
            catch (Exception)
            {
                _zipProxy.DecUsage();
                throw;
            }
        }
 public void Dispose()
 {
   if (_zipProxy == null)
     return;
   _zipProxy.DecUsage();
   _zipProxy = null;
 }
 internal ZipResourceProxy CreateZipResourceProxy(string key, IFileSystemResourceAccessor zipFileResourceAccessor)
 {
   ZipResourceProxy result = new ZipResourceProxy(key, zipFileResourceAccessor);
   result.Orphaned += OnZipResourceProxyOrphaned;
   return result;
 }