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

            result.Orphaned += OnZipResourceProxyOrphaned;
            return(result);
        }
예제 #2
0
 public void Dispose()
 {
     if (_zipProxy == null)
     {
         return;
     }
     _zipProxy.DecUsage();
     _zipProxy = null;
 }
예제 #3
0
 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();
     }
 }
예제 #5
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;
      }
    }
예제 #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;
            }
        }
예제 #7
0
 public void Dispose()
 {
   if (_zipProxy == null)
     return;
   _zipProxy.DecUsage();
   _zipProxy = null;
 }
예제 #8
0
 internal ZipResourceProxy CreateZipResourceProxy(string key, IFileSystemResourceAccessor zipFileResourceAccessor)
 {
   ZipResourceProxy result = new ZipResourceProxy(key, zipFileResourceAccessor);
   result.Orphaned += OnZipResourceProxyOrphaned;
   return result;
 }