Exemple #1
0
        public override DownloadClientInfo GetStatus()
        {
            try
            {
                var serialNumber = _serialNumberProvider.GetSerialNumber(Settings);

                // Download station returns the path without the leading `/`, but the leading
                // slash is required to get the full path back from download station.
                var path = new OsPath($"/{GetDownloadDirectory()}");

                var fullPath = _sharedFolderResolver.RemapToFullPath(path, Settings, serialNumber);

                return(new DownloadClientInfo
                {
                    IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost",
                    OutputRootFolders = new List <OsPath> {
                        _remotePathMappingService.RemapRemoteToLocal(Settings.Host, fullPath)
                    }
                });
            }
            catch (DownloadClientException e)
            {
                _logger.Debug(e, "Failed to get config from Download Station");

                throw;
            }
        }
        protected OsPath GetOutputPath(OsPath outputPath, DownloadStationTask task, string serialNumber)
        {
            var fullPath = _sharedFolderResolver.RemapToFullPath(outputPath, Settings, serialNumber);

            var remotePath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, fullPath);

            var finalPath = remotePath + task.Title;

            return(finalPath);
        }
        public override DownloadClientInfo GetStatus()
        {
            try
            {
                var serialNumber = _serialNumberProvider.GetSerialNumber(Settings);
                var sharedFolder = GetDownloadDirectory() ?? GetDefaultDir();
                var outputPath   = new OsPath($"/{sharedFolder.TrimStart('/')}");
                var path         = _sharedFolderResolver.RemapToFullPath(outputPath, Settings, serialNumber);

                return(new DownloadClientInfo
                {
                    IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost",
                    OutputRootFolders = new List <OsPath> {
                        _remotePathMappingService.RemapRemoteToLocal(Settings.Host, path)
                    }
                });
            }
            catch (DownloadClientException e)
            {
                _logger.Debug(e, "Failed to get config from Download Station");

                throw;
            }
        }