From 8dd4a0b58b36ef6bb16cdc3117e09995a00cb950 Mon Sep 17 00:00:00 2001 From: a4plane Date: Mon, 14 Jul 2025 00:42:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B4=88=EA=B8=B0=20=EC=BB=A4=EB=B0=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HuimMasterServer.sln | 25 ++++ HuimMasterServer/CommandList.txt | 18 +++ HuimMasterServer/HuimMasterServer.csproj | 9 ++ HuimMasterServer/KeyboardLayoutConverter.cs | 68 +++++++++++ HuimMasterServer/Program.cs | 111 ++++++++++++++++++ .../Properties/launchSettings.json | 38 ++++++ HuimMasterServer/appsettings.Development.json | 8 ++ HuimMasterServer/appsettings.json | 9 ++ HuimMasterServer/wwwroot.zip | Bin 0 -> 729 bytes HuimMasterServer/wwwroot/home/index.html | 25 ++++ 10 files changed, 311 insertions(+) create mode 100644 HuimMasterServer.sln create mode 100644 HuimMasterServer/CommandList.txt create mode 100644 HuimMasterServer/HuimMasterServer.csproj create mode 100644 HuimMasterServer/KeyboardLayoutConverter.cs create mode 100644 HuimMasterServer/Program.cs create mode 100644 HuimMasterServer/Properties/launchSettings.json create mode 100644 HuimMasterServer/appsettings.Development.json create mode 100644 HuimMasterServer/appsettings.json create mode 100644 HuimMasterServer/wwwroot.zip create mode 100644 HuimMasterServer/wwwroot/home/index.html diff --git a/HuimMasterServer.sln b/HuimMasterServer.sln new file mode 100644 index 0000000..d5cbed8 --- /dev/null +++ b/HuimMasterServer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36121.58 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HuimMasterServer", "HuimMasterServer\HuimMasterServer.csproj", "{54D62E9F-8085-47C5-A7B4-3233516CDB70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {54D62E9F-8085-47C5-A7B4-3233516CDB70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54D62E9F-8085-47C5-A7B4-3233516CDB70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54D62E9F-8085-47C5-A7B4-3233516CDB70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54D62E9F-8085-47C5-A7B4-3233516CDB70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E3088683-A8FF-4806-BDBA-1DA2AA3567D5} + EndGlobalSection +EndGlobal diff --git a/HuimMasterServer/CommandList.txt b/HuimMasterServer/CommandList.txt new file mode 100644 index 0000000..105c8df --- /dev/null +++ b/HuimMasterServer/CommandList.txt @@ -0,0 +1,18 @@ +pressButton : 0, typeText : 정우진, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER, delay : 1000, move : 100, 100 +pressButton : 0, typeText : 문도균1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 최민준, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 손솔빈, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 이지율1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 이오늘1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김아름, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김다움, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 최성준1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 조미연1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 이하민, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 우수정, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김경찬2, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 다이스, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김다흰, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김민준2, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 정에린1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER +pressButton : 0, typeText : 김다슬1, pressKey : KEY_KP_ENTER, typePw, pressKey : KEY_KP_ENTER \ No newline at end of file diff --git a/HuimMasterServer/HuimMasterServer.csproj b/HuimMasterServer/HuimMasterServer.csproj new file mode 100644 index 0000000..c01e67f --- /dev/null +++ b/HuimMasterServer/HuimMasterServer.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/HuimMasterServer/KeyboardLayoutConverter.cs b/HuimMasterServer/KeyboardLayoutConverter.cs new file mode 100644 index 0000000..767523b --- /dev/null +++ b/HuimMasterServer/KeyboardLayoutConverter.cs @@ -0,0 +1,68 @@ +using System.Text; + +namespace HuimMasterServer +{ + public static class KeyboardLayoutConverter + { + //해줘 코드 mk2 + // 각 자모에 해당하는 영문 자판 배열을 미리 선언해 둡니다. + private static readonly string[] Choseong = { + "r", "R", "s", "e", "E", "f", "a", "q", "Q", "t", + "T", "d", "w", "W", "c", "z", "x", "v", "g" + }; + + private static readonly string[] Jungseong = { + "k", "o", "i", "O", "j", "p", "u", "P", "h", "hk", + "ho", "hl", "y", "n", "nj", "np", "nl", "b", "m", "ml", "l" + }; + + private static readonly string[] Jongseong = { + "", "r", "R", "rt", "s", "sw", "sg", "e", "f", "fr", + "fa", "fq", "ft", "fx", "fv", "fg", "a", "q", "qt", + "t", "T", "d", "w", "c", "z", "x", "v", "g" + }; + + /// + /// 한글 문자열을 QWERTY 키보드 레이아웃 기준 영문으로 변환합니다. + /// 예: "안녕" -> "dkssud" + /// + /// 변환할 한글 문자열 + /// 영문으로 변환된 문자열 + public static string KorToEng(string koreanText) + { + if (string.IsNullOrEmpty(koreanText)) + { + return string.Empty; + } + + var resultBuilder = new StringBuilder(); + + // 입력된 문자열을 한 글자씩 순회합니다. + foreach (char c in koreanText) + { + // 한글 완성형 글자(U+AC00 ~ U+D7A3)인지 확인합니다. + if (c >= 0xAC00 && c <= 0xD7A3) + { + int syllableIndex = c - 0xAC00; + int cho = syllableIndex / (21 * 28); + int jung = (syllableIndex % (21 * 28)) / 28; + int jong = syllableIndex % 28; + + resultBuilder.Append(Choseong[cho]); + resultBuilder.Append(Jungseong[jung]); + if (jong > 0) // 종성이 있는 경우에만 추가합니다. + { + resultBuilder.Append(Jongseong[jong]); + } + } + else + { + // 한글이 아닌 문자는 그대로 추가합니다. + resultBuilder.Append(c); + } + } + + return resultBuilder.ToString(); + } + } +} diff --git a/HuimMasterServer/Program.cs b/HuimMasterServer/Program.cs new file mode 100644 index 0000000..c2024c4 --- /dev/null +++ b/HuimMasterServer/Program.cs @@ -0,0 +1,111 @@ +namespace HuimMasterServer +{ + internal static class Program + { + //Ƶ̳밡 ͳݿ Ǿ Ŭ̾Ʈμ ڽ ipּ ( ip) װ ˷ óƮũ ִ ٸ + //Ⱑ װ + // + //Ȥ ׳ Ƶ̳밡 ü ؼ ű⿡ Ѽ Ű + + //Ƶ̳밡 Ǿ ޾Ƽ ϰ + // ڵ ּ űϴ ڵ忡 ؼ ִ ö + private static void Main(string[] args) + { + if (!File.Exists("CommandList.txt")) + { + File.Create("CommandList.txt").Close(); + } + var cmdText = File.ReadAllLines("CommandList.txt"); + List cmdList = []; + for (int i = 0; i < cmdText.Length; i++) + { + string cmd = cmdText[i]; + cmdList.Add(cmd.ToString()); + Console.WriteLine(cmd); + } + + int index = 0; + + bool deviceControlCmdInBuffer = false; + + string cmdBuffer = string.Empty; + + var builder = WebApplication.CreateBuilder(args); + var app = builder.Build(); + + app.UseDefaultFiles(); + app.UseStaticFiles(); + + app.MapGet("/api/{msgToServer}", (string msgToServer) => + { + switch (msgToServer) + { + case "ready": + cmdBuffer = KeyboardLayoutConverter.KorToEng(cmdList[index]); + index++; + return cmdBuffer; + + case "prepare": + if (deviceControlCmdInBuffer) + { + deviceControlCmdInBuffer = false; + return cmdBuffer; + } + cmdBuffer = KeyboardLayoutConverter.KorToEng(cmdList[index]); + return null; + + case "next": + if (deviceControlCmdInBuffer) + { + deviceControlCmdInBuffer = false; + return cmdBuffer; + } + index++; + if (index >= cmdList.Count) + { + cmdBuffer = "end"; + return cmdBuffer; + } + else + { + //cmdBuffer = KeyboardLayoutConverter.KorToEng(cmdList[index]); + //index++; + return KeyboardLayoutConverter.KorToEng(cmdList[index]); + } + + case "acting": + if (deviceControlCmdInBuffer) + { + deviceControlCmdInBuffer = false; + return cmdBuffer; + } + return null; + + default: + return null; + } + }); + + app.MapGet("/", context => + { + context.Response.Redirect("home/index.html"); + return Task.CompletedTask; + }); + + app.MapGet("home/stop", () => + { + cmdBuffer = "stop"; + Console.WriteLine("aaa"); + deviceControlCmdInBuffer = true; + return "device will stop"; + }); + + //app.UseAuthorization(); + + app.UseRouting(); + + + app.Run("http://localhost:8005"); + } + } +} \ No newline at end of file diff --git a/HuimMasterServer/Properties/launchSettings.json b/HuimMasterServer/Properties/launchSettings.json new file mode 100644 index 0000000..3dd5d86 --- /dev/null +++ b/HuimMasterServer/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:56694", + "sslPort": 44349 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5246", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7188;http://localhost:5246", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/HuimMasterServer/appsettings.Development.json b/HuimMasterServer/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/HuimMasterServer/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/HuimMasterServer/appsettings.json b/HuimMasterServer/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/HuimMasterServer/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/HuimMasterServer/wwwroot.zip b/HuimMasterServer/wwwroot.zip new file mode 100644 index 0000000000000000000000000000000000000000..eaa721e17188911dc1e92c13d204f05ac72a435c GIT binary patch literal 729 zcmWIWW@Zs#0D;DJZ==8rD8UM(GxBp&^#h7I)vj4z&MpI$ZaIx7!A#NAFlS-phJdHqZC8tgoM%rT88Cw|#lB_MonqYvAhAi;uke zG=c;)pK{jT$qP92GfBO0E>EY+@|zrs59oXT5AWy`U2$3WZ)MPbUG37sPb`ym+?}9v z+S2UM0dtS3XIA)FMOfWXh%{fiVb*dH;pDK&CzH${-c&u!cIur>QgfGyvq9Jewog-3 zI9Bt#{I%x5*ZK_;b04YR^|0mMQNQqb(=%xu*ZkgxLh0YC7FVm6%`Gxn{!%sb)RVVQ ztIK_Dqn~E=K2MXo%(KJi)X&0IWi09QJh@+5z4CrPYcs<%oABjjU&Vf0HJ`PAe(u6Z zuibn1GX!`uGKnzYN(?H{WFY{h!AXOQK>^HVWRPG`m+yG<<@0Su&xf60+V7XT+bbX+ zVJx-;1Tz+7jxrE~jYT9UWD9Cnwu23Z(H0H|y&x8_vVmN|1cW<)G&eA1GB5xD5v(V1 literal 0 HcmV?d00001 diff --git a/HuimMasterServer/wwwroot/home/index.html b/HuimMasterServer/wwwroot/home/index.html new file mode 100644 index 0000000..9cea76b --- /dev/null +++ b/HuimMasterServer/wwwroot/home/index.html @@ -0,0 +1,25 @@ + + + + 후임 + + + + + + +
+ + + + \ No newline at end of file