From ac6f113e36476fe25016a5ae073bc18be91301fd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 29 Jun 2022 08:27:30 -0500 Subject: rename extensions, add a mapper for stats --- src/slskd/Core/CoreExtensions.cs | 75 ---------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/slskd/Core/CoreExtensions.cs (limited to 'src/slskd/Core/CoreExtensions.cs') diff --git a/src/slskd/Core/CoreExtensions.cs b/src/slskd/Core/CoreExtensions.cs deleted file mode 100644 index aef187b8..00000000 --- a/src/slskd/Core/CoreExtensions.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd -{ - using System; - using System.Net.Sockets; - using Soulseek; - - /// - /// Core extensions; extensions for types specific to Soulseek or slskd. - /// - public static class CoreExtensions - { - /// - /// Redacts this instance of Options, replacing properties marked with with '*****'. - /// - /// - /// Creates a deep clone before redacting. - /// - /// The Options instance to redact. - /// A redacted instance. - public static Options Redact(this Options options) - { - var redacted = options.ToJson().FromJson(); - Redactor.Redact(redacted, redactWith: "*****"); - return redacted; - } - - /// - /// Creates a copy of this instance with the specified parameters changed. - /// - /// The options instance to copy. - /// The read buffer size for underlying TCP connections. - /// The write buffer size for underlying TCP connections. - /// The size of the write queue for double buffered writes. - /// The connection timeout, in milliseconds, for client and peer TCP connections. - /// The inactivity timeout, in milliseconds, for peer TCP connections. - /// Optional SOCKS 5 proxy configuration options. - /// - /// The delegate invoked during instantiation to configure the server Socket instance. - /// - /// The new instance. - public static ConnectionOptions With( - this ConnectionOptions o, - int? readBufferSize = null, - int? writeBufferSize = null, - int? writeQueueSize = null, - int? connectTimeout = null, - int? inactivityTimeout = null, - ProxyOptions proxyOptions = null, - Action configureSocketAction = null) => new ConnectionOptions( - readBufferSize: readBufferSize ?? o.ReadBufferSize, - writeBufferSize: writeBufferSize ?? o.WriteBufferSize, - writeQueueSize: writeQueueSize ?? o.WriteQueueSize, - connectTimeout: connectTimeout ?? o.ConnectTimeout, - inactivityTimeout: inactivityTimeout ?? o.InactivityTimeout, - proxyOptions: proxyOptions ?? o.ProxyOptions, - configureSocket: configureSocketAction ?? o.ConfigureSocket); - } -} -- cgit v1.2.3