public bool TryCreateResourceAccessor(string path, out IResourceAccessor result) { string nativeSystemId; ResourcePath nativeResourcePath; if (!TryExtractSystemAndPath(path, out nativeSystemId, out nativeResourcePath)) { throw new InvalidDataException("Path '{0}' is not a valid path for remote resource provider", path); } ISystemResolver systemResolver = ServiceRegistration.Get <ISystemResolver>(); SystemName nativeSystem = systemResolver.GetSystemNameForSystemId(nativeSystemId); if (nativeSystem == null) { throw new IllegalCallException("Cannot create resource accessor for resource location '{0}' at system '{1}': System is not available", nativeResourcePath, nativeSystemId); } // Try to access resource locally. This might work if we have the correct resource providers installed. if (nativeSystem.IsLocalSystem() && nativeResourcePath.IsValidLocalPath && nativeResourcePath.TryCreateLocalResourceAccessor(out result)) { return(true); } IFileSystemResourceAccessor fsra; if (RemoteFileSystemResourceAccessor.ConnectFileSystem(nativeSystemId, nativeResourcePath, out fsra)) { result = fsra; return(true); } result = null; return(false); }
public IResourceAccessor Clone() { RemoteFileSystemResourceAccessor result = new RemoteFileSystemResourceAccessor(_nativeSystemId, _nativeResourcePath, _isFile, _resourcePathName, _resourceName) { _sizeCache = _sizeCache, _lastChangedCache = _lastChangedCache }; return(result); }
public static bool ConnectFileSystem(string nativeSystemId, ResourcePath nativeResourcePath, out IFileSystemResourceAccessor result) { IRemoteResourceInformationService rris = ServiceRegistration.Get<IRemoteResourceInformationService>(); result = null; bool isFileSystemResource; bool isFile; string resourcePathName; string resourceName; long size; DateTime lastChanged; if (!rris.GetResourceInformation(nativeSystemId, nativeResourcePath, out isFileSystemResource, out isFile, out resourcePathName, out resourceName, out lastChanged, out size) || !isFileSystemResource) return false; result = new RemoteFileSystemResourceAccessor(nativeSystemId, nativeResourcePath, isFile, resourcePathName, resourceName, size, lastChanged); return true; }
public static bool ConnectFileSystem(string nativeSystemId, ResourcePath nativeResourcePath, out IFileSystemResourceAccessor result) { IRemoteResourceInformationService rris = ServiceRegistration.Get <IRemoteResourceInformationService>(); result = null; bool isFileSystemResource; bool isFile; string resourcePathName; string resourceName; long size; DateTime lastChanged; if (!rris.GetResourceInformation(nativeSystemId, nativeResourcePath, out isFileSystemResource, out isFile, out resourcePathName, out resourceName, out lastChanged, out size) || !isFileSystemResource) { return(false); } result = new RemoteFileSystemResourceAccessor(nativeSystemId, nativeResourcePath, isFile, resourcePathName, resourceName, size, lastChanged); return(true); }
public IResourceAccessor Clone() { RemoteFileSystemResourceAccessor result = new RemoteFileSystemResourceAccessor(_nativeSystemId, _nativeResourcePath, _isFile, _resourcePathName, _resourceName) { _sizeCache = _sizeCache, _lastChangedCache = _lastChangedCache }; return result; }