From baacbe3d41bb0c52e20dc9f5f7345197e3f065e4 Mon Sep 17 00:00:00 2001 From: SHM Date: Tue, 5 Aug 2025 09:18:01 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20UniqueKeyApi=20?= =?UTF-8?q?=EA=B5=AC=EB=B2=84=EC=A0=84=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/HubX/Config/HubX.WebApiConfig.json | 32 -- Projects/HubX/Config/log4net.config | 85 ----- Projects/HubX/DBPatch/CreateHubXDB.bat | 17 - Projects/HubX/DBPatch/UpdateHubXDB.bat | 25 -- Projects/HubX/DBPatch/_CreateDB.bat | 18 -- Projects/HubX/DBPatch/_UpdateDB.bat | 19 -- .../HubX/DBPatch/_UpdateScriptGenerate.bat | 12 - .../DBPatch/sqlScripts/HubX.DB_Create.sql | 304 ------------------ .../DBPatch/sqlScripts/HubX.DB_Update.sql | 58 ---- .../DBPatch/sqlScripts/dacpac/HubX.DB.dacpac | Bin 3028 -> 0 bytes Projects/HubX/HubX.DB/HubX.DB.refactorlog | 10 - Projects/HubX/HubX.DB/HubX.DB.sqlproj | 78 ----- Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql | 10 - .../DB/HubX/Context/HubXContext.cs | 57 ---- .../DB/HubX/Tables/TStorage.cs | 21 -- .../HubX.Library.DB/HubX.Library.DB.csproj | 21 -- .../HubX/HubX.Library/Config/WebApiConfig.cs | 20 -- .../HubX/HubX.Library/Enums/EnumResult.cs | 14 - .../HubX/HubX.Library/Http/Packet/Packet.cs | 61 ---- .../HubX/HubX.Library/HubX.Library.csproj | 19 -- .../HubX/HubX.Library/Socket/Object/Client.cs | 29 -- .../Socket/Object/EnumObjectType.cs | 14 - .../Socket/Object/ObjectManager.cs | 80 ----- .../Socket/Packet/EnumMessageId.cs | 33 -- .../Socket/Packet/PacketHandler.cs | 186 ----------- .../HubX.Library/Socket/Packet/Protocol.cs | 44 --- .../Socket/Packet/ServerPacketManager.cs | 78 ----- .../Socket/Session/ClientSession.cs | 56 ---- .../Socket/Session/SessionManager.cs | 54 ---- .../Controllers/UniqueKeyController.cs | 87 ----- Projects/HubX/HubX.Server/HubX.Server.csproj | 31 -- Projects/HubX/HubX.Server/HubX.Server.http | 6 - Projects/HubX/HubX.Server/Program.cs | 111 ------- .../Properties/launchSettings.json | 38 --- .../HubX.Server/Services/UniqueKeyService.cs | 195 ----------- .../HubX.Server/TaskManager/TaskSocket.cs | 29 -- .../HubX.Server/appsettings.Development.json | 8 - Projects/HubX/HubX.Server/appsettings.json | 9 - Projects/HubX/HubX.Server/log4net.config | 77 ----- Projects/HubX/HubX.sln | 50 --- Projects/HubX/Tools/Tools_DB_Scaffold.bat | 4 - 41 files changed, 2100 deletions(-) delete mode 100644 Projects/HubX/Config/HubX.WebApiConfig.json delete mode 100644 Projects/HubX/Config/log4net.config delete mode 100644 Projects/HubX/DBPatch/CreateHubXDB.bat delete mode 100644 Projects/HubX/DBPatch/UpdateHubXDB.bat delete mode 100644 Projects/HubX/DBPatch/_CreateDB.bat delete mode 100644 Projects/HubX/DBPatch/_UpdateDB.bat delete mode 100644 Projects/HubX/DBPatch/_UpdateScriptGenerate.bat delete mode 100644 Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql delete mode 100644 Projects/HubX/DBPatch/sqlScripts/HubX.DB_Update.sql delete mode 100644 Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac delete mode 100644 Projects/HubX/HubX.DB/HubX.DB.refactorlog delete mode 100644 Projects/HubX/HubX.DB/HubX.DB.sqlproj delete mode 100644 Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql delete mode 100644 Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs delete mode 100644 Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs delete mode 100644 Projects/HubX/HubX.Library.DB/HubX.Library.DB.csproj delete mode 100644 Projects/HubX/HubX.Library/Config/WebApiConfig.cs delete mode 100644 Projects/HubX/HubX.Library/Enums/EnumResult.cs delete mode 100644 Projects/HubX/HubX.Library/Http/Packet/Packet.cs delete mode 100644 Projects/HubX/HubX.Library/HubX.Library.csproj delete mode 100644 Projects/HubX/HubX.Library/Socket/Object/Client.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Object/EnumObjectType.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Object/ObjectManager.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Packet/EnumMessageId.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Packet/PacketHandler.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Packet/Protocol.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Packet/ServerPacketManager.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Session/ClientSession.cs delete mode 100644 Projects/HubX/HubX.Library/Socket/Session/SessionManager.cs delete mode 100644 Projects/HubX/HubX.Server/Controllers/UniqueKeyController.cs delete mode 100644 Projects/HubX/HubX.Server/HubX.Server.csproj delete mode 100644 Projects/HubX/HubX.Server/HubX.Server.http delete mode 100644 Projects/HubX/HubX.Server/Program.cs delete mode 100644 Projects/HubX/HubX.Server/Properties/launchSettings.json delete mode 100644 Projects/HubX/HubX.Server/Services/UniqueKeyService.cs delete mode 100644 Projects/HubX/HubX.Server/TaskManager/TaskSocket.cs delete mode 100644 Projects/HubX/HubX.Server/appsettings.Development.json delete mode 100644 Projects/HubX/HubX.Server/appsettings.json delete mode 100644 Projects/HubX/HubX.Server/log4net.config delete mode 100644 Projects/HubX/HubX.sln delete mode 100644 Projects/HubX/Tools/Tools_DB_Scaffold.bat diff --git a/Projects/HubX/Config/HubX.WebApiConfig.json b/Projects/HubX/Config/HubX.WebApiConfig.json deleted file mode 100644 index 8e3987f..0000000 --- a/Projects/HubX/Config/HubX.WebApiConfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "Server": { - "Address": "https://*", - "Port": 9000, - "IIS": false - }, - "Socket": { - "Address": "*", - "Port": 9010, - "IIS": false - }, - "DataBase": [ - { - "IP": "127.0.0.1", - "Port": 1433, - "DBName": "HubX", - "DBID": 1, - "DBContext": "HubXContext", - "UserID": "alis", - "Password": "Kefico!@34" - }, - { - "IP": "127.0.0.1", - "Port": 1433, - "DBName": "HubX_DEV", - "DBID": 2, - "DBContext": "HubXContext", - "UserID": "alis", - "Password": "Kefico!@34" - } - ] -} \ No newline at end of file diff --git a/Projects/HubX/Config/log4net.config b/Projects/HubX/Config/log4net.config deleted file mode 100644 index b970851..0000000 --- a/Projects/HubX/Config/log4net.config +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Projects/HubX/DBPatch/CreateHubXDB.bat b/Projects/HubX/DBPatch/CreateHubXDB.bat deleted file mode 100644 index d30859f..0000000 --- a/Projects/HubX/DBPatch/CreateHubXDB.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -::log -IF NOT EXIST .\logs mkdir logs - -::서버연결정보 -SET ServerIP=127.0.0.1 -SET ServerPort=1433 - -::DB 정보 -SET UserID=VPKI -SET Passwd=Kefico!@34 -SET DBName=HubX - -::Default DB -@echo off -CALL _CreateDB.bat %ServerIP% %ServerPort% %UserID% %Passwd% %DBName% -CALL _CreateDB.bat %ServerIP% %ServerPort% %UserID% %Passwd% %DBName%_DEV \ No newline at end of file diff --git a/Projects/HubX/DBPatch/UpdateHubXDB.bat b/Projects/HubX/DBPatch/UpdateHubXDB.bat deleted file mode 100644 index c69bd85..0000000 --- a/Projects/HubX/DBPatch/UpdateHubXDB.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -::log -IF NOT EXIST .\logs mkdir logs - -::서버연결정보 -SET ServerIP=127.0.0.1 -SET ServerPort=1433 - -::DB 정보 -SET UserID=VPKI -SET Passwd=Kefico!@34 -SET DBName=HUBX_001_DEV - -::Update script 정보 -SET Dacpac=.\sqlScripts\dacpac\HubX.DB.dacpac -SET OUTPUT=HubX.DB_Update.sql - - -@echo off -::generate update script -CALL _UpdateScriptGenerate.bat %ServerIP% %ServerPort% %UserID% %Passwd% %DBName% %Dacpac% %OUTPUT% - -::Default DB -CALL _UpdateDB.bat %ServerIP% %ServerPort% %UserID% %Passwd% HubX_001 -CALL _UpdateDB.bat %ServerIP% %ServerPort% %UserID% %Passwd% HubX_001_DEV \ No newline at end of file diff --git a/Projects/HubX/DBPatch/_CreateDB.bat b/Projects/HubX/DBPatch/_CreateDB.bat deleted file mode 100644 index cbe215a..0000000 --- a/Projects/HubX/DBPatch/_CreateDB.bat +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -SET ServerIP=%1 -SET ServerPort=%2 -SET UserID=%3 -SET Passwd=%4 -SET DBName=%5 - -SET SqlCmdOption=-C -U %UserID% -P %Passwd% -S %ServerIP%,%ServerPort% -f 65001 -o .\logs\%DBName%.log -SET DatabaseName=%DBName% -sqlcmd %SqlCmdOption% -i .\sqlScripts\HubX.DB_Create.sql -if errorlevel 1 goto errexit -goto end -:errexit -echo DB Patch Fail -goto end -:end -@echo on \ No newline at end of file diff --git a/Projects/HubX/DBPatch/_UpdateDB.bat b/Projects/HubX/DBPatch/_UpdateDB.bat deleted file mode 100644 index bb2647a..0000000 --- a/Projects/HubX/DBPatch/_UpdateDB.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off - -SET ServerIP=%1 -SET ServerPort=%2 -SET UserID=%3 -SET Passwd=%4 -SET DBName=%5 - -SET SqlCmdOption=-U %UserID% -P %Passwd% -S %ServerIP%,%ServerPort% -d %DBName% -o .\logs\%DBName%.log -SET DatabaseName=%DBName% -sqlcmd %SqlCmdOption% -i .\sqlScripts\HubX.DB_Update.sql - -if errorlevel 1 goto errexit -goto end -:errexit -echo DB Patch Fail -goto end -:end -@echo on \ No newline at end of file diff --git a/Projects/HubX/DBPatch/_UpdateScriptGenerate.bat b/Projects/HubX/DBPatch/_UpdateScriptGenerate.bat deleted file mode 100644 index 0d95840..0000000 --- a/Projects/HubX/DBPatch/_UpdateScriptGenerate.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off - -SET ServerIP=%1 -SET ServerPort=%2 -SET UserID=%3 -SET Passwd=%4 -SET DBName=%5 -SET Dacpac=%6 -SET OUTPUT=%7 - -::create update sql file -sqlpackage /Action:Script /SourceFile:%Dacpac% /TargetConnectionString:"server=%ServerIP%,%ServerPort%; user id=%UserID%; password=%Passwd%; database=%DBName%; TrustServerCertificate=true" /OutputPath:".\sqlScripts\%OUTPUT%" /p:CommentOutSetVarDeclarations=True \ No newline at end of file diff --git a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql b/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql deleted file mode 100644 index 481d1a1..0000000 --- a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql +++ /dev/null @@ -1,304 +0,0 @@ -/* -HubX.DB의 배포 스크립트 - -이 코드는 도구를 사용하여 생성되었습니다. -파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 -변경 내용이 손실됩니다. -*/ - -GO -SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON; - -SET NUMERIC_ROUNDABORT OFF; - - -GO -/* -:setvar DatabaseName "HubX.DB" -:setvar DefaultFilePrefix "HubX.DB" -:setvar DefaultDataPath "" -:setvar DefaultLogPath "" -*/ - -GO -:on error exit -GO -/* -SQLCMD 모드가 지원되지 않으면 SQLCMD 모드를 검색하고 스크립트를 실행하지 않습니다. -SQLCMD 모드를 설정한 후에 이 스크립트를 다시 사용하려면 다음을 실행합니다. -SET NOEXEC OFF; -*/ -:setvar __IsSqlCmdEnabled "True" -GO -IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True' - BEGIN - PRINT N'이 스크립트를 실행하려면 SQLCMD 모드를 사용하도록 설정해야 합니다.'; - SET NOEXEC ON; - END - - -GO -USE [master]; - - -GO - -IF (DB_ID(N'$(DatabaseName)') IS NOT NULL) -BEGIN - ALTER DATABASE [$(DatabaseName)] - SET SINGLE_USER WITH ROLLBACK IMMEDIATE; - DROP DATABASE [$(DatabaseName)]; -END - -GO -PRINT N'$(DatabaseName) 데이터베이스를 만드는 중...' -GO -CREATE DATABASE [$(DatabaseName)] COLLATE Korean_Wansung_CI_AS -GO -USE [$(DatabaseName)]; - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET ANSI_NULLS ON, - ANSI_PADDING ON, - ANSI_WARNINGS ON, - ARITHABORT ON, - CONCAT_NULL_YIELDS_NULL ON, - NUMERIC_ROUNDABORT OFF, - QUOTED_IDENTIFIER ON, - ANSI_NULL_DEFAULT ON, - CURSOR_DEFAULT LOCAL, - RECOVERY FULL, - CURSOR_CLOSE_ON_COMMIT OFF, - AUTO_CREATE_STATISTICS ON, - AUTO_SHRINK OFF, - AUTO_UPDATE_STATISTICS ON, - RECURSIVE_TRIGGERS OFF - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET ALLOW_SNAPSHOT_ISOLATION OFF; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET READ_COMMITTED_SNAPSHOT OFF - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET AUTO_UPDATE_STATISTICS_ASYNC OFF, - PAGE_VERIFY NONE, - DATE_CORRELATION_OPTIMIZATION OFF, - DISABLE_BROKER, - PARAMETERIZATION SIMPLE, - SUPPLEMENTAL_LOGGING OFF - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF IS_SRVROLEMEMBER(N'sysadmin') = 1 - BEGIN - IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)] - SET TRUSTWORTHY OFF, - DB_CHAINING OFF - WITH ROLLBACK IMMEDIATE'; - END - END -ELSE - BEGIN - PRINT N'데이터베이스 설정을 수정할 수 없습니다. 이러한 설정을 적용하려면 SysAdmin이어야 합니다.'; - END - - -GO -IF IS_SRVROLEMEMBER(N'sysadmin') = 1 - BEGIN - IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)] - SET HONOR_BROKER_PRIORITY OFF - WITH ROLLBACK IMMEDIATE'; - END - END -ELSE - BEGIN - PRINT N'데이터베이스 설정을 수정할 수 없습니다. 이러한 설정을 적용하려면 SysAdmin이어야 합니다.'; - END - - -GO -ALTER DATABASE [$(DatabaseName)] - SET TARGET_RECOVERY_TIME = 0 SECONDS - WITH ROLLBACK IMMEDIATE; - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET FILESTREAM(NON_TRANSACTED_ACCESS = OFF), - CONTAINMENT = NONE - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET AUTO_CREATE_STATISTICS ON(INCREMENTAL = OFF), - MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT = OFF, - DELAYED_DURABILITY = DISABLED - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET QUERY_STORE (QUERY_CAPTURE_MODE = ALL, DATA_FLUSH_INTERVAL_SECONDS = 900, INTERVAL_LENGTH_MINUTES = 60, MAX_PLANS_PER_QUERY = 200, CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 367), MAX_STORAGE_SIZE_MB = 100) - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET QUERY_STORE = OFF - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = 0; - ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET MAXDOP = PRIMARY; - ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION = OFF; - ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET LEGACY_CARDINALITY_ESTIMATION = PRIMARY; - ALTER DATABASE SCOPED CONFIGURATION SET PARAMETER_SNIFFING = ON; - ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING = PRIMARY; - ALTER DATABASE SCOPED CONFIGURATION SET QUERY_OPTIMIZER_HOTFIXES = OFF; - ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET QUERY_OPTIMIZER_HOTFIXES = PRIMARY; - END - - -GO -IF EXISTS (SELECT 1 - FROM [master].[dbo].[sysdatabases] - WHERE [name] = N'$(DatabaseName)') - BEGIN - ALTER DATABASE [$(DatabaseName)] - SET TEMPORAL_HISTORY_RETENTION ON - WITH ROLLBACK IMMEDIATE; - END - - -GO -IF fulltextserviceproperty(N'IsFulltextInstalled') = 1 - EXECUTE sp_fulltext_database 'enable'; - - -GO -PRINT N'테이블 [dbo].[tStorage]을(를) 만드는 중...'; - - -GO -CREATE TABLE [dbo].[tStorage] ( - [cIdentity] NVARCHAR (200) NOT NULL, - [cDateTime] DATETIME2 (7) NOT NULL, - [cData1] NVARCHAR (4000) NULL, - [cData2] NVARCHAR (4000) NULL, - [cData3] NVARCHAR (4000) NULL, - [cData4] NVARCHAR (4000) NULL, - [cData5] NVARCHAR (4000) NULL, - PRIMARY KEY CLUSTERED ([cIdentity] ASC) -); - - -GO --- 배포된 트랜잭션 로그를 사용하여 대상 서버를 업데이트하는 리팩터링 단계 - -IF OBJECT_ID(N'dbo.__RefactorLog') IS NULL -BEGIN - CREATE TABLE [dbo].[__RefactorLog] (OperationKey UNIQUEIDENTIFIER NOT NULL PRIMARY KEY) - EXEC sp_addextendedproperty N'microsoft_database_tools_support', N'refactoring log', N'schema', N'dbo', N'table', N'__RefactorLog' -END -GO -IF NOT EXISTS (SELECT OperationKey FROM [dbo].[__RefactorLog] WHERE OperationKey = '938971a7-29c7-4cec-9307-c9f403986551') -INSERT INTO [dbo].[__RefactorLog] (OperationKey) values ('938971a7-29c7-4cec-9307-c9f403986551') - -GO - -GO -DECLARE @VarDecimalSupported AS BIT; - -SELECT @VarDecimalSupported = 0; - -IF ((ServerProperty(N'EngineEdition') = 3) - AND (((@@microsoftversion / power(2, 24) = 9) - AND (@@microsoftversion & 0xffff >= 3024)) - OR ((@@microsoftversion / power(2, 24) = 10) - AND (@@microsoftversion & 0xffff >= 1600)))) - SELECT @VarDecimalSupported = 1; - -IF (@VarDecimalSupported > 0) - BEGIN - EXECUTE sp_db_vardecimal_storage_format N'$(DatabaseName)', 'ON'; - END - - -GO -ALTER DATABASE [$(DatabaseName)] - SET MULTI_USER - WITH ROLLBACK IMMEDIATE; - - -GO -PRINT N'업데이트가 완료되었습니다.'; - - -GO diff --git a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Update.sql b/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Update.sql deleted file mode 100644 index f3c781f..0000000 --- a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Update.sql +++ /dev/null @@ -1,58 +0,0 @@ -/* -HUBX_001_DEV의 배포 스크립트 - -이 코드는 도구를 사용하여 생성되었습니다. -파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 -변경 내용이 손실됩니다. -*/ - -GO -SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON; - -SET NUMERIC_ROUNDABORT OFF; - - -GO -/* -:setvar DatabaseName "HUBX_001_DEV" -:setvar DefaultFilePrefix "HUBX_001_DEV" -:setvar DefaultDataPath "D:\MSSQL\DATA\" -:setvar DefaultLogPath "D:\MSSQL\DATA\" -*/ - -GO -:on error exit -GO -/* -SQLCMD 모드가 지원되지 않으면 SQLCMD 모드를 검색하고 스크립트를 실행하지 않습니다. -SQLCMD 모드를 설정한 후에 이 스크립트를 다시 사용하려면 다음을 실행합니다. -SET NOEXEC OFF; -*/ -:setvar __IsSqlCmdEnabled "True" -GO -IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True' - BEGIN - PRINT N'이 스크립트를 실행하려면 SQLCMD 모드를 사용하도록 설정해야 합니다.'; - SET NOEXEC ON; - END - - -GO -USE [$(DatabaseName)]; - - -GO -PRINT N'테이블 [dbo].[tStorage]을(를) 변경하는 중...'; - - -GO -ALTER TABLE [dbo].[tStorage] - ADD [cData4] NVARCHAR (4000) NULL, - [cData5] NVARCHAR (4000) NULL; - - -GO -PRINT N'업데이트가 완료되었습니다.'; - - -GO diff --git a/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac b/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac deleted file mode 100644 index 56825d6e95b02ec16613cda69a4fdd1acc08a321..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3028 zcmai0XHe5$7X48Ip+%${DbkT1NI*K$n-Hl20tN_3hY%E0s+6Ty1u23wrAY~d5=B6y z7X=aNsB|SD9TD05zwC&+JKi_7GGQ03&kbqe~{AMVdj;@ei)aw8b2zW?Q&OT1=6aWEEP)WlcMNjRfpRV6*Boaj*5v; z+XwhK)fC30O4Z#Gq+_L*(-1dpdxnbcN1~O>uRRCzL6u~YtT_%nKSPQX%Mw8je(2!d zJ!k=84dvxlgJx`F9ou2E<6!^#{DSJ zzp*qho2Ftn!fMfEY`&OC#&RW^dxSG2$)19#%VWL^T8s z0=*AGOjge}SrKbSUvZY??`c0(fad14eyxutt}K{sWA@G@CL8B$=&T!Wk4|}Zdhg$f zBGy@W#^V^_z&TU2XdmdMdUN6zW8Q_G^A3GMpXwXKMpOJNU$CXGhj~5drK+qLDl6o^ zUpMM{rRaNNPa1fi2ihPo5Lcr_j7&A|Ba;o85!k6Ac=mf1!XvXL4xa{-&4P0V*f$%X zkBkyVunCd-==W4okDd8%u>>mhePldOwM>~qJ5nM8tA;$4`)WLkT9fTsidLf65dXrN z9ndq{vx!@gYl;IG8?%jN;k!U&8z9p@A4#wkEPuMbMV>+46~i!VVNGyxoJ*cM~J*4pQo`2 zYk_v;5q;Bl3vx}qFzlNt+OI#OjtYa@sdNa#92?=`>tW(8TW!g(p3bpnqE^gQxa!ws zln7RFhne>H%;qTBEDzHwZuLvt=f7*kT{2iqXj!%qT4ld)Bu{CvI_;K{D{a*|qDwcJ zB{TCzLr)@vJ2&7c5m)gw%AvAK&?CTAA)!8ZR8&l)IlP!RwfC+bQq90nqZuDJ9@)Si zGo9GhJvc7hk8Wvw&R}K7-Nr>}YvjyE+NB5@^*F-G>33#)DN$3CS#gei z5%3Fd*3>xk`E@1xYIwG)bZ$cz^_!Yt-bLA0RzALxJD$D@Gzpj<|GeS$ZE*{M9T7Gf zMceYu7&zPkd9`hB&WNr7X@iku;HN4J>(k>OZ`XMtWLb9)er-JtM3#dzt&&QrpF+IQ z_aMW{HgRvpK9(e}u&5A&N+o%|S#vQW;DtjBi`4|T?hGF5JYZ#;d}t$PS1b}(MWad! zGVG8V+0oQKE-H@Fg>sBAhFG{YAAC#g-re%UMlIiXtLM1x7rBdz)Yz-un4{q-dc$bM>Os{>> zhr9-d8v7G!)89IMg{Z%E153F#j_g`WnD=Igy_o|p*4|KZN z9A$TTyFT3&HXI?qZvB?&LWFW+o%(`>n8Egt1%b;<=DPpO2oEC4bmL`V#v2;L!s081 z#W|%jY%+Wew?KAx=dkDe9U0;X$gvKnt0)g`QPz|mH5;y0kiC-9*56u9UQXX8_Itd zPf~45OwJ@XznSn?AKE#Hhkc@>dFraWdGPgv=EnoWIj1?3))TJozTG*p(<0osCxd=M z8Y8brd4?o{7Ru=g8jEs9VNrk60g+To+ab*ndAt2Kcw%tw7L&eN3dC44uBi(?shH#e(n8ixv7s-WeZuHJRzh1m+I936?V38#cV$ z%`R?vorZ_)(E;XFc&0}P(ZHSVo{Yw@Wk`Tt(OW&xd9H+S19n|lGVO=#DXefWrjGFu z_gX0AuBDVhg7?5}hYP8Js-HK{Fwy)(cAh`Y^t!?Et_Z2r>_{V(mc-Nq& z=KV=I(kwGpYibwpT$>aF{Ny@81{R1sJ$=IMHUUe()zfTnpgQ24$(q!A0rea?T=})b z*}Fsq)&1=Jxln=q;Q(~7ld0dkVmZtcuUa8?kk4M(%-Trox1(>z1n0}!y1n}^YUvBE zmIc540Vh*mq_#9${Ggnv5o=0leinYGoF%4Dv*#D@tV zf^p&N^7#S1p`{4Jb%?9$0Y0Kp`kQ%dW;UY5jQ8;Qn1-m5rq49RG-F2C6kZ^C346;= zJye|j?6}mqc6+1OGT56}b&`@_e2jHtxkSjNq$I`_>|7=9+ImMX8W7DZ1fl2B!b?96 z^!?oJZPf8E#+`P`3*WSEMX9(?u$(x8v1cPgSQ4_HSL$ZnW$}8h6jK-DXQp^}ri$?a zMt&KAX*A~={8ZM0yQ68!vh!=sdK*7dGcg(txJ1sC^!Qz?R|88ob+WgnK$6B zS*D=vM-#D6Zc8m@D+R4QleD3Bs5vh@uQUBqu`J(;p{#JB?iH48}X~yX4kpXThI}WGG7NpNSC|gmP&*;1&hjI>G@&c=P z&CmR~jqS1Jpp~)suJ<6h8Zj|sr>e4|H@%T5yY401;80xyQ7eUWH?=?0zz!c$W%e<~ z`kTi1`KB#?yn+3-3hfBC;Cf5V=6KQh5U8j&CzP=VC%GHL(0{Tn^%3^xD( diff --git a/Projects/HubX/HubX.DB/HubX.DB.refactorlog b/Projects/HubX/HubX.DB/HubX.DB.refactorlog deleted file mode 100644 index 4ce84bb..0000000 --- a/Projects/HubX/HubX.DB/HubX.DB.refactorlog +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Projects/HubX/HubX.DB/HubX.DB.sqlproj b/Projects/HubX/HubX.DB/HubX.DB.sqlproj deleted file mode 100644 index 8604569..0000000 --- a/Projects/HubX/HubX.DB/HubX.DB.sqlproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - Debug - AnyCPU - HubX.DB - 2.0 - 4.1 - {514ddccf-6b50-49f8-b212-70498396cf19} - Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider - Database - - - HubX.DB - HubX.DB - 1042,CI - BySchemaAndSchemaType - True - v4.7.2 - CS - Properties - False - True - True - True - Korean_Wansung_CI_AS - - - bin\Release\ - $(MSBuildProjectName).sql - False - pdbonly - true - false - true - prompt - 4 - - - bin\Debug\ - $(MSBuildProjectName).sql - true - true - full - false - true - true - prompt - 4 - - - 11.0 - - True - 11.0 - - - - - - - - - - - - - - - - - - - xcopy /y $(ProjectDir)$(OutputPath)$(TargetName)_Create.sql $(SolutionDir)DBPatch\sqlScripts\ - -xcopy /y $(ProjectDir)$(OutputPath)$(TargetName).dacpac $(SolutionDir)DBPatch\sqlScripts\dacpac\ - - \ No newline at end of file diff --git a/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql b/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql deleted file mode 100644 index c813a44..0000000 --- a/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE [dbo].[tStorage] -( - [cIdentity] NVARCHAR(200) NOT NULL PRIMARY KEY, - [cDateTime] DATETIME2 NOT NULL, - [cData1] NVARCHAR(4000), - [cData2] NVARCHAR(4000), - [cData3] NVARCHAR(4000), - [cData4] NVARCHAR(4000), - [cData5] NVARCHAR(4000), -) diff --git a/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs b/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs deleted file mode 100644 index 488d700..0000000 --- a/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore; - -namespace DB.HubXDB; - -public partial class HubXContext : DbContext -{ - public HubXContext() - { - } - - public HubXContext(DbContextOptions options) - : base(options) - { - } - - public virtual DbSet TStorages { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) -#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. - => optionsBuilder.UseSqlServer("server=127.0.0.1; user id=alis; password=Kefico!@34; database=HubX; TrustServerCertificate=true;"); - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.CIdentity).HasName("PK__tStorage__3EBC650D3753A7B8"); - - entity.ToTable("tStorage"); - - entity.Property(e => e.CIdentity) - .HasMaxLength(200) - .HasColumnName("cIdentity"); - entity.Property(e => e.CData1) - .HasMaxLength(4000) - .HasColumnName("cData1"); - entity.Property(e => e.CData2) - .HasMaxLength(4000) - .HasColumnName("cData2"); - entity.Property(e => e.CData3) - .HasMaxLength(4000) - .HasColumnName("cData3"); - entity.Property(e => e.CData4) - .HasMaxLength(4000) - .HasColumnName("cData4"); - entity.Property(e => e.CData5) - .HasMaxLength(4000) - .HasColumnName("cData5"); - entity.Property(e => e.CDateTime).HasColumnName("cDateTime"); - }); - - OnModelCreatingPartial(modelBuilder); - } - - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); -} diff --git a/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs b/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs deleted file mode 100644 index 7721130..0000000 --- a/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DB.HubXDB; - -public partial class TStorage -{ - public string CIdentity { get; set; } = null!; - - public DateTime CDateTime { get; set; } - - public string? CData1 { get; set; } - - public string? CData2 { get; set; } - - public string? CData3 { get; set; } - - public string? CData4 { get; set; } - - public string? CData5 { get; set; } -} diff --git a/Projects/HubX/HubX.Library.DB/HubX.Library.DB.csproj b/Projects/HubX/HubX.Library.DB/HubX.Library.DB.csproj deleted file mode 100644 index a15a195..0000000 --- a/Projects/HubX/HubX.Library.DB/HubX.Library.DB.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net8.0 - enable - enable - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - diff --git a/Projects/HubX/HubX.Library/Config/WebApiConfig.cs b/Projects/HubX/HubX.Library/Config/WebApiConfig.cs deleted file mode 100644 index 45e1939..0000000 --- a/Projects/HubX/HubX.Library/Config/WebApiConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; -using SystemX.Core.Config; -using SystemX.Core.Config.Model; - -namespace HubX.Library.Config -{ - public class WebApiConfig : WebCommonConfig - { - [JsonPropertyName("DataBase")] - public List? DataBase { get; set; } - - [JsonPropertyName("Socket")] - public Server Socket { get; set; } - } -} diff --git a/Projects/HubX/HubX.Library/Enums/EnumResult.cs b/Projects/HubX/HubX.Library/Enums/EnumResult.cs deleted file mode 100644 index 46c876f..0000000 --- a/Projects/HubX/HubX.Library/Enums/EnumResult.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Enums -{ - public enum EnumResult - { - Success = 1, - Failed = 2, - } -} diff --git a/Projects/HubX/HubX.Library/Http/Packet/Packet.cs b/Projects/HubX/HubX.Library/Http/Packet/Packet.cs deleted file mode 100644 index 0c2921d..0000000 --- a/Projects/HubX/HubX.Library/Http/Packet/Packet.cs +++ /dev/null @@ -1,61 +0,0 @@ -using DB.HubXDB; -using HubX.Library.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Http.Packet -{ - #region Unique Key - //Insert - public class Request_InsertUniqueKey - { - public string Identity { get; set; } = string.Empty; - - public string? Data1 { get; set; } = string.Empty; - public string? Data2 { get; set; } = string.Empty; - public string? Data3 { get; set; } = string.Empty; - public string? Data4 { get; set; } = string.Empty; - public string? Data5 { get; set; } = string.Empty; - } - public class Response_InsertUniqueKy - { - public string? Identity { get; set; } = string.Empty; - public string? Result { get; set; } = EnumResult.Success.ToString(); - } - - //Select - public class Request_SelectUniqueKey - { - public string Identity { get; set; } = string.Empty; - } - public class Response_SelectUniqueKy - { - public string? Identity { get; set; } = string.Empty; - public string? Data1 { get; set; } = string.Empty; - public string? Data2 { get; set; } = string.Empty; - public string? Data3 { get; set; } = string.Empty; - public string? Data4 { get; set; } = string.Empty; - public string? Data5 { get; set; } = string.Empty; - } - - //Update - public class Request_UpdateUniqueKey - { - public string Identity { get; set; } = string.Empty; - - public string? Data1 { get; set; } = string.Empty; - public string? Data2 { get; set; } = string.Empty; - public string? Data3 { get; set; } = string.Empty; - public string? Data4 { get; set; } = string.Empty; - public string? Data5 { get; set; } = string.Empty; - } - public class Response_UpdateUniqueKy - { - public string? Identity { get; set; } = string.Empty; - public string? Result { get; set; } = EnumResult.Success.ToString(); - } - #endregion -} diff --git a/Projects/HubX/HubX.Library/HubX.Library.csproj b/Projects/HubX/HubX.Library/HubX.Library.csproj deleted file mode 100644 index 766fa05..0000000 --- a/Projects/HubX/HubX.Library/HubX.Library.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - ..\..\DLL\SystemX.Core.dll - - - - diff --git a/Projects/HubX/HubX.Library/Socket/Object/Client.cs b/Projects/HubX/HubX.Library/Socket/Object/Client.cs deleted file mode 100644 index f2f957a..0000000 --- a/Projects/HubX/HubX.Library/Socket/Object/Client.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using HubX.Library.Socket.Session; - -namespace HubX.Library.Socket.Object -{ - public class Client - { - - public EnumObjectType ObjectType = EnumObjectType.Client; - - private int ClientId; - public int Id - { - get { return ClientId; } - set { ClientId = value; } - } - - public ClientSession Session { get; set; } - - public Client() - { - - } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Object/EnumObjectType.cs b/Projects/HubX/HubX.Library/Socket/Object/EnumObjectType.cs deleted file mode 100644 index 84888f3..0000000 --- a/Projects/HubX/HubX.Library/Socket/Object/EnumObjectType.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Socket.Object -{ - public enum EnumObjectType - { - NONE = 0, - Client = 1, - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Object/ObjectManager.cs b/Projects/HubX/HubX.Library/Socket/Object/ObjectManager.cs deleted file mode 100644 index 8812d84..0000000 --- a/Projects/HubX/HubX.Library/Socket/Object/ObjectManager.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Socket.Object -{ - public class ObjectManager - { - public static ObjectManager Instance { get; } = new ObjectManager(); - - object _lock = new object(); - Dictionary _players = new Dictionary(); - - // [UNUSED(1)][TYPE(7)][ID(24)] - int _counter = 0; - - public T Add() where T : Client, new() - { - T gameObject = new T(); - - lock (_lock) - { - gameObject.Id = GenerateId(gameObject.ObjectType); - - if (gameObject.ObjectType == EnumObjectType.Client) - { - _players.Add(gameObject.Id, gameObject as Client); - } - } - - return gameObject; - } - - int GenerateId(EnumObjectType type) - { - lock (_lock) - { - return ((int)type << 24) | (_counter++); - } - } - - public static EnumObjectType GetObjectTypeById(int id) - { - int type = (id >> 24) & 0x7F; - return (EnumObjectType)type; - } - - public bool Remove(int objectId) - { - EnumObjectType objectType = GetObjectTypeById(objectId); - - lock (_lock) - { - if (objectType == EnumObjectType.Client) - return _players.Remove(objectId); - } - - return false; - } - - public Client Find(int objectId) - { - EnumObjectType objectType = GetObjectTypeById(objectId); - - lock (_lock) - { - if (objectType == EnumObjectType.Client) - { - Client player = null; - if (_players.TryGetValue(objectId, out player)) - return player; - } - } - - return null; - } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Packet/EnumMessageId.cs b/Projects/HubX/HubX.Library/Socket/Packet/EnumMessageId.cs deleted file mode 100644 index 20c5e92..0000000 --- a/Projects/HubX/HubX.Library/Socket/Packet/EnumMessageId.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Socket.Packet -{ - public enum EnumMessageId - { - //C2S : Client to Server - //S2C : Server to Client - - //unique key CRUD - C2S_INSERT_UniqueKey = 10, - S2C_INSERT_UniqueKey = 11, - C2S_SELECT_UniqueKey = 12, - S2C_SELECT_UniqueKey = 13, - C2S_UPDATE_UniqueKey = 14, - S2C_UPDATE_UniqueKey = 15, - C2S_DELETE_UniqueKey = 16, - S2C_DELETE_UniqueKey = 17, - } - - public enum EnumMessageResult - { - None = 0, - - Success = 10, - Failed = 10, - Error = 11, - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Packet/PacketHandler.cs b/Projects/HubX/HubX.Library/Socket/Packet/PacketHandler.cs deleted file mode 100644 index 594a955..0000000 --- a/Projects/HubX/HubX.Library/Socket/Packet/PacketHandler.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Azure.Core; -using DB.HubXDB; -using HubX.Library.Http.Packet; -using HubX.Library.Socket.Object; -using HubX.Library.Socket.Session; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; -using SystemX.Core.Communication; - -namespace HubX.Library.Socket.Packet -{ - - public class PacketHandler - { - public static async void C2S_INSERT_UniqueKeyHandler(PacketSession session, ArraySegment buffer) - { - var recvData = Encoding.UTF8.GetString(buffer); - - //json으로 요청인지 확인 - bool isJsonRequest = true; - - //convert to object - var jsonObject = recvData.ToObject(); - //json 요청 아닐때 변환 - if (jsonObject == null) - { - var recvDataList = recvData.Split(","); - jsonObject = new C2S_INSERT_UniqueKey - { - Identity = recvDataList[0], - Data1 = recvDataList[1], - Data2 = recvDataList[2], - Data3 = recvDataList[3], - Data4 = recvDataList[4], - Data5 = recvDataList[5], - }; - isJsonRequest = false; - } - - string result = string.Empty; - //insert DB - if(jsonObject != null) - { - Request_InsertUniqueKey request = new Request_InsertUniqueKey(); - request.Identity = jsonObject.Identity; - request.Data1 = jsonObject.Data1; - request.Data2 = jsonObject.Data2; - request.Data3 = jsonObject.Data3; - request.Data4 = jsonObject.Data4; - request.Data5 = jsonObject.Data5; - - await Task.Run(async () => - { - SystemX.Core.Communication.Http http = new(); - var res = await http.PostJsonAsync("https://127.0.0.1:9000/UniqueKey/InsertUniqueKey", request); - result = res.ToJson(); - - //json 요청이 아니면 변환 - if (isJsonRequest == false) - { - if (res != null) - result = $"{res.Identity},{res.Result}"; - } - }); - } - - ClientSession clientSession = session as ClientSession; - Client client = clientSession.Client; - if (client == null) - return; - - client.Session.Send(Encoding.UTF8.GetBytes(result) ,EnumMessageId.S2C_INSERT_UniqueKey); - } - - public static async void C2S_SELECT_UniqueKeyHandler(PacketSession session, ArraySegment buffer) - { - var recvData = Encoding.UTF8.GetString(buffer); - - //json으로 요청인지 확인 - bool isJsonRequest = true; - - //convert to object - var jsonObject = recvData.ToObject(); - //json 요청 아닐때 변환 - if (jsonObject == null) - { - var recvDataList = recvData.Split(","); - jsonObject = new C2S_SELECT_UniqueKey - { - Identity = recvDataList[0] - }; - isJsonRequest = false; - } - - string result = string.Empty; - //select DB - if (jsonObject != null) - { - Request_SelectUniqueKey request = new Request_SelectUniqueKey(); - request.Identity = jsonObject.Identity; - - await Task.Run(async() => - { - SystemX.Core.Communication.Http http = new(); - var res = await http.PostJsonAsync("https://127.0.0.1:9000/UniqueKey/SelectUniqueKey", request); - result = res.ToJson(); - - //json 요청이 아니면 변환 - if (isJsonRequest == false) - { - if (res != null) - result = $"{res.Identity},{res.Data1},{res.Data2},{res.Data3},{res.Data4},{res.Data5}"; - } - }); - } - - ClientSession clientSession = session as ClientSession; - Client client = clientSession.Client; - if (client == null) - return; - - client.Session.Send(Encoding.UTF8.GetBytes(result), EnumMessageId.S2C_SELECT_UniqueKey); - } - - public static async void C2S_UPDATE_UniqueKeyHandler(PacketSession session, ArraySegment buffer) - { - var recvData = Encoding.UTF8.GetString(buffer); - - //json으로 요청인지 확인 - bool isJsonRequest = true; - - //convert to object - var jsonObject = recvData.ToObject(); - //json 요청 아닐때 변환 - if (jsonObject == null) - { - var recvDataList = recvData.Split(","); - jsonObject = new C2S_UPDATE_UniqueKey - { - Identity = recvDataList[0], - Data1 = recvDataList[1], - Data2 = recvDataList[2], - Data3 = recvDataList[3], - Data4 = recvDataList[4], - Data5 = recvDataList[5], - }; - isJsonRequest = false; - } - - string result = string.Empty; - //insert DB - if (jsonObject != null) - { - Request_UpdateUniqueKey request = new Request_UpdateUniqueKey(); - request.Identity = jsonObject.Identity; - request.Data1 = jsonObject.Data1; - request.Data2 = jsonObject.Data2; - request.Data3 = jsonObject.Data3; - request.Data4 = jsonObject.Data4; - request.Data5 = jsonObject.Data5; - - SystemX.Core.Communication.Http http = new(); - var res = await http.PostJsonAsync("https://127.0.0.1:9000/UniqueKey/UpdateUniqueKey", request); - result = res.ToJson(); - - //json 요청이 아니면 변환 - if (isJsonRequest == false) - { - if (res != null) - result = $"{res.Identity},{res.Result}"; - } - } - - ClientSession clientSession = session as ClientSession; - Client client = clientSession.Client; - if (client == null) - return; - - client.Session.Send(Encoding.UTF8.GetBytes(result), EnumMessageId.S2C_UPDATE_UniqueKey); - } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Packet/Protocol.cs b/Projects/HubX/HubX.Library/Socket/Packet/Protocol.cs deleted file mode 100644 index e346ba3..0000000 --- a/Projects/HubX/HubX.Library/Socket/Packet/Protocol.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HubX.Library.Socket.Packet -{ - public interface IMessage - { - } - - public class C2S : IMessage - { - // public EnumMessageId MessageId { get; set; } - } - - public sealed class C2S_INSERT_UniqueKey : C2S - { - public string Identity { get; set; } - - public string Data1 { get; set; } - public string Data2 { get; set; } - public string Data3 { get; set; } - public string Data4 { get; set; } - public string Data5 { get; set; } - } - - public sealed class C2S_SELECT_UniqueKey : C2S - { - public string Identity { get; set; } - } - - public sealed class C2S_UPDATE_UniqueKey : C2S - { - public string Identity { get; set; } - - public string Data1 { get; set; } - public string Data2 { get; set; } - public string Data3 { get; set; } - public string Data4 { get; set; } - public string Data5 { get; set; } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Packet/ServerPacketManager.cs b/Projects/HubX/HubX.Library/Socket/Packet/ServerPacketManager.cs deleted file mode 100644 index 18df5d5..0000000 --- a/Projects/HubX/HubX.Library/Socket/Packet/ServerPacketManager.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SystemX.Core.Communication; - -namespace HubX.Library.Socket.Packet -{ - public class PacketManager - { - #region Singleton - static PacketManager _instance = new PacketManager(); - public static PacketManager Instance { get { return _instance; } } - #endregion - - PacketManager() - { - Register(); - } - - Dictionary, ushort>> _onRecv = new Dictionary, ushort>>(); - Dictionary>> _handler = new Dictionary>>(); - - public Action, ushort> CustomHandler { get; set; } - - public void Register() - { - _onRecv.Add((ushort)EnumMessageId.C2S_INSERT_UniqueKey, MakePacket); - _handler.Add((ushort)EnumMessageId.C2S_INSERT_UniqueKey, PacketHandler.C2S_INSERT_UniqueKeyHandler); - - _onRecv.Add((ushort)EnumMessageId.C2S_SELECT_UniqueKey, MakePacket); - _handler.Add((ushort)EnumMessageId.C2S_SELECT_UniqueKey, PacketHandler.C2S_SELECT_UniqueKeyHandler); - - _onRecv.Add((ushort)EnumMessageId.C2S_UPDATE_UniqueKey, MakePacket); - _handler.Add((ushort)EnumMessageId.C2S_UPDATE_UniqueKey, PacketHandler.C2S_UPDATE_UniqueKeyHandler); - } - - public void OnRecvPacket(PacketSession session, ArraySegment buffer) - { - ushort count = 0; - - ushort size = BitConverter.ToUInt16(buffer.Array, buffer.Offset); - count += 2; - ushort id = BitConverter.ToUInt16(buffer.Array, buffer.Offset + count); - count += 2; - - ushort packetSize = (ushort)(buffer.Count - count); - byte[] packet = new byte[packetSize]; - Array.Copy(buffer.ToArray(), count, packet, 0, packetSize); - - if (_onRecv.TryGetValue(id, out var action)) - action.Invoke(session, packet, id); - } - - void MakePacket(PacketSession session, ArraySegment buffer, ushort id) where T : new() - { - if (CustomHandler != null) - { - CustomHandler.Invoke(session, buffer, id); - } - else - { - Action> action = null; - if (_handler.TryGetValue(id, out action)) - action.Invoke(session, buffer); - } - } - - public Action> GetPacketHandler(ushort id) - { - Action> action = null; - if (_handler.TryGetValue(id, out action)) - return action; - return null; - } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Session/ClientSession.cs b/Projects/HubX/HubX.Library/Socket/Session/ClientSession.cs deleted file mode 100644 index c51d555..0000000 --- a/Projects/HubX/HubX.Library/Socket/Session/ClientSession.cs +++ /dev/null @@ -1,56 +0,0 @@ -using HubX.Library.Socket.Object; -using HubX.Library.Socket.Packet; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; -using SystemX.Core.Communication; - -namespace HubX.Library.Socket.Session -{ - public class ClientSession : PacketSession - { - public Client Client { get; set; } - public int SessionId { get; set; } - - public void Send(ArraySegment packet, EnumMessageId resonseMessageId) - { - Log4net.WriteLine($"Send:{Encoding.UTF8.GetString(packet)}", LogType.SOCKET); - - ushort size = (ushort)packet.Count; - byte[] sendBuffer = new byte[size + 4]; - Array.Copy(BitConverter.GetBytes((ushort)(size + 4)), 0, sendBuffer, 0, sizeof(ushort)); - Array.Copy(BitConverter.GetBytes((ushort)resonseMessageId), 0, sendBuffer, 2, sizeof(ushort)); - Array.Copy(packet.ToArray(), 0, sendBuffer, 4, size); - Send(new ArraySegment(sendBuffer)); - } - - public override void OnConnected(EndPoint endPoint) - { - Log4net.WriteLine($"OnConnected:{endPoint}", LogType.SOCKET); - Client = ObjectManager.Instance.Add(); - { - Client.Session = this; - } - } - - public override void OnRecvPacket(ArraySegment buffer) - { - Log4net.WriteLine($"OnRecvPacket:{Encoding.UTF8.GetString(buffer)}", LogType.SOCKET); - PacketManager.Instance.OnRecvPacket(this, buffer); - } - - public override void OnDisconnected(EndPoint endPoint) - { - Log4net.WriteLine($"OnDisconnected:{endPoint}", LogType.SOCKET); - } - - public override void OnSend(int numOfBytes) - { - //Console.WriteLine($"Transferred bytes: {numOfBytes}"); - } - } -} diff --git a/Projects/HubX/HubX.Library/Socket/Session/SessionManager.cs b/Projects/HubX/HubX.Library/Socket/Session/SessionManager.cs deleted file mode 100644 index f409659..0000000 --- a/Projects/HubX/HubX.Library/Socket/Session/SessionManager.cs +++ /dev/null @@ -1,54 +0,0 @@ -using HubX.Library.Socket.Packet; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SystemX.Core.Communication; - -namespace HubX.Library.Socket.Session -{ - public class SessionManager - { - static SessionManager _session = new SessionManager(); - public static SessionManager Instance { get { return _session; } } - - int _sessionId = 0; - Dictionary _sessions = new Dictionary(); - object _lock = new object(); - - public ClientSession Generate() - { - lock (_lock) - { - int sessionId = ++_sessionId; - - ClientSession session = new ClientSession(); - session.SessionId = sessionId; - _sessions.Add(sessionId, session); - - Log4net.WriteLine($"Connected : {sessionId}", LogType.SOCKET); - - return session; - } - } - - public ClientSession Find(int id) - { - lock (_lock) - { - ClientSession session = null; - _sessions.TryGetValue(id, out session); - return session; - } - } - - public void Remove(ClientSession session) - { - lock (_lock) - { - _sessions.Remove(session.SessionId); - } - } - } -} diff --git a/Projects/HubX/HubX.Server/Controllers/UniqueKeyController.cs b/Projects/HubX/HubX.Server/Controllers/UniqueKeyController.cs deleted file mode 100644 index 6e8bf6e..0000000 --- a/Projects/HubX/HubX.Server/Controllers/UniqueKeyController.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Azure.Core; -using HubX.Library.Http.Packet; -using HubX.Server.Services; -using Microsoft.AspNetCore.Mvc; - -namespace HubX.Server.Controllers -{ - [ApiController] - [Route("[controller]/[action]")] - - public class UniqueKeyController - { - private readonly UniqueKeyService _uniqueKeyService; - - public UniqueKeyController(UniqueKeyService uniqueKeyService) - { - _uniqueKeyService = uniqueKeyService; - } - - [HttpGet("/health")] - public async Task Health() - { - await Task.CompletedTask; - return Results.Ok("Healthy"); - } - - [HttpPost] - public async Task InsertUniqueKey(Request_InsertUniqueKey request) - { - var guid = Guid.NewGuid(); - Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/InsertUniqueKey::{request.ToJson()}", LogType.CONTROLLER); - - Response_InsertUniqueKy res = await _uniqueKeyService.Request_InsertUniqueKey(request); - Log4net.WriteLine($"[Response]({guid}) UniqueKey/InsertUniqueKey::{res.ToJson()}", LogType.CONTROLLER); - - return Results.Ok(res); - } - - [HttpPost] - public async Task SelectUniqueKey(Request_SelectUniqueKey request) - { - var guid = Guid.NewGuid(); - Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/SelectUniqueKey::{request.ToJson()}", LogType.CONTROLLER); - - Response_SelectUniqueKy res = await _uniqueKeyService.Request_SelectUniqueKey(request); - Log4net.WriteLine($"[Response]({guid}) UniqueKey/SelectUniqueKey::{res.ToJson()}", LogType.CONTROLLER); - - return Results.Ok(res); - } - - [HttpGet] - public async Task SelectUniqueKeyGet([FromQuery] string key) - { - var guid = Guid.NewGuid(); - // Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/SelectUniqueKey::{request.ToJson()}", LogType.CONTROLLER); - - Response_SelectUniqueKy res = await _uniqueKeyService.Request_SelectUniqueKey(new Request_SelectUniqueKey { Identity = key } ); - // Log4net.WriteLine($"[Response]({guid}) UniqueKey/SelectUniqueKey::{res.ToJson()}", LogType.CONTROLLER); - - return Results.Ok(res); - } - - [HttpGet] - public async Task SelectUniqueKeyGetAll() - { - var guid = Guid.NewGuid(); - // Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/SelectUniqueKey::{request.ToJson()}", LogType.CONTROLLER); - - var res = await _uniqueKeyService.Request_SelectUniqueKeyAll(); - // Log4net.WriteLine($"[Response]({guid}) UniqueKey/SelectUniqueKey::{res.ToJson()}", LogType.CONTROLLER); - - return Results.Ok(res); - } - - [HttpPost] - public async Task UpdateUniqueKey(Request_UpdateUniqueKey request) - { - var guid = Guid.NewGuid(); - Log4net.WriteLine($"[Requeust]({guid}) UniqueKey/UpdateUniqueKey::{request.ToJson()}", LogType.CONTROLLER); - - Response_UpdateUniqueKy res = await _uniqueKeyService.Request_UpdateUniqueKey(request); - Log4net.WriteLine($"[Response]({guid}) UniqueKey/UpdateUniqueKey::{res.ToJson()}", LogType.CONTROLLER); - - return Results.Ok(res); - } - } -} diff --git a/Projects/HubX/HubX.Server/HubX.Server.csproj b/Projects/HubX/HubX.Server/HubX.Server.csproj deleted file mode 100644 index 2cc9165..0000000 --- a/Projects/HubX/HubX.Server/HubX.Server.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - net8.0 - enable - enable - - - - 9999 - - - - 9999 - - - - - - - - - - - - - ..\..\DLL\SystemX.Core.dll - - - - diff --git a/Projects/HubX/HubX.Server/HubX.Server.http b/Projects/HubX/HubX.Server/HubX.Server.http deleted file mode 100644 index 3761f00..0000000 --- a/Projects/HubX/HubX.Server/HubX.Server.http +++ /dev/null @@ -1,6 +0,0 @@ -@HubX.Server_HostAddress = http://localhost:5103 - -GET {{HubX.Server_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/Projects/HubX/HubX.Server/Program.cs b/Projects/HubX/HubX.Server/Program.cs deleted file mode 100644 index 50190b7..0000000 --- a/Projects/HubX/HubX.Server/Program.cs +++ /dev/null @@ -1,111 +0,0 @@ -using DB.HubXDB; -using HubX.Library.Config; -using HubX.Library.Socket.Session; -using HubX.Server; -using HubX.Server.Services; -using HubX.Server.TaskManager; -using Microsoft.EntityFrameworkCore; -using System.Net; -using System.Net.Sockets; -using SystemX.Core.Communication; -using SystemX.Core.DB; -using SystemX.Core.Services; - -string configDir = @"../Config"; - -//raed log4net config -if (Log4net.IsConfigLoad == true) -{ - Log4net.WriteLine("Log4net Init Success"); -} -else -{ - Log4net.WriteLine("Log4net Init Failed", LogType.Error); -} - -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. - -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); -builder.Services.AddHttpContextAccessor(); - -//singleton -builder.Services.AddSingleton>(); - -//scoped -builder.Services.AddSingleton(); - -//config preload -ConfigService preloadConfig = new ConfigService(); -if (preloadConfig.OpenConfig($@"{configDir}/HubX.WebApiConfig.json") == true) -{ - var config = preloadConfig.GetConfig(); -} -else -{ - Console.WriteLine("Config Preload Load Error."); - return; -} - -builder.Services.AddDbContext(); - -var app = builder.Build(); - -//read api config and set -string serverUrl = string.Empty; -var configService = app.Services.GetService>(); -bool isIIS = false; - -int socketPort = 0; - -if (configService?.OpenConfig($@"{configDir}/HubX.WebApiConfig.json") == true) -{ - Log4net.WriteLine("WebApi Config Success."); - var apiConfig = ConfigService.Config; - if (apiConfig != null) - { - serverUrl = $"{apiConfig.Server.Address}:{apiConfig.Server.Port}"; - isIIS = apiConfig.Server.IIS; - - //socket - socketPort = apiConfig.Socket.Port; - } -} -else -{ - Log4net.WriteLine("WebApi Config Error."); - return; -} - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - Log4net.WriteLine($"IsDevelopment:{app.Environment.IsDevelopment()}"); - Log4net.WriteLine($"Swagger Url: {serverUrl}/swagger"); - - app.UseSwagger(); - app.UseSwaggerUI(); -} - -TaskSocket taskSocket = new TaskSocket(); -taskSocket?.Run(socketPort); - -app.UseAuthentication(); -app.UseHttpsRedirection(); -app.UseAuthorization(); - -app.MapControllers(); - -if (isIIS == true) -{ - app.Run(); -} -else -{ - Log4net.WriteLine($"Operation Url: {serverUrl}"); - app.Run($"{serverUrl}"); -} diff --git a/Projects/HubX/HubX.Server/Properties/launchSettings.json b/Projects/HubX/HubX.Server/Properties/launchSettings.json deleted file mode 100644 index aee3210..0000000 --- a/Projects/HubX/HubX.Server/Properties/launchSettings.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "profiles": { - "http": { - "commandName": "Project", - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true, - "applicationUrl": "http://localhost:5103" - }, - "https": { - "commandName": "Project", - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true, - "applicationUrl": "https://localhost:7163;http://localhost:5103" - }, - "IIS Express": { - "commandName": "IISExpress", - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - }, - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:33125", - "sslPort": 44383 - } - } -} \ No newline at end of file diff --git a/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs b/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs deleted file mode 100644 index 36b7d2b..0000000 --- a/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs +++ /dev/null @@ -1,195 +0,0 @@ -using DB.HubXDB; -using HubX.Library.Enums; -using HubX.Library.Http.Packet; -using Microsoft.EntityFrameworkCore; -using Microsoft.Identity.Client.Extensions.Msal; -using System; -using System.Collections.Generic; -using System.Data; -using System.Xml; -using SystemX.Core.DB; - -namespace HubX.Server.Services -{ - public class UniqueKeyService - { - private readonly IServiceScopeFactory _scopeFactory; - - public UniqueKeyService(IServiceScopeFactory scopeFactory) - { - _scopeFactory = scopeFactory; - } - - public async Task Request_InsertUniqueKey(Request_InsertUniqueKey request, string guid = "") - { - Response_InsertUniqueKy response = new Response_InsertUniqueKy(); - - if (request != null) - { - response.Identity = request.Identity; - - bool transactionResult = true; - using (var scope = _scopeFactory.CreateScope()) - { - var context = scope.ServiceProvider.GetRequiredService(); - if (context != null) - { - var data = await context.TStorages.AsNoTracking().Where(x => x.CIdentity == request.Identity).ToListAsync(); - if (data?.Count() > 0) - { - Log4net.WriteLine($"Exist Unique Key::{guid}", LogType.Error); - response.Result = "Exist Unique Key"; - } - else - { - var storage = new TStorage - { - CIdentity = request.Identity, - CData1 = request.Data1, - CData2 = request.Data2, - CData3 = request.Data3, - CData4 = request.Data4, - CData5 = request.Data5, - - CDateTime = DateTime.Now - }; - using (var transaction = await context.CreateTransactionAsync()) - { - await context.AddAsync(storage); - transactionResult = await context.CloseTransactionAsync(transaction); - } - - //db error - if (transactionResult == false) - { - response.Result = EnumResult.Failed.ToString(); - Log4net.WriteLine($"Transaction Error::{guid}", LogType.Error); - } - else - { - Log4net.WriteLine($"Transaction Success", LogType.DB); - } - } - } - } - } - - return response; - } - - public async Task Request_SelectUniqueKey(Request_SelectUniqueKey request, string guid = "") - { - Response_SelectUniqueKy response = new Response_SelectUniqueKy(); - - if (request != null) - { - response.Identity = request.Identity; - using (var scope = _scopeFactory.CreateScope()) - { - var context = scope.ServiceProvider.GetRequiredService(); - if (context != null) - { - try - { - using (var transaction = await context.CreateTransactionAsync(IsolationLevel.ReadUncommitted)) - { - var data = await context.TStorages.AsNoTracking().FirstOrDefaultAsync(x => x.CIdentity == request.Identity); - await context.CloseTransactionAsync(transaction); - if (data != null) - { - response.Data1 = data.CData1; - response.Data2 = data.CData2; - response.Data3 = data.CData3; - response.Data4 = data.CData4; - response.Data5 = data.CData5; - } - } - } - catch (Exception e) - { - Log4net.WriteLine($"Select Unique Key Transaction Error::{guid}", LogType.Error); - Log4net.WriteLine(e); - } - } - } - } - - return response; - } - - public async Task> Request_SelectUniqueKeyAll(string guid = "") - { - List result = new List(); - using (var scope = _scopeFactory.CreateScope()) - { - var context = scope.ServiceProvider.GetRequiredService(); - if (context != null) - { - try - { - using (var transaction = await context.CreateTransactionAsync(IsolationLevel.ReadUncommitted)) - { - result = await context.TStorages.AsNoTracking().ToListAsync(); - await context.CloseTransactionAsync(transaction); - } - } - catch (Exception e) - { - Log4net.WriteLine($"Select Unique Key Transaction Error::{guid}", LogType.Error); - Log4net.WriteLine(e); - } - } - } - - return result; - } - - public async Task Request_UpdateUniqueKey(Request_UpdateUniqueKey request, string guid = "") - { - Response_UpdateUniqueKy response = new Response_UpdateUniqueKy(); - - if (request != null) - { - response.Identity = request.Identity; - - bool transactionResult = true; - - using (var scope = _scopeFactory.CreateScope()) - { - var context = scope.ServiceProvider.GetRequiredService(); - if (context != null) - { - var selected = await context.TStorages.FirstOrDefaultAsync(x => x.CIdentity == request.Identity); - if (selected != null) - { - selected.CData1 = request.Data1; - selected.CData2 = request.Data2; - selected.CData3 = request.Data3; - selected.CData4 = request.Data4; - selected.CData5 = request.Data5; - - using (var transaction = await context.CreateTransactionAsync()) - { - context.Update(selected); - transactionResult = await context.CloseTransactionAsync(transaction); - } - } - } - - //db error - if (transactionResult == false) - { - response.Result = EnumResult.Failed.ToString(); - Log4net.WriteLine($"Transaction Error::{guid}", LogType.Error); - } - else - { - Log4net.WriteLine($"Transaction Success", LogType.DB); - } - } - } - - return response; - } - } -} diff --git a/Projects/HubX/HubX.Server/TaskManager/TaskSocket.cs b/Projects/HubX/HubX.Server/TaskManager/TaskSocket.cs deleted file mode 100644 index bf1b709..0000000 --- a/Projects/HubX/HubX.Server/TaskManager/TaskSocket.cs +++ /dev/null @@ -1,29 +0,0 @@ -using HubX.Library.Socket.Session; -using System.Net; -using SystemX.Core.Communication; - -namespace HubX.Server.TaskManager -{ - public class TaskSocket - { - public async Task Run(int socketPort = 7777) - { - try - { - await Task.Delay(1000); - Listener _listener = new Listener(); - IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, socketPort); - - _listener.Init(endPoint, () => { return SessionManager.Instance.Generate(); }); - - Log4net.WriteLine($"Address:{endPoint.Address}, Port:{socketPort}", LogType.SOCKET); - Log4net.WriteLine($"Socket Listening Start", LogType.SOCKET); - } - catch (Exception e) - { - Log4net.WriteLine("Socket Run Failed",LogType.Error); - Log4net.WriteLine(e); - } - } - } -} diff --git a/Projects/HubX/HubX.Server/appsettings.Development.json b/Projects/HubX/HubX.Server/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/Projects/HubX/HubX.Server/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/Projects/HubX/HubX.Server/appsettings.json b/Projects/HubX/HubX.Server/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/Projects/HubX/HubX.Server/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/Projects/HubX/HubX.Server/log4net.config b/Projects/HubX/HubX.Server/log4net.config deleted file mode 100644 index 216c878..0000000 --- a/Projects/HubX/HubX.Server/log4net.config +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Projects/HubX/HubX.sln b/Projects/HubX/HubX.sln deleted file mode 100644 index 0401d4e..0000000 --- a/Projects/HubX/HubX.sln +++ /dev/null @@ -1,50 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34728.123 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HubX.Server", "HubX.Server\HubX.Server.csproj", "{AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}" -EndProject -Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "HubX.DB", "HubX.DB\HubX.DB.sqlproj", "{514DDCCF-6B50-49F8-B212-70498396CF19}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HubX.Library", "HubX.Library\HubX.Library.csproj", "{E6FA1D27-A644-4E50-BF16-DCCA59AA378D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HubX.Library.DB", "HubX.Library.DB\HubX.Library.DB.csproj", "{C43CF1F1-9CB0-44DC-89D7-3514F18EAD46}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{18B1BDDB-B76F-43A4-BBE8-805CEEF35CE0}" - ProjectSection(SolutionItems) = preProject - Config\HubX.WebApiConfig.json = Config\HubX.WebApiConfig.json - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Release|Any CPU.Build.0 = Release|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Debug|Any CPU.Build.0 = Debug|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Release|Any CPU.Build.0 = Release|Any CPU - {514DDCCF-6B50-49F8-B212-70498396CF19}.Release|Any CPU.Deploy.0 = Release|Any CPU - {E6FA1D27-A644-4E50-BF16-DCCA59AA378D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E6FA1D27-A644-4E50-BF16-DCCA59AA378D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E6FA1D27-A644-4E50-BF16-DCCA59AA378D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E6FA1D27-A644-4E50-BF16-DCCA59AA378D}.Release|Any CPU.Build.0 = Release|Any CPU - {C43CF1F1-9CB0-44DC-89D7-3514F18EAD46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C43CF1F1-9CB0-44DC-89D7-3514F18EAD46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C43CF1F1-9CB0-44DC-89D7-3514F18EAD46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C43CF1F1-9CB0-44DC-89D7-3514F18EAD46}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {30EA2F90-E145-4765-B14C-DCC78789F472} - EndGlobalSection -EndGlobal diff --git a/Projects/HubX/Tools/Tools_DB_Scaffold.bat b/Projects/HubX/Tools/Tools_DB_Scaffold.bat deleted file mode 100644 index 582be5f..0000000 --- a/Projects/HubX/Tools/Tools_DB_Scaffold.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd ../HubX.Library.DB - -::DataDB -dotnet ef dbcontext scaffold "server=127.0.0.1; user id=VPKI; password=Kefico!@34; database=HubX; TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer --namespace DB.HubXDB --context-dir DB\HubX\Context --output-dir DB\HubX\Tables -f \ No newline at end of file