초기 커밋.
This commit is contained in:
25
HuimMasterServer.sln
Normal file
25
HuimMasterServer.sln
Normal file
@@ -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
|
||||
18
HuimMasterServer/CommandList.txt
Normal file
18
HuimMasterServer/CommandList.txt
Normal file
@@ -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
|
||||
9
HuimMasterServer/HuimMasterServer.csproj
Normal file
9
HuimMasterServer/HuimMasterServer.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
68
HuimMasterServer/KeyboardLayoutConverter.cs
Normal file
68
HuimMasterServer/KeyboardLayoutConverter.cs
Normal file
@@ -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"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 한글 문자열을 QWERTY 키보드 레이아웃 기준 영문으로 변환합니다.
|
||||
/// 예: "안녕" -> "dkssud"
|
||||
/// </summary>
|
||||
/// <param name="koreanText">변환할 한글 문자열</param>
|
||||
/// <returns>영문으로 변환된 문자열</returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
111
HuimMasterServer/Program.cs
Normal file
111
HuimMasterServer/Program.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
namespace HuimMasterServer
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
//<2F>Ƶ<EFBFBD><C6B5>̳밡 <20><><EFBFBD>ͳݿ<CDB3> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD>μ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ڽ<EFBFBD><DABD><EFBFBD> ip<69>ּ<EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD> ip)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>װ<EFBFBD><D7B0><EFBFBD> <20>˷<EFBFBD><CBB7><EFBFBD> <20><><EFBFBD>ó<EFBFBD>Ʈ<EFBFBD><C6AE>ũ <20><><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20>ٸ<EFBFBD>
|
||||
//<2F><><EFBFBD>Ⱑ <20>װ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
//Ȥ<><C8A4> <20>׳<EFBFBD> <20>Ƶ<EFBFBD><C6B5>̳밡 <20><>ü <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD> <20>ű <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0>
|
||||
|
||||
//<2F>Ƶ<EFBFBD><C6B5>̳밡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ƽ<DEBE> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> <20>ڵ<EFBFBD> <20>ּ<EFBFBD> <20>ű<EFBFBD><C5B1>ϴ<EFBFBD> <20>ڵ忡 <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
if (!File.Exists("CommandList.txt"))
|
||||
{
|
||||
File.Create("CommandList.txt").Close();
|
||||
}
|
||||
var cmdText = File.ReadAllLines("CommandList.txt");
|
||||
List<string> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
38
HuimMasterServer/Properties/launchSettings.json
Normal file
38
HuimMasterServer/Properties/launchSettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
HuimMasterServer/appsettings.Development.json
Normal file
8
HuimMasterServer/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
HuimMasterServer/appsettings.json
Normal file
9
HuimMasterServer/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
BIN
HuimMasterServer/wwwroot.zip
Normal file
BIN
HuimMasterServer/wwwroot.zip
Normal file
Binary file not shown.
25
HuimMasterServer/wwwroot/home/index.html
Normal file
25
HuimMasterServer/wwwroot/home/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>후임</title>
|
||||
</head>
|
||||
<body>
|
||||
<!--이 간단한 메크로 쓸려고 ajax까지 쓰는게 맞음? => ajax보다 asp.net core 쓰는게 더 이상한거 아님? => 낭만 있잖아 => ???-->
|
||||
<button onclick="callApi('start')">?</button>
|
||||
<button onclick="callApi('stop')">멈춰!</button>
|
||||
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
async function callApi(url) {
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
const text = await res.text();
|
||||
document.getElementById('result').innerHTML = text;
|
||||
} catch (err) {
|
||||
console.error('뷁:', err);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user