public static Task <IReadOnlyList <string> > GetNetworkInterfaceAddressesAsync(
     [NotNull] this IQBittorrentClient2 client,
     [CanBeNull] NetInterface networkInterface,
     CancellationToken token = default)
 {
     return(client.GetNetworkInterfaceAddressesAsync(networkInterface?.Id, token));
 }
 public static Task ClearTorrentTagsAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string hash,
     CancellationToken token = default)
 {
     ValidateHash(hash);
     return(client.ClearTorrentTagsAsync(new[] { hash }, token));
 }
 public static Task DeleteTorrentTagAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string tag,
     CancellationToken token = default)
 {
     ValidateTag(tag);
     return(client.DeleteTorrentTagsAsync(new[] { tag }, token));
 }
 public static Task BanPeerAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] IPEndPoint peer,
     CancellationToken token = default)
 {
     ValidatePeer(peer);
     return(client.BanPeersAsync(new[] { peer }, token));
 }
 public static Task DeleteTrackerAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string hash,
     [NotNull] Uri trackerUrl,
     CancellationToken token = default)
 {
     return(client.DeleteTrackersAsync(hash, new[] { trackerUrl }, token));
 }
 public static Task DeleteTorrentTagsAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string hash,
     [NotNull, ItemNotNull] IEnumerable <string> tags,
     CancellationToken token = default)
 {
     ValidateHash(hash);
     return(client.DeleteTorrentTagsAsync(new[] { hash }, tags, token));
 }
 public static Task AddTorrentTagAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull, ItemNotNull] IEnumerable <string> hashes,
     [NotNull] string tag,
     CancellationToken token = default)
 {
     ValidateTag(tag);
     return(client.AddTorrentTagsAsync(hashes, new [] { tag }, token));
 }
 public static Task <IReadOnlyDictionary <string, PeerAddResult> > AddTorrentPeerAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull, ItemNotNull] IEnumerable <string> hashes,
     [NotNull] IPEndPoint peer,
     CancellationToken token = default)
 {
     ValidatePeer(peer);
     return(client.AddTorrentPeersAsync(hashes, new[] { peer }, token));
 }
 public static Task AddTorrentTagAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string hash,
     [NotNull] string tag,
     CancellationToken token = default)
 {
     ValidateHash(hash);
     ValidateTag(tag);
     return(client.AddTorrentTagsAsync(new[] { hash }, new[] { tag }, token));
 }
 public static Task SetShareLimitsAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string hash,
     double ratio,
     TimeSpan seedingTime,
     CancellationToken token = default)
 {
     ValidateHash(hash);
     return(client.SetShareLimitsAsync(new[] { hash }, ratio, seedingTime, token));
 }
        public static Task DisableSearchPluginAsync(
            [NotNull] this IQBittorrentClient2 client,
            [NotNull] string name,
            CancellationToken token = default)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return(client.DisableSearchPluginsAsync(new[] { name }, token));
        }
        public static Task InstallSearchPluginAsync(
            [NotNull] this IQBittorrentClient2 client,
            [NotNull] Uri source,
            CancellationToken token = default)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(client.InstallSearchPluginsAsync(new[] { source }, token));
        }
 public static Task <int> StartSearchAsync(
     [NotNull] this IQBittorrentClient2 client,
     [NotNull] string pattern,
     bool disabledPluginsToo   = false,
     [NotNull] string category = "all",
     CancellationToken token   = default)
 {
     return(client.StartSearchAsync(pattern,
                                    disabledPluginsToo ? SearchPlugin.All : SearchPlugin.Enabled,
                                    category,
                                    token));
 }
        public static async Task <PeerAddResult> AddTorrentPeersAsync(
            [NotNull] this IQBittorrentClient2 client,
            [NotNull] string hash,
            [NotNull, ItemNotNull] IEnumerable <IPEndPoint> peers,
            CancellationToken token = default)
        {
            ValidateHash(hash);

            var results = await client.AddTorrentPeersAsync(new[] { hash }, peers, token).ConfigureAwait(false);

            results.TryGetValue(hash, out var result);
            return(result);
        }
        public static Task <int> StartSearchAsync(
            [NotNull] this IQBittorrentClient2 client,
            [NotNull] string pattern,
            [NotNull] string plugin,
            [NotNull] string category = "all",
            CancellationToken token   = default)
        {
            if (plugin == null)
            {
                throw new ArgumentNullException(nameof(plugin));
            }

            return(client.StartSearchAsync(pattern, new [] { plugin }, category, token));
        }
        public static async Task <PeerAddResult> AddTorrentPeerAsync(
            [NotNull] this IQBittorrentClient2 client,
            [NotNull] string hash,
            [NotNull] string peer,
            CancellationToken token = default)
        {
            ValidateHash(hash);
            ValidatePeer(peer);

            var results = await client.AddTorrentPeersAsync(new [] { hash }, new[] { peer }, token).ConfigureAwait(false);

            results.TryGetValue(hash, out var result);
            return(result);
        }