Пример #1
0
        /// <summary>
        ///     Creates a clone of this instance with the substitutions in the specified <paramref name="patch"/> applied.
        /// </summary>
        /// <param name="patch">The patch containing the desired substitutions.</param>
        /// <returns>The cloned instance.</returns>
        /// <exception cref="ArgumentNullException">Thrown when the specified <paramref name="patch"/> is null.</exception>
        public SoulseekClientOptions With(SoulseekClientOptionsPatch patch)
        {
            if (patch == null)
            {
                throw new ArgumentNullException(nameof(patch), "Must not be null");
            }

            return(With(
                       enableListener: patch.EnableListener,
                       listenPort: patch.ListenPort,
                       enableDistributedNetwork: patch.EnableDistributedNetwork,
                       acceptDistributedChildren: patch.AcceptDistributedChildren,
                       distributedChildLimit: patch.DistributedChildLimit,
                       maximumUploadSpeed: patch.MaximumUploadSpeed,
                       maximumDownloadSpeed: patch.MaximumDownloadSpeed,
                       deduplicateSearchRequests: patch.DeduplicateSearchRequests,
                       autoAcknowledgePrivateMessages: patch.AutoAcknowledgePrivateMessages,
                       autoAcknowledgePrivilegeNotifications: patch.AutoAcknowledgePrivilegeNotifications,
                       acceptPrivateRoomInvitations: patch.AcceptPrivateRoomInvitations,
                       serverConnectionOptions: patch.ServerConnectionOptions,
                       peerConnectionOptions: patch.PeerConnectionOptions,
                       transferConnectionOptions: patch.TransferConnectionOptions,
                       incomingConnectionOptions: patch.IncomingConnectionOptions,
                       distributedConnectionOptions: patch.DistributedConnectionOptions,
                       userEndPointCache: patch.UserEndPointCache,
                       searchResponseResolver: patch.SearchResponseResolver,
                       searchResponseCache: patch.SearchResponseCache,
                       browseResponseResolver: patch.BrowseResponseResolver,
                       directoryContentsResolver: patch.DirectoryContentsResolver,
                       userInfoResolver: patch.UserInfoResolver,
                       enqueueDownload: patch.EnqueueDownload,
                       placeInQueueResolver: patch.PlaceInQueueResolver));
        }
        /// <summary>
        ///     Creates a clone of this instance with the substitutions in the specified <paramref name="patch"/> applied.
        /// </summary>
        /// <param name="patch">The patch containing the desired substitutions.</param>
        /// <returns>The cloned instance.</returns>
        /// <exception cref="ArgumentNullException">Thrown when the specified <paramref name="patch"/> is null.</exception>
        public SoulseekClientOptions With(SoulseekClientOptionsPatch patch)
        {
            if (patch == null)
            {
                throw new ArgumentNullException(nameof(patch), "Must not be null");
            }

            return(With(
                       patch.EnableListener,
                       patch.ListenPort,
                       patch.EnableDistributedNetwork,
                       patch.AcceptDistributedChildren,
                       patch.DistributedChildLimit,
                       patch.DeduplicateSearchRequests,
                       patch.AutoAcknowledgePrivateMessages,
                       patch.AutoAcknowledgePrivilegeNotifications,
                       patch.AcceptPrivateRoomInvitations,
                       patch.ServerConnectionOptions,
                       patch.PeerConnectionOptions,
                       patch.TransferConnectionOptions,
                       patch.IncomingConnectionOptions,
                       patch.DistributedConnectionOptions));
        }