Beispiel #1
0
        public ChunkedHttpDownloader(string destinationFilePath, RemoteResource resource, int timeout)
        {
            Checks.ArgumentParentDirectoryExists(destinationFilePath, "destinationFilePath");
            Checks.ArgumentValidRemoteResource(resource, "resource");
            Checks.ArgumentMoreThanZero(timeout, "timeout");

            DebugLogger.LogConstructor();
            DebugLogger.LogVariable(destinationFilePath, "destinationFilePath");
            DebugLogger.LogVariable(resource, "resource");
            DebugLogger.LogVariable(timeout, "timeout");

            _destinationFilePath = destinationFilePath;
            _resource            = resource;
            _timeout             = timeout;
        }
        public DownloadPackageCommand(RemoteResource resource, string destinationPackagePath, string destinationMetaPath, bool useTorrents)
        {
            Checks.ArgumentValidRemoteResource(resource, "resource");
            Checks.ArgumentNotNullOrEmpty(destinationPackagePath, "destinationPackagePath");
            Checks.ParentDirectoryExists(destinationPackagePath);

            DebugLogger.LogConstructor();
            DebugLogger.LogVariable(resource, "resource");
            DebugLogger.LogVariable(destinationPackagePath, "destinationPackagePath");
            DebugLogger.LogVariable(useTorrents, "useTorrents");

            _resource = resource;
            _destinationPackagePath = destinationPackagePath;
            _destinationMetaPath    = destinationMetaPath;
            _useTorrents            = useTorrents;
        }
        public RemoteResourceDownloader(string destinationFilePath, string destinationMetaPath, RemoteResource resource,
                                        bool useTorrents,
                                        CreateNewHttpDownloader createNewHttpDownloader,
                                        CreateNewChunkedHttpDownloader createNewChunkedHttpDownloader,
                                        CreateNewTorrentDownloader createNewTorrentDownloader)
        {
            Checks.ArgumentParentDirectoryExists(destinationFilePath, "destinationFilePath");
            Checks.ArgumentValidRemoteResource(resource, "resource");

            DebugLogger.LogConstructor();
            DebugLogger.LogVariable(destinationFilePath, "destinationFilePath");
            DebugLogger.LogVariable(resource, "resource");
            DebugLogger.LogVariable(useTorrents, "useTorrents");

            _destinationFilePath            = destinationFilePath;
            _destinationMetaPath            = destinationMetaPath;
            _resource                       = resource;
            _useTorrents                    = useTorrents;
            _createNewHttpDownloader        = createNewHttpDownloader;
            _createNewChunkedHttpDownloader = createNewChunkedHttpDownloader;
            _createNewTorrentDownloader     = createNewTorrentDownloader;
        }
        public DownloadPackageCommand(RemoteResource resource, string destinationPackagePath,
                                      string destinationMetaPath)
        {
            Checks.ArgumentValidRemoteResource(resource, "resource");

            if (string.IsNullOrEmpty(destinationPackagePath))
            {
                throw new ArgumentException(destinationPackagePath, "destinationPackagePath");
            }

            if (!Directory.Exists(Path.GetDirectoryName(destinationPackagePath)))
            {
                throw new ArgumentException("Parent directory doesn't exist.", "destinationPackagePath");
            }

            DebugLogger.LogConstructor();
            DebugLogger.LogVariable(resource, "resource");
            DebugLogger.LogVariable(destinationPackagePath, "destinationPackagePath");

            _resource = resource;
            _destinationPackagePath = destinationPackagePath;
            _destinationMetaPath    = destinationMetaPath;
        }