public RemoteFile(Uri remoteLocation, string localDestination, RemoteFileCompleted completed = null, RemoteFileFailed failed = null, RemoteFileProgress progress = null) { _completed = completed ?? (location => { }); _failed = failed ?? (location => { }); _progress = progress ?? ((location, complete) => { }); RemoteLocation = remoteLocation; var destination = localDestination.CanonicalizePath(); _localDirectory = Path.GetDirectoryName(destination); if (_localDirectory != null && !Directory.Exists(_localDirectory)) { Directory.CreateDirectory(_localDirectory); } if (Directory.Exists(destination)) { // they just gave us the local folder where to stick the download. // we'll have to figure out a filename... _localDirectory = destination; } else { _filename = Path.GetFileName(destination); } }
public RemoteFile(string remoteLocation, string localDestination, RemoteFileCompleted completed = null, RemoteFileFailed failed = null, RemoteFileProgress progress = null) : this(new Uri(remoteLocation), localDestination, completed, failed, progress) { }