コード例 #1
0
        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();
   }
 }
コード例 #4
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();
     }
 }
コード例 #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;
 }