From 78f9f6c3982255b0e38ab6b35e47bafa3a6386c1 Mon Sep 17 00:00:00 2001 From: vlad zverzhkhovskiy Date: Wed, 6 Aug 2025 17:14:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BC=D0=B5=D0=B6=D1=83?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=B0=D1=8F=20=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Sphagnum.Client/ClientDefault.cs | 3 ++- .../Contracts/IConnectionFactory.cs | 15 --------------- .../Infrastructure/Services/ConnectionFactory.cs | 4 ++-- 3 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 src/Sphagnum.Common/Infrastructure/Contracts/IConnectionFactory.cs diff --git a/src/Sphagnum.Client/ClientDefault.cs b/src/Sphagnum.Client/ClientDefault.cs index 4a5fe8e..b5044de 100644 --- a/src/Sphagnum.Client/ClientDefault.cs +++ b/src/Sphagnum.Client/ClientDefault.cs @@ -1,4 +1,5 @@ using Sphagnum.Common.Infrastructure.Contracts; +using Sphagnum.Common.Infrastructure.Services; using Sphagnum.Common.Messaging.Contracts; using Sphagnum.Common.Messaging.Contracts.Messages; using Sphagnum.Common.Messaging.Utils; @@ -14,7 +15,7 @@ namespace Sphagnum.Client private readonly IConnection _connection; private readonly Channel _commonMessagesChannel = Channel.CreateUnbounded(); private readonly CancellationTokenSource _cts = new CancellationTokenSource(); - public ClientDefault(IConnectionFactory factory) + public ClientDefault(ConnectionFactory factory) { _connection = factory.CreateConnection().Result; } diff --git a/src/Sphagnum.Common/Infrastructure/Contracts/IConnectionFactory.cs b/src/Sphagnum.Common/Infrastructure/Contracts/IConnectionFactory.cs deleted file mode 100644 index 0ff2b08..0000000 --- a/src/Sphagnum.Common/Infrastructure/Contracts/IConnectionFactory.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Sphagnum.Common.Old.Contracts.Login; -using System.Threading.Tasks; - -namespace Sphagnum.Common.Infrastructure.Contracts -{ - public interface IConnectionFactory - { - public int Port { get; } - public string Hostname { get; } - public string Login { get; } - public string Password { get; } - public UserRights UserRights { get; set; } - internal Task CreateConnection(bool connected = true); - } -} diff --git a/src/Sphagnum.Common/Infrastructure/Services/ConnectionFactory.cs b/src/Sphagnum.Common/Infrastructure/Services/ConnectionFactory.cs index b4f6ec1..7a327da 100644 --- a/src/Sphagnum.Common/Infrastructure/Services/ConnectionFactory.cs +++ b/src/Sphagnum.Common/Infrastructure/Services/ConnectionFactory.cs @@ -5,14 +5,14 @@ using System.Threading.Tasks; namespace Sphagnum.Common.Infrastructure.Services { - public class ConnectionFactory : IConnectionFactory + public class ConnectionFactory { public int Port { get; set; } public string Hostname { get; set; } = string.Empty; public string Login { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public UserRights UserRights { get; set; } - async Task IConnectionFactory.CreateConnection(bool connected = true) + internal virtual async Task CreateConnection(bool connected = true) { var conn = new SocketConnection(new Socket(SocketType.Stream, ProtocolType.Tcp)); if (connected)