/// <summary> /// Initializes a new instance of the <see cref="SoulseekClientOptionsPatch"/> class. /// </summary> /// <param name="enableListener">A value indicating whether to listen for incoming connections.</param> /// <param name="listenPort">The port on which to listen for incoming connections.</param> /// <param name="enableDistributedNetwork">A value indicating whether to establish distributed network connections.</param> /// <param name="acceptDistributedChildren">A value indicating whether to accept distributed child connections.</param> /// <param name="distributedChildLimit">The number of allowed distributed children.</param> /// <param name="deduplicateSearchRequests"> /// A value indicating whether duplicated distributed search requests should be discarded. /// </param> /// <param name="autoAcknowledgePrivateMessages"> /// A value indicating whether to automatically send a private message acknowledgement upon receipt. /// </param> /// <param name="autoAcknowledgePrivilegeNotifications"> /// A value indicating whether to automatically send a privilege notification acknowledgement upon receipt. /// </param> /// <param name="acceptPrivateRoomInvitations">A value indicating whether to accept private room invitations.</param> /// <param name="serverConnectionOptions">The options for the server message connection.</param> /// <param name="peerConnectionOptions">The options for peer message connections.</param> /// <param name="transferConnectionOptions">The options for peer transfer connections.</param> /// <param name="incomingConnectionOptions">The options for incoming connections.</param> /// <param name="distributedConnectionOptions">The options for distributed message connections.</param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when the value supplied for <paramref name="listenPort"/> is not between 1024 and 65535. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when the value supplied for <paramref name="distributedChildLimit"/> is less than zero. /// </exception> public SoulseekClientOptionsPatch( bool?enableListener = null, int?listenPort = null, bool?enableDistributedNetwork = null, bool?acceptDistributedChildren = null, int?distributedChildLimit = null, bool?deduplicateSearchRequests = null, bool?autoAcknowledgePrivateMessages = null, bool?autoAcknowledgePrivilegeNotifications = null, bool?acceptPrivateRoomInvitations = null, ConnectionOptions serverConnectionOptions = null, ConnectionOptions peerConnectionOptions = null, ConnectionOptions transferConnectionOptions = null, ConnectionOptions incomingConnectionOptions = null, ConnectionOptions distributedConnectionOptions = null) { EnableListener = enableListener; ListenPort = listenPort; if (ListenPort < 1024 || ListenPort > IPEndPoint.MaxPort) { throw new ArgumentOutOfRangeException(nameof(listenPort), "Must be between 1024 and 65535"); } EnableDistributedNetwork = enableDistributedNetwork; AcceptDistributedChildren = acceptDistributedChildren; DistributedChildLimit = distributedChildLimit; if (DistributedChildLimit < 0) { throw new ArgumentOutOfRangeException(nameof(distributedChildLimit), "Must be greater than or equal to zero"); } DeduplicateSearchRequests = deduplicateSearchRequests; AutoAcknowledgePrivateMessages = autoAcknowledgePrivateMessages; AutoAcknowledgePrivilegeNotifications = autoAcknowledgePrivilegeNotifications; AcceptPrivateRoomInvitations = acceptPrivateRoomInvitations; ServerConnectionOptions = serverConnectionOptions?.WithoutInactivityTimeout(); PeerConnectionOptions = peerConnectionOptions; TransferConnectionOptions = transferConnectionOptions?.WithoutInactivityTimeout(); IncomingConnectionOptions = incomingConnectionOptions; DistributedConnectionOptions = distributedConnectionOptions; }
/// <summary> /// Initializes a new instance of the <see cref="SoulseekClientOptionsPatch"/> class. /// </summary> /// <param name="enableListener">A value indicating whether to listen for incoming connections.</param> /// <param name="listenPort">The port on which to listen for incoming connections.</param> /// <param name="enableDistributedNetwork">A value indicating whether to establish distributed network connections.</param> /// <param name="acceptDistributedChildren">A value indicating whether to accept distributed child connections.</param> /// <param name="distributedChildLimit">The number of allowed distributed children.</param> /// <param name="maximumUploadSpeed">The total maximum allowable upload speed, in kibibytes per second.</param> /// <param name="maximumDownloadSpeed">The total maximum allowable download speed, in kibibytes per second.</param> /// <param name="deduplicateSearchRequests"> /// A value indicating whether duplicated distributed search requests should be discarded. /// </param> /// <param name="autoAcknowledgePrivateMessages"> /// A value indicating whether to automatically send a private message acknowledgement upon receipt. /// </param> /// <param name="autoAcknowledgePrivilegeNotifications"> /// A value indicating whether to automatically send a privilege notification acknowledgement upon receipt. /// </param> /// <param name="acceptPrivateRoomInvitations">A value indicating whether to accept private room invitations.</param> /// <param name="serverConnectionOptions">The options for the server message connection.</param> /// <param name="peerConnectionOptions">The options for peer message connections.</param> /// <param name="transferConnectionOptions">The options for peer transfer connections.</param> /// <param name="incomingConnectionOptions">The options for incoming connections.</param> /// <param name="distributedConnectionOptions">The options for distributed message connections.</param> /// <param name="userEndPointCache">The user endpoint cache to use when resolving user endpoints.</param> /// <param name="searchResponseResolver"> /// The delegate used to resolve the <see cref="SearchResponse"/> for an incoming <see cref="SearchRequest"/>. /// </param> /// <param name="searchResponseCache"> /// The search response cache to use when a response is not able to be delivered immediately. /// </param> /// <param name="browseResponseResolver"> /// The delegate used to resolve the <see cref="BrowseResponse"/> for an incoming <see cref="BrowseRequest"/>. /// </param> /// <param name="directoryContentsResolver"> /// The delegate used to resolve the <see cref="Directory"/> for an incoming <see cref="FolderContentsRequest"/>. /// </param> /// <param name="userInfoResolver">The delegate used to resolve the <see cref="UserInfo"/> for an incoming <see cref="UserInfoRequest"/>.</param> /// <param name="enqueueDownload">The delegate invoked upon an receipt of an incoming <see cref="QueueDownloadRequest"/>.</param> /// <param name="placeInQueueResolver"> /// The delegate used to resolve the <see cref="int"/> response for an incoming request. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when the value supplied for <paramref name="listenPort"/> is not between 1024 and 65535. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when the value supplied for <paramref name="distributedChildLimit"/> is less than zero. /// </exception> public SoulseekClientOptionsPatch( bool?enableListener = null, int?listenPort = null, bool?enableDistributedNetwork = null, bool?acceptDistributedChildren = null, int?distributedChildLimit = null, int?maximumUploadSpeed = null, int?maximumDownloadSpeed = null, bool?deduplicateSearchRequests = null, bool?autoAcknowledgePrivateMessages = null, bool?autoAcknowledgePrivilegeNotifications = null, bool?acceptPrivateRoomInvitations = null, ConnectionOptions serverConnectionOptions = null, ConnectionOptions peerConnectionOptions = null, ConnectionOptions transferConnectionOptions = null, ConnectionOptions incomingConnectionOptions = null, ConnectionOptions distributedConnectionOptions = null, IUserEndPointCache userEndPointCache = null, Func <string, int, SearchQuery, Task <SearchResponse> > searchResponseResolver = null, ISearchResponseCache searchResponseCache = null, Func <string, IPEndPoint, Task <BrowseResponse> > browseResponseResolver = null, Func <string, IPEndPoint, int, string, Task <Directory> > directoryContentsResolver = null, Func <string, IPEndPoint, Task <UserInfo> > userInfoResolver = null, Func <string, IPEndPoint, string, Task> enqueueDownload = null, Func <string, IPEndPoint, string, Task <int?> > placeInQueueResolver = null) { EnableListener = enableListener; ListenPort = listenPort; if (ListenPort < 1024 || ListenPort > IPEndPoint.MaxPort) { throw new ArgumentOutOfRangeException(nameof(listenPort), "Must be between 1024 and 65535"); } EnableDistributedNetwork = enableDistributedNetwork; AcceptDistributedChildren = acceptDistributedChildren; DistributedChildLimit = distributedChildLimit; if (DistributedChildLimit < 0) { throw new ArgumentOutOfRangeException(nameof(distributedChildLimit), "Must be greater than or equal to zero"); } MaximumUploadSpeed = maximumUploadSpeed; MaximumDownloadSpeed = maximumDownloadSpeed; DeduplicateSearchRequests = deduplicateSearchRequests; AutoAcknowledgePrivateMessages = autoAcknowledgePrivateMessages; AutoAcknowledgePrivilegeNotifications = autoAcknowledgePrivilegeNotifications; AcceptPrivateRoomInvitations = acceptPrivateRoomInvitations; ServerConnectionOptions = serverConnectionOptions?.WithoutInactivityTimeout(); PeerConnectionOptions = peerConnectionOptions; TransferConnectionOptions = transferConnectionOptions?.WithoutInactivityTimeout(); IncomingConnectionOptions = incomingConnectionOptions; DistributedConnectionOptions = distributedConnectionOptions; UserEndPointCache = userEndPointCache; SearchResponseResolver = searchResponseResolver; SearchResponseCache = searchResponseCache; BrowseResponseResolver = browseResponseResolver; DirectoryContentsResolver = directoryContentsResolver; UserInfoResolver = userInfoResolver; EnqueueDownload = enqueueDownload; PlaceInQueueResolver = placeInQueueResolver; }