Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 public RemoteFile(string remoteLocation, string localDestination, RemoteFileCompleted completed = null, RemoteFileFailed failed = null, RemoteFileProgress progress = null)
     : this(new Uri(remoteLocation), localDestination, completed, failed, progress)
 {
 }
Esempio n. 4
0
 public RemoteFile(string remoteLocation, string localDestination, RemoteFileCompleted completed = null, RemoteFileFailed failed = null, RemoteFileProgress progress = null)
     : this(new Uri(remoteLocation), localDestination, completed, failed, progress)
 {
 }