コード例 #1
0
 /// <summary>
 /// Creates a new instance of this class which is based on the given <paramref name="mountingDataProxy"/>.
 /// </summary>
 /// <param name="mountingDataProxy">Mount this bridge is based on.</param>
 /// <param name="path">Path relative to the mount point.</param>
 internal StreamedResourceToLocalFsAccessBridge(MountingDataProxy mountingDataProxy, string path)
 {
   _mountingDataProxy = mountingDataProxy;
   _mountingDataProxy.IncUsage();
   _path = path;
   _localFsPath = System.IO.Path.Combine(_mountingDataProxy.LocalFileSystemPath, ToDosPath(StringUtils.RemovePrefixIfPresent(_path, "/")));
 }
コード例 #2
0
 public void Dispose()
 {
   if (_mountingDataProxy == null)
     return;
   _mountingDataProxy.DecUsage();
   _mountingDataProxy = null;
 }
 /// <summary>
 /// Creates a new instance of this class which is based on the given <paramref name="mountingDataProxy"/>.
 /// </summary>
 /// <param name="mountingDataProxy">Mount this bridge is based on.</param>
 /// <param name="path">Path relative to the mount point.</param>
 internal StreamedResourceToLocalFsAccessBridge(MountingDataProxy mountingDataProxy, string path)
 {
     _mountingDataProxy = mountingDataProxy;
     _mountingDataProxy.IncUsage();
     _path        = path;
     _localFsPath = System.IO.Path.Combine(_mountingDataProxy.LocalFileSystemPath, ToDosPath(StringUtils.RemovePrefixIfPresent(_path, "/")));
 }
        static internal MountingDataProxy CreateMountingDataProxy(string key, IFileSystemResourceAccessor baseResourceAccessor)
        {
            MountingDataProxy result = new MountingDataProxy(key, baseResourceAccessor);

            result.MountingDataOrphaned += OnMountingDataOrphaned;
            return(result);
        }
 public void Dispose()
 {
     if (_mountingDataProxy == null)
     {
         return;
     }
     _mountingDataProxy.DecUsage();
     _mountingDataProxy = null;
 }
 static void OnMountingDataOrphaned(MountingDataProxy proxy)
 {
     lock (_syncObj)
     {
         if (proxy.UsageCount > 0)
         {
             // Double check if the proxy was reused when the lock was not set
             return;
         }
         _activeMounts.Remove(proxy.Key);
         proxy.Dispose();
     }
 }
コード例 #7
0
 static void OnMountingDataOrphaned(MountingDataProxy proxy)
 {
   lock (_syncObj)
   {
     if (proxy.UsageCount > 0)
       // Double check if the proxy was reused when the lock was not set
       return;
     _activeMounts.Remove(proxy.Key);
     proxy.Dispose();
   }
 }
コード例 #8
0
 static internal MountingDataProxy CreateMountingDataProxy(string key, IFileSystemResourceAccessor baseResourceAccessor)
 {
   MountingDataProxy result = new MountingDataProxy(key, baseResourceAccessor);
   result.MountingDataOrphaned += OnMountingDataOrphaned;
   return result;
 }