public CompositeComparer(IEnumerable <IComparer <T> > comparers) { var c = ArgValidation.ThrowIfNull(comparers, "comparers"); _comparers = c.ToArray(); if (_comparers.Length == 0) { throw new ArgumentException("comparers is empty"); } }
private async Task DoDownloadAsync(string id, Stream stream, CancellationToken ct = default(CancellationToken), IProgress <string> progress = null) { ArgValidation.ThrowIfNull(stream, "stream"); var driveService = await GetDriveServiceAsync().ConfigureAwait(false); try { var request = driveService.Files.Get(id); request.SupportsTeamDrives = true; if (progress != null) { request.MediaDownloader.ProgressChanged += p => { switch (p.Status) { case DownloadStatus.Downloading: { progress.Report("Bytes downloaded: " + p.BytesDownloaded); break; } case DownloadStatus.Completed: { progress.Report("Download completed"); break; } case DownloadStatus.Failed: { progress.Report("Download failed"); break; } } }; } await request.DownloadAsync(stream, ct).ConfigureAwait(false); stream.Seek(0, SeekOrigin.Begin); } catch (Exception ex) { Logger.Error("Error deleting file {0} - {1}", id, ex); } }
public DelegateComparer(Func <T, T, int> func) { _func = ArgValidation.ThrowIfNull(func, "func"); }
public PriorityComparer(Func <T, int> priorityFunc) { _priorityFunc = ArgValidation.ThrowIfNull(priorityFunc, "priorityFunc"); }