diff --git a/Projects/NetStandard/CPMeta/CPMeta.cs b/Projects/NetStandard/CPMeta/CPMeta.cs new file mode 100644 index 0000000..8db69b4 --- /dev/null +++ b/Projects/NetStandard/CPMeta/CPMeta.cs @@ -0,0 +1,44 @@ +using CPMeta.Models; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace CPMeta +{ + public class CPMeta + { + public static int Port { get; set; } = 9000; + + public static async Task SetWbmsMetaAsync(string host, Request_SetWbmsMeta request) + { + string url = $"https://{host}:{Port}/CPMeta/SetWbmsMeta"; + + Response_SetWbmsMeta res = await RestAPI.PostAsync(url, request); + return res; + } + + public static async Task GetWbmsMetaByProductId(string host, string productID, int shardID = 1) + { + string url = $"https://{host}:{Port}/CPMeta/GetWbmsMetaByProductID?"; + url += $"ProductID={productID}&"; + url += $"ShardID={shardID}"; + + Response_GetWbmsMeta res = await RestAPI.GetAsync(url); + return res; + } + + public static async Task GetWbmsMetaByMacAddress(string host, string macAddress, int shardID = 1) + { + string url = $"https://{host}:{Port}/CPMeta/GetWbmsMetaByMacAddress?"; + url += $"MacAddress={macAddress}&"; + url += $"ShardID={shardID}"; + + Response_GetWbmsMeta res = await RestAPI.GetAsync(url); + return res; + } + } +} diff --git a/Projects/NetStandard/CPMeta/CPMeta.csproj b/Projects/NetStandard/CPMeta/CPMeta.csproj new file mode 100644 index 0000000..4769e6b --- /dev/null +++ b/Projects/NetStandard/CPMeta/CPMeta.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/Projects/NetStandard/CPMeta/Models/Wbms.cs b/Projects/NetStandard/CPMeta/Models/Wbms.cs new file mode 100644 index 0000000..4b39d69 --- /dev/null +++ b/Projects/NetStandard/CPMeta/Models/Wbms.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CPMeta.Models +{ + public class Request_SetWbmsMeta + { + //pk + public string ProductID { get; set; } = string.Empty; + //uk + public string MacAddress1 { get; set; } = string.Empty; + public string MacAddress2 { get; set; } = string.Empty; + + //value + public string Type { get; set; } = string.Empty; + public string ProductNo { get; set; } = string.Empty; + public string SpareValue { get; set; } = string.Empty; + + public int ShardID { get; set; } = 1; + } + + public class Response_SetWbmsMeta + { + public string ProductID { get; set; } = string.Empty; + public string Result { get; set; } = string.Empty; + public string Message { get; set; } = string.Empty; + } + + public class Request_GetWbmsMetaByProductID + { + public string ProductID { get; set; } = string.Empty; + public int ShardID { get; set; } = 1; + } + public class Request_GetWbmsMetaByMacAddress + { + public string MacAddress { get; set; } = string.Empty; + public int ShardID { get; set; } = 1; + } + + public class Response_GetWbmsMeta + { + public List Wbms { get; set; } + public string Result { get; set; } = string.Empty; + public string Message { get; set; } = string.Empty; + } + + public class tWbms + { + public string cProductID { get; set; } = null; + + public string cMacAddress1 { get; set; } + public string cMacAddress2 { get; set; } + public string cType { get; set; } + public string cProductNo { get; set; } + public string cSpareValue { get; set; } + public DateTime cDateTime { get; set; } + } +} diff --git a/Projects/NetStandard/CPMeta/RestAPI.cs b/Projects/NetStandard/CPMeta/RestAPI.cs new file mode 100644 index 0000000..d7bc82f --- /dev/null +++ b/Projects/NetStandard/CPMeta/RestAPI.cs @@ -0,0 +1,67 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace CPMeta +{ + public class RestAPI + { + public static async Task PostAsync(string Url, REQUEST body) where REQUEST : class where RESPONSE : class + { + try + { + ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + if (body != null) + { + var jsonBody = JsonConvert.SerializeObject(body); + var contents = new StringContent(jsonBody, Encoding.UTF8, "application/json"); + + HttpClient client = new HttpClient(); + client.Timeout = TimeSpan.FromMilliseconds(3000); + + var response = await client.PostAsync(Url, contents); + + var resContentStr = await response.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(resContentStr); + } + } + catch (Exception e) + { + Console.WriteLine("PostAsync Error"); + } + + return default(RESPONSE); + } + + public static async Task GetAsync(string Url) + { + try + { + ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + HttpClient client = new HttpClient(); + client.Timeout = TimeSpan.FromMilliseconds(3000); + + var response = await client.GetAsync(Url); + + var resContentStr = await response.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(resContentStr); + + } + catch(Exception e) + { + Console.WriteLine("GetAsync Error"); + } + + return default(RESPONSE); + } + + } +} diff --git a/Projects/NetStandard/NetStandard.sln b/Projects/NetStandard/NetStandard.sln new file mode 100644 index 0000000..3f0dd77 --- /dev/null +++ b/Projects/NetStandard/NetStandard.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36301.6 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPMeta", "CPMeta\CPMeta.csproj", "{0BDB3E8C-2F57-4780-8B6F-3AE3F426A6C3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayGround.NetFramework", "PlayGround.NetFramework\PlayGround.NetFramework.csproj", "{9EFF44BF-88AD-495B-B4FA-313A969666F0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0BDB3E8C-2F57-4780-8B6F-3AE3F426A6C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BDB3E8C-2F57-4780-8B6F-3AE3F426A6C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0BDB3E8C-2F57-4780-8B6F-3AE3F426A6C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0BDB3E8C-2F57-4780-8B6F-3AE3F426A6C3}.Release|Any CPU.Build.0 = Release|Any CPU + {9EFF44BF-88AD-495B-B4FA-313A969666F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9EFF44BF-88AD-495B-B4FA-313A969666F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9EFF44BF-88AD-495B-B4FA-313A969666F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9EFF44BF-88AD-495B-B4FA-313A969666F0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9F4B97E1-3EAE-406D-BAD9-69F7D27498B2} + EndGlobalSection +EndGlobal diff --git a/Projects/NetStandard/PlayGround.NetFramework/App.config b/Projects/NetStandard/PlayGround.NetFramework/App.config new file mode 100644 index 0000000..aee9adf --- /dev/null +++ b/Projects/NetStandard/PlayGround.NetFramework/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Projects/NetStandard/PlayGround.NetFramework/PlayGround.NetFramework.csproj b/Projects/NetStandard/PlayGround.NetFramework/PlayGround.NetFramework.csproj new file mode 100644 index 0000000..3ec9d74 --- /dev/null +++ b/Projects/NetStandard/PlayGround.NetFramework/PlayGround.NetFramework.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {9EFF44BF-88AD-495B-B4FA-313A969666F0} + Exe + PlayGround.NetFramework + PlayGround.NetFramework + v4.8.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + {0bdb3e8c-2f57-4780-8b6f-3ae3f426a6c3} + CPMeta + + + + \ No newline at end of file diff --git a/Projects/NetStandard/PlayGround.NetFramework/Program.cs b/Projects/NetStandard/PlayGround.NetFramework/Program.cs new file mode 100644 index 0000000..e726374 --- /dev/null +++ b/Projects/NetStandard/PlayGround.NetFramework/Program.cs @@ -0,0 +1,46 @@ +using CPMeta; +using CPMeta.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PlayGround.NetFramework +{ + internal class Program + { + static void Main(string[] args) + { + //CpMetaSet + CPMeta.CPMeta.Port = 9000; + + string ProductId = Guid.NewGuid().ToString(); + string Mac1 = Guid.NewGuid().ToString(); + string Mac2 = Guid.NewGuid().ToString(); + + //Set + Task.Run(async() => + { + Request_SetWbmsMeta req = new Request_SetWbmsMeta(); + req.ProductID = ProductId; + req.MacAddress1 = Mac1; + req.MacAddress2 = Mac2; + + var res = await CPMeta.CPMeta.SetWbmsMetaAsync("127.0.0.1", req); + }).Wait(); + + //Get + Task.Run(async() => + { + var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId("127.0.0.1", ProductId); + + var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac1); + var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac2); + int b = 0; + }).Wait();; + + int a = 0; + } + } +} diff --git a/Projects/NetStandard/PlayGround.NetFramework/Properties/AssemblyInfo.cs b/Projects/NetStandard/PlayGround.NetFramework/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..20f8dba --- /dev/null +++ b/Projects/NetStandard/PlayGround.NetFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("PlayGround.NetFramework")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PlayGround.NetFramework")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("9eff44bf-88ad-495b-b4fa-313a969666f0")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Projects/NetStandard/PlayGround.NetFramework/packages.config b/Projects/NetStandard/PlayGround.NetFramework/packages.config new file mode 100644 index 0000000..b85d821 --- /dev/null +++ b/Projects/NetStandard/PlayGround.NetFramework/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Projects/WebApi/WebApi.Project.UniqueKeyApi/.config/dotnet-tools.json b/Projects/WebApi/WebApi.Project.UniqueKeyApi/.config/dotnet-tools.json new file mode 100644 index 0000000..d4937e0 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.UniqueKeyApi/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.10", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/Tools/Local-Certificate.bat b/Tools/Local-Certificate.bat new file mode 100644 index 0000000..1380c2c --- /dev/null +++ b/Tools/Local-Certificate.bat @@ -0,0 +1 @@ +New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName "localhost" \ No newline at end of file