public UTorrent(IUTorrentProxy proxy, ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, Logger logger) : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, logger) { _proxy = proxy; }
/// <summary> /// Initializes a new instance of the UTorrentClient class. /// </summary> /// <param name="webApiUri">The uri of the uTorrent web api</param> /// <param name="username">The username to use to log into uTorrent</param> /// <param name="password">The password to use</param> /// <param name="maxIncomingMessageSizeInBytes">The size of message to accept from uTorrent web</param> public UTorrentClient(Uri webApiUri, string username, string password, long maxIncomingMessageSizeInBytes = 524288) { CustomBinding clientCustomBinding = new CustomBinding( new WebMessageEncodingBindingElement() { ContentTypeMapper = new JsonContentTypeMapper() }, new HttpTransportBindingElement { UseDefaultWebProxy = true, ManualAddressing = true, AuthenticationScheme = AuthenticationSchemes.Basic, Realm = "uTorrent", AllowCookies = true, MaxReceivedMessageSize = maxIncomingMessageSizeInBytes }); this.channelFactory = new WebChannelFactory<IUTorrentProxy>(clientCustomBinding, webApiUri); this.channelFactory.Credentials.UserName.UserName = username; this.channelFactory.Credentials.UserName.Password = password; this.proxy = this.channelFactory.CreateChannel(); this.Torrents = new TorrentCollection(this.proxy); }
public UTorrent(IUTorrentProxy proxy, ICacheManager cacheManager, ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, IDiskProvider diskProvider, Logger logger) : base(torrentFileInfoReader, httpClient, configService, diskProvider, logger) { _proxy = proxy; _torrentCache = cacheManager.GetCache <UTorrentTorrentCache>(GetType(), "differentialTorrents"); }
/// <summary> /// Cleans up this instance and closes the underlying /// channel and channel factory. /// </summary> public void Dispose() { if (this.proxy != null) { ((IClientChannel)this.proxy).Close(); this.proxy = null; } if (this.channelFactory != null) { this.channelFactory.Close(); this.channelFactory = null; } }
/// <summary> /// Initializes a new instance of the UTorrentClient class. /// </summary> /// <param name="webApiUri">The uri of the uTorrent web api</param> /// <param name="username">The username to use to log into uTorrent</param> /// <param name="password">The password to use</param> /// <param name="maxIncomingMessageSizeInBytes">The size of message to accept from uTorrent web</param> public UTorrentClient(Uri webApiUri, string username, string password, long maxIncomingMessageSizeInBytes = 524288) { CustomBinding clientCustomBinding = new CustomBinding( new WebMessageEncodingBindingElement() { ContentTypeMapper = new JsonContentTypeMapper() }, new HttpTransportBindingElement { UseDefaultWebProxy = true, ManualAddressing = true, AuthenticationScheme = AuthenticationSchemes.Basic, Realm = "uTorrent", AllowCookies = true, MaxReceivedMessageSize = maxIncomingMessageSizeInBytes }); this.channelFactory = new WebChannelFactory <IUTorrentProxy>(clientCustomBinding, webApiUri); this.channelFactory.Credentials.UserName.UserName = username; this.channelFactory.Credentials.UserName.Password = password; this.proxy = this.channelFactory.CreateChannel(); this.Torrents = new TorrentCollection(this.proxy); }
/// <summary> /// Initializes a new instance of the TorrentCollection class /// </summary> /// <param name="proxy">the procol client that this torrent collection should use for updates, etc</param> internal TorrentCollection(IUTorrentProxy proxy) { this.proxy = proxy; }
/// <summary> /// Initializes a new instance of the Torrent class /// </summary> /// <param name="json">a json array returned from the web api representing a torrent</param> /// <param name="proxy">the procol client that this torrent should use for updates, etc</param> internal Torrent(JsonArray json, IUTorrentProxy proxy) { this.proxy = proxy; (this as IJsonLoadable).LoadFromJson(json); }