This commit is contained in:
backuppc
2025-07-08 15:05:21 +09:00
parent af316e72d0
commit fb8c488890
57 changed files with 902 additions and 7161 deletions

View File

@@ -1,41 +1,29 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Express 15 for Windows Desktop
VisualStudioVersion = 17.9.34714.143 VisualStudioVersion = 15.0.28307.1000
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arControl", "SubProject\arCtl\arControl.csproj", "{F31C242C-1B15-4518-9733-48558499FE4B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sub", "Sub", "{C423C39A-44E7-4F09-B2F7-7943975FF948}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sub", "Sub", "{C423C39A-44E7-4F09-B2F7-7943975FF948}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arFrameControl", "SubProject\arFrameControl\arFrameControl.csproj", "{A16C9667-5241-4313-888E-548375F85D29}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateMachine", "StateMachine\StateMachine.csproj", "{BBC9BCCF-6262-4355-9CC2-37FF678AC499}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateMachine", "StateMachine\StateMachine.csproj", "{BBC9BCCF-6262-4355-9CC2-37FF678AC499}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agvControl", "SubProject\AGVControl\agvControl.csproj", "{8CB883C0-99C3-4DD4-B017-F9B92010A806}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agvControl", "SubProject\AGVControl\agvControl.csproj", "{8CB883C0-99C3-4DD4-B017-F9B92010A806}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_NLRF100", "TestProject\Test_NLRF100\Test_NLRF100.csproj", "{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_PLC", "TestProject\Test_ProPLC\Test_PLC.csproj", "{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_BMS", "TestProject\Test_BMS\Test_BMS.csproj", "{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_BMS", "TestProject\Test_BMS\Test_BMS.csproj", "{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMS", "SubProject\BMS\BMS.csproj", "{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMS", "SubProject\BMS\BMS.csproj", "{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWPatch", "SubProject\Patch\SWPatch.csproj", "{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWPatch", "SubProject\Patch\SWPatch.csproj", "{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emulator", "Emulator\Emulator.csproj", "{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "SubProject\AGV\NARUMI.csproj", "{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "SubProject\AGV\NARUMI.csproj", "{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Narumi", "TestProject\Test_Narumi\Test_Narumi.csproj", "{EB77976F-4DE4-46A5-8B25-D07226204C32}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Narumi", "TestProject\Test_Narumi\Test_Narumi.csproj", "{EB77976F-4DE4-46A5-8B25-D07226204C32}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arCommUtil", "SubProject\CommUtil\arCommUtil.csproj", "{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ENIGProtocol", "SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV4", "Project\AGV4.csproj", "{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV4", "Project\AGV4.csproj", "{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}"
EndProject EndProject
@@ -49,24 +37,6 @@ Global
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F31C242C-1B15-4518-9733-48558499FE4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x64.ActiveCfg = Debug|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x64.Build.0 = Debug|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x86.ActiveCfg = Debug|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Release|Any CPU.Build.0 = Release|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Release|x64.ActiveCfg = Release|Any CPU
{F31C242C-1B15-4518-9733-48558499FE4B}.Release|x86.ActiveCfg = Release|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Debug|x64.ActiveCfg = Debug|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Debug|x64.Build.0 = Debug|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Debug|x86.ActiveCfg = Debug|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Release|Any CPU.Build.0 = Release|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Release|x64.ActiveCfg = Release|Any CPU
{A16C9667-5241-4313-888E-548375F85D29}.Release|x86.ActiveCfg = Release|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.Build.0 = Debug|Any CPU {BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|x64.ActiveCfg = Debug|Any CPU {BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -91,30 +61,6 @@ Global
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x64.Build.0 = Release|Any CPU {8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x64.Build.0 = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.ActiveCfg = Release|Any CPU {8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.ActiveCfg = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.Build.0 = Release|Any CPU {8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.Build.0 = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x64.ActiveCfg = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x64.Build.0 = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x86.ActiveCfg = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x86.Build.0 = Debug|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|Any CPU.Build.0 = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x64.ActiveCfg = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x64.Build.0 = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x86.ActiveCfg = Release|Any CPU
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x86.Build.0 = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x64.Build.0 = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x86.Build.0 = Debug|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|Any CPU.Build.0 = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x64.ActiveCfg = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x64.Build.0 = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x86.ActiveCfg = Release|Any CPU
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x86.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x64.ActiveCfg = Debug|Any CPU {CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -151,18 +97,6 @@ Global
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x64.Build.0 = Release|Any CPU {37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x64.Build.0 = Release|Any CPU
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.ActiveCfg = Release|Any CPU {37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.ActiveCfg = Release|Any CPU
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.Build.0 = Release|Any CPU {37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.Build.0 = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x64.ActiveCfg = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x64.Build.0 = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x86.ActiveCfg = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x86.Build.0 = Debug|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|Any CPU.Build.0 = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x64.ActiveCfg = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x64.Build.0 = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x86.ActiveCfg = Release|Any CPU
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x86.Build.0 = Release|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|x64.ActiveCfg = Debug|Any CPU {8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -199,30 +133,18 @@ Global
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x64.Build.0 = Release|Any CPU {EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x64.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.ActiveCfg = Release|Any CPU {EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.Build.0 = Release|Any CPU {EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.Build.0 = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|Any CPU.Build.0 = Debug|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x64.ActiveCfg = Debug|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x64.ActiveCfg = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x64.Build.0 = Debug|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x64.Build.0 = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x86.ActiveCfg = Debug|x86 {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x86.ActiveCfg = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x86.Build.0 = Debug|x86 {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x86.Build.0 = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|Any CPU.ActiveCfg = Release|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|Any CPU.Build.0 = Release|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.Build.0 = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x64.ActiveCfg = Release|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Release|x64.ActiveCfg = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x64.Build.0 = Release|Any CPU {9365803B-933D-4237-93C7-B502C855A71C}.Release|x64.Build.0 = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x86.ActiveCfg = Release|x86 {9365803B-933D-4237-93C7-B502C855A71C}.Release|x86.ActiveCfg = Release|Any CPU
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x86.Build.0 = Release|x86 {9365803B-933D-4237-93C7-B502C855A71C}.Release|x86.Build.0 = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x64.ActiveCfg = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x64.Build.0 = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x86.ActiveCfg = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x86.Build.0 = Debug|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|Any CPU.Build.0 = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x64.ActiveCfg = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x64.Build.0 = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x86.ActiveCfg = Release|Any CPU
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x86.Build.0 = Release|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|x64.ActiveCfg = Debug|Any CPU {D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -240,19 +162,13 @@ Global
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{F31C242C-1B15-4518-9733-48558499FE4B} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{A16C9667-5241-4313-888E-548375F85D29} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{8CB883C0-99C3-4DD4-B017-F9B92010A806} = {C423C39A-44E7-4F09-B2F7-7943975FF948} {8CB883C0-99C3-4DD4-B017-F9B92010A806} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{9C027BF1-289F-4CC8-83F0-CB2B975C39C2} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A} {CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70} = {C423C39A-44E7-4F09-B2F7-7943975FF948} {7A94C30C-6772-4F71-BF9C-0DF071A1BC70} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{00BBEF50-3899-4BF1-82E0-DF065CB2A88C} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7} = {C423C39A-44E7-4F09-B2F7-7943975FF948} {8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{14E8C9A5-013E-49BA-B435-EFEFC77DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948} {14E8C9A5-013E-49BA-B435-EFEFC77DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{EB77976F-4DE4-46A5-8B25-D07226204C32} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A} {EB77976F-4DE4-46A5-8B25-D07226204C32} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{14E8C9A5-013E-49BA-B435-FFFFFF7DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948} {9365803B-933D-4237-93C7-B502C855A71C} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9} SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -99,6 +99,18 @@
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="arCommUtil, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\arCommUtil.dll</HintPath>
</Reference>
<Reference Include="arControl.Net4, Version=23.9.11.1030, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\arControl.Net4.dll</HintPath>
</Reference>
<Reference Include="CarlosAg.ExcelXmlWriter, Version=1.0.0.6, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\CarlosAg.ExcelXmlWriter.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Speech, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Speech, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll</HintPath> <HintPath>C:\Program Files (x86)\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll</HintPath>
@@ -520,14 +532,6 @@
<Project>{8bae0eac-3d25-402f-9a65-2ba1ecfe28b7}</Project> <Project>{8bae0eac-3d25-402f-9a65-2ba1ecfe28b7}</Project>
<Name>NARUMI</Name> <Name>NARUMI</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SubProject\arCtl\arControl.csproj">
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
<Name>arControl</Name>
</ProjectReference>
<ProjectReference Include="..\SubProject\arFrameControl\arFrameControl.csproj">
<Project>{a16c9667-5241-4313-888e-548375f85d29}</Project>
<Name>arFrameControl</Name>
</ProjectReference>
<ProjectReference Include="..\SubProject\BMS\BMS.csproj"> <ProjectReference Include="..\SubProject\BMS\BMS.csproj">
<Project>{7a94c30c-6772-4f71-bf9c-0df071a1bc70}</Project> <Project>{7a94c30c-6772-4f71-bf9c-0df071a1bc70}</Project>
<Name>BMS</Name> <Name>BMS</Name>
@@ -536,10 +540,6 @@
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project> <Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name> <Name>CommData</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SubProject\CommUtil\arCommUtil.csproj">
<Project>{14e8c9a5-013e-49ba-b435-ffffff7dd623}</Project>
<Name>arCommUtil</Name>
</ProjectReference>
<ProjectReference Include="..\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj"> <ProjectReference Include="..\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj">
<Project>{499d8912-4b96-41e5-a70d-cfe797883d65}</Project> <Project>{499d8912-4b96-41e5-a70d-cfe797883d65}</Project>
<Name>ENIGProtocol</Name> <Name>ENIGProtocol</Name>

View File

@@ -34,6 +34,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="arCommUtil">
<HintPath>..\..\DLL\arCommUtil.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@@ -59,10 +62,6 @@
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project> <Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name> <Name>CommData</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\CommUtil\arCommUtil.csproj">
<Project>{14e8c9a5-013e-49ba-b435-ffffff7dd623}</Project>
<Name>arCommUtil</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -1,23 +1,23 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace arFrame.Control namespace arFrame.Control
{ {
[TypeConverterAttribute(typeof(ExpandableObjectConverter))] [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class ColorListItem public class ColorListItem
{ {
public System.Drawing.Color BackColor1 { get; set; } public System.Drawing.Color BackColor1 { get; set; }
public System.Drawing.Color BackColor2 { get; set; } public System.Drawing.Color BackColor2 { get; set; }
public string Remark { get; set; } public string Remark { get; set; }
public ColorListItem() public ColorListItem()
{ {
BackColor1 = System.Drawing.Color.Transparent; BackColor1 = System.Drawing.Color.Transparent;
BackColor2 = System.Drawing.Color.Transparent; BackColor2 = System.Drawing.Color.Transparent;
Remark = string.Empty; Remark = string.Empty;
} }
} }
} }

View File

@@ -1,50 +1,50 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace arFrame.Control namespace arFrame.Control
{ {
[TypeConverterAttribute(typeof(ExpandableObjectConverter))] [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class GridViewItem public class GridViewItem
{ {
public int row { get; private set; } public int row { get; private set; }
public int col { get; private set; } public int col { get; private set; }
public int idx { get; private set; } public int idx { get; private set; }
[Category("arFrame"), DisplayName("Tag")] [Category("arFrame"), DisplayName("Tag")]
public string Tag { get; set; } public string Tag { get; set; }
[Category("arFrame"), DisplayName("글자 정렬 방식")] [Category("arFrame"), DisplayName("글자 정렬 방식")]
public System.Drawing.ContentAlignment TextAlign { get; set; } public System.Drawing.ContentAlignment TextAlign { get; set; }
[Category("arFrame"), DisplayName("글자 여백")] [Category("arFrame"), DisplayName("글자 여백")]
public System.Windows.Forms.Padding Padding { get; set; } public System.Windows.Forms.Padding Padding { get; set; }
[Category("arFrame"), DisplayName("메뉴 사용여부"), Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")] [Category("arFrame"), DisplayName("메뉴 사용여부"), Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")]
public Boolean Enable { get; set; } public Boolean Enable { get; set; }
public System.Drawing.Color BackColor1 { get; set; } public System.Drawing.Color BackColor1 { get; set; }
public System.Drawing.Color BackColor2 { get; set; } public System.Drawing.Color BackColor2 { get; set; }
public Boolean Dirty { get; set; } public Boolean Dirty { get; set; }
public System.Drawing.RectangleF rect { get; set; } public System.Drawing.RectangleF rect { get; set; }
[Category("arFrame"), DisplayName("번호")] [Category("arFrame"), DisplayName("번호")]
public int No { get; set; } public int No { get; set; }
public GridViewItem(int idx_,int _r,int _c) public GridViewItem(int idx_,int _r,int _c)
{ {
this.row = _r; this.row = _r;
this.col = _c; this.col = _c;
BackColor1 = System.Drawing.Color.Transparent; BackColor1 = System.Drawing.Color.Transparent;
BackColor2 = System.Drawing.Color.Transparent; BackColor2 = System.Drawing.Color.Transparent;
rect = System.Drawing.RectangleF.Empty; rect = System.Drawing.RectangleF.Empty;
Enable = true; Enable = true;
this.idx = idx_; this.idx = idx_;
TextAlign = System.Drawing.ContentAlignment.MiddleCenter; TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
Padding = new System.Windows.Forms.Padding(0, 0, 0, 0); Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
No = 0; No = 0;
this.Dirty = true; this.Dirty = true;
} }
} }
} }

View File

@@ -1,36 +1,36 @@
namespace arFrame.Control namespace arFrame.Control
{ {
partial class GridView partial class GridView
{ {
/// <summary> /// <summary>
/// 필수 디자이너 변수입니다. /// 필수 디자이너 변수입니다.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 사용 중인 모든 리소스를 정리합니다. /// 사용 중인 모든 리소스를 정리합니다.
/// </summary> /// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param> /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region #region
/// <summary> /// <summary>
/// 디자이너 지원에 필요한 메서드입니다. /// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오. /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
} }
#endregion #endregion
} }
} }

View File

@@ -19,7 +19,7 @@ namespace AGVControl.Properties {
// 클래스에서 자동으로 생성되었습니다. // 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
@@ -47,8 +47,8 @@ namespace AGVControl.Properties {
} }
/// <summary> /// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대 현재 스레드의 CurrentUICulture 속성을 /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대 현재 스레드의 CurrentUICulture
/// 재정의합니다. /// 속성을 재정의합니다.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {

View File

@@ -34,6 +34,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="arCommUtil">
<HintPath>..\..\DLL\arCommUtil.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -57,6 +60,14 @@
<Compile Include="Dialog\fPropertyRFIDPoint.Designer.cs"> <Compile Include="Dialog\fPropertyRFIDPoint.Designer.cs">
<DependentUpon>fPropertyRFIDPoint.cs</DependentUpon> <DependentUpon>fPropertyRFIDPoint.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GridView\ColorListItem.cs" />
<Compile Include="GridView\GridItem.cs" />
<Compile Include="GridView\GridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GridView\GridView.Designer.cs">
<DependentUpon>GridView.cs</DependentUpon>
</Compile>
<Compile Include="MapControlManager.cs" /> <Compile Include="MapControlManager.cs" />
<Compile Include="Models\AGVActionPrediction.cs" /> <Compile Include="Models\AGVActionPrediction.cs" />
<Compile Include="BatteryLevelGauge.cs"> <Compile Include="BatteryLevelGauge.cs">
@@ -134,10 +145,6 @@
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project> <Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name> <Name>CommData</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\CommUtil\arCommUtil.csproj">
<Project>{14e8c9a5-013e-49ba-b435-ffffff7dd623}</Project>
<Name>arCommUtil</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Resources\ico_navi_40.png" /> <None Include="Resources\ico_navi_40.png" />

View File

@@ -91,7 +91,10 @@ namespace arDev
} }
bool Recv0 = false; bool Recv0 = false;
int Recv0Cnt = 0;
bool Recv1 = false; bool Recv1 = false;
int Recv1Cnt = 0;
public event EventHandler<ChargetDetectArgs> ChargeDetect; public event EventHandler<ChargetDetectArgs> ChargeDetect;
public override bool ProcessRecvData(byte[] data) public override bool ProcessRecvData(byte[] data)
{ {
@@ -110,6 +113,13 @@ namespace arDev
} }
if (VerifyChecksum(data) == false)
{
RaiseMessage(MessageType.Error, "Checksum error");
return false;
}
if (data[1] == 0x03) if (data[1] == 0x03)
{ {
return ParseBMSInfo(); return ParseBMSInfo();
@@ -123,6 +133,8 @@ namespace arDev
} }
bool ParseBMSCellVoltage() bool ParseBMSCellVoltage()
{ {
if (UseCmdLogging == true)
RaiseMessage(MessageType.Recv, ByteListToHexString(LastReceiveBuffer.ToList()));
//var i = 0; //var i = 0;
var BatteryCell_Checksum = 0xffff;// - (LastReceiveBuffer[i + 3] + LastReceiveBuffer[i + 4] + LastReceiveBuffer[i + 5] + LastReceiveBuffer[i + 6] + LastReceiveBuffer[i + 7] + LastReceiveBuffer[i + 8] + LastReceiveBuffer[i + 9] + LastReceiveBuffer[i + 10] + LastReceiveBuffer[i + 11] + LastReceiveBuffer[i + 12] + LastReceiveBuffer[i + 13] + LastReceiveBuffer[i + 14] + LastReceiveBuffer[i + 15] + LastReceiveBuffer[i + 16] + LastReceiveBuffer[i + 17] + LastReceiveBuffer[i + 18] + LastReceiveBuffer[i + 19])) + 1; var BatteryCell_Checksum = 0xffff;// - (LastReceiveBuffer[i + 3] + LastReceiveBuffer[i + 4] + LastReceiveBuffer[i + 5] + LastReceiveBuffer[i + 6] + LastReceiveBuffer[i + 7] + LastReceiveBuffer[i + 8] + LastReceiveBuffer[i + 9] + LastReceiveBuffer[i + 10] + LastReceiveBuffer[i + 11] + LastReceiveBuffer[i + 12] + LastReceiveBuffer[i + 13] + LastReceiveBuffer[i + 14] + LastReceiveBuffer[i + 15] + LastReceiveBuffer[i + 16] + LastReceiveBuffer[i + 17] + LastReceiveBuffer[i + 18] + LastReceiveBuffer[i + 19])) + 1;
for (int i = 3; i < 20; i++) for (int i = 3; i < 20; i++)
@@ -170,8 +182,62 @@ namespace arDev
} }
public static bool VerifyChecksum(byte[] dataBytes)
{
// 길이 바이트 (byte[3])
byte length = dataBytes[3];
if (dataBytes[1] == 0x03)
{
// 데이터 바이트 (byte[4] ~ byte[30])
byte[] data = dataBytes.Skip(4).Take(27).ToArray();
// 길이와 데이터의 합을 계산
ushort sum = (ushort)(length + data.Sum(b => b));
// 반전시키고 높은 위치부터 낮은 위치로 더한 후 1을 더함
ushort checksum = (ushort)((~sum + 1) & 0xFFFF);
// 받은 체크섬 (byte[31] ~ byte[32])
ushort receivedChecksum = (ushort)((dataBytes[31] << 8) | dataBytes[32]);
//252 1: 64514
// 계산된 체크섬과 받은 체크섬을 비교
return checksum == receivedChecksum;
}
else if (dataBytes[1] == 0x04)
{
// 데이터 바이트 (byte[4] ~ byte[30])
byte[] data = dataBytes.Skip(4).Take(16).ToArray();
// 길이와 데이터의 합을 계산
ushort sum = (ushort)(length + data.Sum(b => b));
// 반전시키고 높은 위치부터 낮은 위치로 더한 후 1을 더함
ushort checksum = (ushort)((~sum + 1) & 0xFFFF);
// 받은 체크섬 (byte[31] ~ byte[32])
ushort receivedChecksum = (ushort)((dataBytes[20] << 8) | dataBytes[21]);
//252 1: 64514
// 계산된 체크섬과 받은 체크섬을 비교
return checksum == receivedChecksum;
}
return false;
}
bool ParseBMSInfo() bool ParseBMSInfo()
{ {
if(UseCmdLogging == true)
RaiseMessage(MessageType.Recv, ByteListToHexString(LastReceiveBuffer.ToList()));
//전압확인 //전압확인
UInt16 batH = (UInt16)LastReceiveBuffer[4]; UInt16 batH = (UInt16)LastReceiveBuffer[4];
UInt16 batL = (UInt16)LastReceiveBuffer[5]; UInt16 batL = (UInt16)LastReceiveBuffer[5];
@@ -361,6 +427,10 @@ namespace arDev
public int QueryIndex { get; set; } = 0; public int QueryIndex { get; set; } = 0;
public int CMDOutCnt { get; set; } = 3;
public bool UseCmdLogging { get; set; } = false;
/// <summary> /// <summary>
/// 상태읽기와 전압읽기명령을 반복합니다 /// 상태읽기와 전압읽기명령을 반복합니다
/// </summary> /// </summary>
@@ -375,8 +445,22 @@ namespace arDev
Recv1 = false; Recv1 = false;
return true; return true;
} }
else
{
if (Recv0Cnt > CMDOutCnt)
{
Recv0Cnt = 0;
RaiseMessage(MessageType.Error, "0 명령 Count Out");
QueryIndex = 1;
Recv1 = false;
return true;
}
else
{
return SendQuery_ReadStatue();
}
return SendQuery_ReadStatue(); }
} }
else else
{ {
@@ -386,29 +470,47 @@ namespace arDev
Recv0 = false; Recv0 = false;
return true; return true;
} }
else
return SendQuery_ReadCellvoltage(); {
if (Recv1Cnt > CMDOutCnt)
{
Recv1Cnt = 0;
RaiseMessage(MessageType.Error, "1 명령 Count Out");
QueryIndex = 0;
Recv0 = false;
return true;
}
else
{
return SendQuery_ReadCellvoltage();
}
}
} }
} }
public Boolean SendQuery_ReadStatue() public Boolean SendQuery_ReadStatue()
{ {
Recv0Cnt++;
Recv0 = false; Recv0 = false;
var cmd = new List<byte>(); var cmd = new List<byte>();
cmd.Add(0xDD); //stx cmd.Add(0xDD);
cmd.Add(0xA5); //read cmd.Add(0xA5);
cmd.Add(0x03); //command cmd.Add(0x03);
cmd.Add(0x00); cmd.Add(0x00);
cmd.Add(0xFF); cmd.Add(0xFF);
cmd.Add(0xFD); //checksum1 cmd.Add(0xFD);
cmd.Add(0x77); //checksum2 cmd.Add(0x77);
cmd.Add(0x0D); //etx cmd.Add(0x0D);
if (UseCmdLogging == true)
RaiseMessage(MessageType.Normal, ByteListToHexString(cmd));
return WriteData(cmd.ToArray()); return WriteData(cmd.ToArray());
} }
public Boolean SendQuery_ReadCellvoltage() public Boolean SendQuery_ReadCellvoltage()
{ {
Recv1Cnt++;
Recv1 = false; Recv1 = false;
var cmd = new List<byte>(); var cmd = new List<byte>();
cmd.Add(0xDD); cmd.Add(0xDD);
@@ -419,8 +521,21 @@ namespace arDev
cmd.Add(0xFC); cmd.Add(0xFC);
cmd.Add(0x77); cmd.Add(0x77);
cmd.Add(0x0D); cmd.Add(0x0D);
if (UseCmdLogging == true)
RaiseMessage(MessageType.Normal, ByteListToHexString(cmd));
return WriteData(cmd.ToArray()); return WriteData(cmd.ToArray());
} }
public string ByteListToHexString(List<byte> byteList)
{
StringBuilder hex = new StringBuilder(byteList.Count * 2);
foreach (byte b in byteList)
{
hex.AppendFormat("{0:X2} ", b);
}
return hex.ToString();
}
} }
} }

View File

@@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace arDev.Arduino
{
public enum IODirection
{
Input = 0,
Output
}
public enum MessageType
{
Normal = 0,
SendData,
ReceiveData,
Message,
RxIOData,
RxSetData,
}
}

View File

@@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace arDev.Arduino
{
public partial class DIO
{
/// <summary>
/// Digital Input/Output Changed
/// </summary>
public event EventHandler<IOValueEventArgs> ValueChanged;
public event EventHandler<FlagValueEventArgs> FlagChanged;
/// <summary>
/// 마그넷 센서의 값이 변경되었을때 발생 함
/// </summary>
public event EventHandler PositionChanged;
///// <summary>
///// Digital Input/Output Message
///// </summary>
//public event EventHandler<MessageEventArgs> Message;
public class FlagValueEventArgs : EventArgs
{
private int _arridx;
private Boolean _oldvalue;
private Boolean _newvalue;
public int ArrIDX { get { return _arridx; } }
public Boolean OldValue { get { return _oldvalue; } }
public Boolean NewValue { get { return _newvalue; } }
public FlagValueEventArgs( int ArrIDX, Boolean oldvalue, Boolean newvalue)
{
_arridx = ArrIDX;
_oldvalue = oldvalue;
_newvalue = newvalue;
}
}
public class IOValueEventArgs : EventArgs
{
private int _arridx;
private Boolean _oldvalue;
private Boolean _newvalue;
private IODirection _dir;
public int ArrIDX { get { return _arridx; } }
public Boolean OldValue { get { return _oldvalue; } }
public Boolean NewValue { get { return _newvalue; } }
public IODirection Direction { get { return _dir; } }
public IOValueEventArgs(IODirection dir, int ArrIDX, Boolean oldvalue, Boolean newvalue)
{
_arridx = ArrIDX;
_oldvalue = oldvalue;
_newvalue = newvalue;
_dir = dir;
}
}
//public class MessageEventArgs : EventArgs
//{
// private Boolean _isError = false;
// public Boolean IsError { get { return _isError; } }
// private string _message = string.Empty;
// public string Message { get { return _message; } }
// private Arduino.MessageType _mtype;
// public Arduino.MessageType MessageType { get { return _mtype; } }
// public MessageEventArgs(Arduino.MessageType mType, string Message, Boolean isError)
// {
// _isError = isError;
// _message = Message;
// this._mtype = mType;
// }
//}
}
}

View File

@@ -1,556 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.ComponentModel;
using System.Reflection;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Collections.Concurrent;
namespace arDev.Arduino
{
public partial class DIO : arRS232
{
protected object lockobj = new object();
public struct SetupInfo
{
public byte ioInterval;
public byte ResetCount;
public byte SpeedH;
public byte SpeedL;
public byte SpeedZ;
public byte pindirRevDILow;
public byte pindirRevDIHigh;
public byte UpTime;
public byte BalanceThd;
public byte MarkThd;
public byte SpeedC;
public byte BalanceThdUp;
public Boolean IsValid;
public void Clear()
{
pindirRevDIHigh = 0;
pindirRevDILow = 0;
ioInterval = 0;
ResetCount = 0;
SpeedH = 0;
SpeedL = 0;
SpeedC = 0;
BalanceThd = 0;
BalanceThd = 0;
UpTime = 0;
MarkThd = 0;
SpeedZ = 0;
IsValid = false;
}
}
public SetupInfo setupInfo;
private Boolean STX11 = false;
private Boolean STX21 = false;
//private Boolean ETX11 = false;
// private byte[] buffer1;
// readonly List<byte> Tempbuffer1 = new List<byte>();
readonly ManualResetEvent mre = new ManualResetEvent(true);
// protected string errorMessage = string.Empty;
// readonly System.IO.Ports.SerialPort dev = null;
private byte LEN1 = 0;
//private byte CHK1 = 0;
//private int bufferCount1 = 0;
public DateTime ConnTryTime = DateTime.Now.AddDays(-1);
protected DateTime[] SetFlagTime = new DateTime[32];
readonly Boolean[] Flag = new bool[32];
readonly Boolean[] DIValue = new bool[16];
readonly Boolean[] DOValue = new bool[16];
public UInt16[] AIValue = new ushort[3];
public byte[] AOValue = new byte[3];
public string ioBinStr = string.Empty;
public string SetupStr = string.Empty;
public byte RunTime = 0;
public byte[] MAG_VALUE = new byte[2];
public byte[] SV_SPEED = new byte[2];
public Boolean isDisposed = false; //dispose가 호출되었는가?
public string LastMessage { get; set; }
public DateTime LastMessageTime { get; set; }
/// <summary>
/// 생성자
/// </summary>
public DIO()
{
//설정의 값
setupInfo = new SetupInfo();
setupInfo.Clear();
SV_SPEED[0] = 0;
SV_SPEED[1] = 0;
//마그넷 센서(0~100)
MAG_VALUE[0] = 50;
MAG_VALUE[1] = 50;
lastRecvTime = DateTime.Parse("1982-11-23");
for (int i = 0; i < Flag.Length; i++)
Flag[i] = false;
for (int i = 0; i < DIValue.Length; i++)
DIValue[i] = false;
for (int i = 0; i < DOValue.Length; i++)
DOValue[i] = false;
for (int i = 0; i < AIValue.Length; i++)
AIValue[i] = 0;
for (int i = 0; i < AOValue.Length; i++)
AOValue[i] = 0;
for (int i = 0; i < SetFlagTime.Length; i++)
SetFlagTime[i] = DateTime.Parse("1982-11-23");
}
protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
{
List<byte> remain = new List<byte>();
Boolean bComplete = false;
for (int i = 0; i < buf.Length; i++)
{
var incomByte = buf[i];
if (bComplete == true)
{
remain.Add(incomByte);
}
else
{
if (STX11 == false)
{
if (incomByte != '@')
{
STX21 = false;
// ETX11 = false;
continue;
}
else
{
STX11 = true;
tempBuffer.Clear();
tempBuffer.Add(incomByte);
}
}
else if (STX21 == false)
{
if (tempBuffer.Count != 1 || tempBuffer.Count < 1 || tempBuffer[0] != '@' || incomByte != '@')
{
STX11 = false;
//ETX11 = false;
continue;
}
else
{
STX21 = true;
tempBuffer.Add(incomByte);
}
}
else
{
tempBuffer.Add(incomByte);
//여기서부터는무조건 누적한다.
if (tempBuffer.Count == 3)
{
if (tempBuffer[0] != '@' || tempBuffer[1] != '@')
{
STX11 = false;
STX21 = false;
// ETX11 = false;
LEN1 = 0;
tempBuffer.Clear();
}
else LEN1 = incomByte; //데이터 길이가온다
}
//else if (Tempbuffer1.Count == LEN1 + 5) //ETX1
//{
// if (incomingByte != 0x0D)
// {
// //ETX가 와야하는데 다른데이터가 왔다
// STX11 = false;
// STX21 = false;
// // ETX11 = false;
// var str = System.Text.Encoding.Default.GetString(Tempbuffer1.ToArray());
// RaiseMessage(MessageType.ReceiveData, "에러 모두 파기 : " + str, true);
// Tempbuffer1.Clear();
// }
//}
else if (tempBuffer.Count == LEN1 + 6)
{
//전체길이를 만족햇다.
if (incomByte != 0x0A)
{
//ETX가 와야하는데 다른데이터가 왔다
STX11 = false;
STX21 = false;
// ETX11 = false;
//var str = System.Text.Encoding.Default.GetString(Tempbuffer1.ToArray());
RaiseMessage(MessageType.Error, "에러 모두 파기 : ETX 값 오류");
tempBuffer.Clear();
}
else if (tempBuffer[tempBuffer.Count - 2] != 0x0D)
{
//ETX가 와야하는데 다른데이터가 왔다
STX11 = false;
STX21 = false;
// ETX11 = false;
//var str = System.Text.Encoding.Default.GetString(Tempbuffer1.());
RaiseMessage(MessageType.Error, "에러 모두 파기 : ETX 값 오류");
tempBuffer.Clear();
}
else
{
STX11 = false;
STX21 = false;
// ETX11 = false;
//if (LastReceiveBuffer == null) LastReceiveBuffer = new byte[tempBuffer.Count];
//else if (LastReceiveBuffer.Length != tempBuffer.Count) Array.Resize(ref LastReceiveBuffer, Tempbuffer1.Count);
//tempBuffer.CopyTo(LastReceiveBuffer)tempBuffer
//tempBuffer.Clear();
bComplete = true;
}
}
}
}
}
remainBuffer = remain.ToArray();
return bComplete;
}
bool Checksum(byte[] buffer, int datalength)
{
//체크섬필요 221118
if (buffer[buffer.Length-3] == '*')
{
return true;
}
byte checksum = 0;
for (int i = 3; i < datalength + 3; i++)
{
checksum = (byte)(checksum ^ buffer[i]);
}
return checksum == buffer[buffer.Length - 3];
}
public override bool ProcessRecvData(byte[] data)
{
var hexString = GetHexString(data);//.gethe
var len = data[2];
if (len + 6 != data.Length)
{
RaiseMessage(MessageType.Error, string.Format("길이오류 예상:{0},수신:{1},{2}", len + 5, data.Length, hexString));
}
else if (data[0] != 0x40 || data[1] != 0x40 || data[data.Length - 2] != 0x0D || data[data.Length - 1] != 0x0A)
{
RaiseMessage(MessageType.Error, string.Format("헤더 오류 : {0}", hexString));
}
else if (Checksum(data, len) == false) //체크섬 221118
{
RaiseMessage(MessageType.Error, string.Format("체크섬 오류 : {0}", hexString));
}
else
{
//RaiseMessage(MessageType.ReceiveData, hexString);
lastRecvTime = DateTime.Now;
var cmd = data[3];
if (cmd == 'I') //IOData
{
if (len != 10)
RaiseMessage(MessageType.Error, "IO수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
else Parse_IOData(data);
}
else if (cmd == 'T')
{
// Boolean errorMessage = buffer[4] == 1;
var message = System.Text.Encoding.Default.GetString(data, 5, len - 2);//데이터타입과 에러여부 제거
LastMessage = message;
LastMessageTime = DateTime.Now;
RaiseMessage(MessageType.Normal, message);
}
else if (cmd == 'S') //setup 정보 200310 (홈)
{
if (len != 13)
RaiseMessage(MessageType.Error, "SETUP수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
else Parse_SetupData(data);
}
else
{
RaiseMessage(MessageType.Normal, "Unknown:" + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(data));
}
}
return true;
}
void Parse_IOData(byte[] buffer)
{
var IOData = BitConverter.ToUInt32(buffer, 4);
//var newMagF = BitConverter.ToUInt16(buffer, 8);
//va1r newMagB = BitConverter.ToUInt16(buffer, 10);
//var newAlign = BitConverter.ToUInt16(buffer, 12);
//if (newMagF != AIValue[0] || newMagB != AIValue[1])
//{
// AIValue[0] = newMagF;// BitConverter.ToUInt16(buffer, 8); //마그넷센서 F
// AIValue[1] = newMagB; //BitConverter.ToUInt16(buffer, 10); //마그넷센서 B
// PositionChanged?.Invoke(this, null);
//}
//AIValue[2] = newAlign;
//AOValue[0] = buffer[14]; //왼쪽바퀴 속도
//AOValue[1] = buffer[15]; //오른쪽바퀴 속도
//AOValue[2] = buffer[16]; //Z축 속도
//SV_SPEED[0] = buffer[21]; //왼쪽바퀴의 설정속도
//SV_SPEED[1] = buffer[22]; //오른쪽바퀴의 설정속도
//MAG_VALUE[0] = buffer[23]; //magnet front
//MAG_VALUE[1] = buffer[24]; //magnet rear
RunTime = buffer[12];
//플래그값 확인
byte[] buf_flag = new byte[4];
Array.Copy(buffer, 8, buf_flag, 0, 4);
var baF = new System.Collections.BitArray(buf_flag);
for (int i = 0; i < 32; i++)
{
Boolean val = baF[i];
//입력
if (this.Flag[i] != val)
{
Flag[i] = val;
//변경이벤트 생성
FlagChanged?.Invoke(this, new FlagValueEventArgs(i, !val, val));
}
}
//IO값 확인
byte[] buf_iodata = new byte[4];
Array.Copy(buffer, 4, buf_iodata, 0, 4);
var ba = new System.Collections.BitArray(buf_iodata);
for (int i = 0; i < 32; i++)
{
Boolean val = ba[i];
if (i >= 16)
{
//출력
if (DOValue[i - 16] != val)
{
DOValue[i - 16] = val;
//변경이벤트 생성
ValueChanged?.Invoke(this, new IOValueEventArgs(IODirection.Output, i - 16, !val, val));
}
}
else
{
//입력
if (DIValue[i] != val)
{
DIValue[i] = val;
//변경이벤트 생성
ValueChanged?.Invoke(this, new IOValueEventArgs(IODirection.Input, i, !val, val));
}
}
}
ioBinStr = Convert.ToString(IOData, 2).PadLeft(32, '0');
//string msg = string.Format(DateTime.Now.ToString("mm:ss.fff") + " IO:{0},AN={1:0000},{2:0000},FG={3},AO={4},{5}",
// binstr, An1, An2, FGData, Ao11, Ao12);
}
void Parse_SetupData(byte[] buffer)
{
setupInfo.ioInterval = buffer[4];
setupInfo.ResetCount = buffer[5];
setupInfo.SpeedH = buffer[6];
setupInfo.SpeedL = buffer[7];
setupInfo.SpeedZ = buffer[8];
setupInfo.pindirRevDIHigh = buffer[9];
setupInfo.pindirRevDILow = buffer[10];
setupInfo.UpTime = buffer[11];
setupInfo.BalanceThd = buffer[12];
setupInfo.MarkThd = buffer[13];
setupInfo.SpeedC = buffer[14];
setupInfo.BalanceThdUp = buffer[15];
SetupStr = string.Format("I:{0},R={1},H={2},L={3},Z={4},UP={5},BL={6},MK={7},SPD_C={8},BLUP={9}",
setupInfo.ioInterval,
setupInfo.ResetCount,
setupInfo.SpeedH,
setupInfo.SpeedL,
setupInfo.SpeedZ,
setupInfo.UpTime,
setupInfo.BalanceThd,
setupInfo.MarkThd,
setupInfo.SpeedC,
setupInfo.BalanceThdUp);
}
public byte MakeChecksum(byte[] buffer)
{
//return 0;
byte chk = 0;
foreach (var b in buffer)
chk = (byte)(chk ^ b);
return chk;
}
#region "Method"
protected Boolean Sendcommand(byte cmd, byte p1, byte p2)
{
//이번호의 상태를 on/off 해줘야함
List<byte> buffer = new List<byte>
{
cmd, //command
p1,
p2
};
byte dataLen = (byte)buffer.Count; //데이터길이
byte checksum = MakeChecksum(buffer.ToArray());
buffer.Insert(0, (byte)'@'); //stx
buffer.Insert(1, (byte)'@'); //stx
buffer.Insert(2, dataLen);
buffer.Add(checksum); //길이를 제외한 실제 데이터 영역만 체크섬
buffer.Add(0x0D); //etx
buffer.Add(0x0A); //etx
return WriteData(buffer.ToArray());
}
/// <summary>
/// 이벤트를 강제 생성합니다.(내부변수값도 변경됩니다)
/// </summary>
/// <param name="Direction"></param>
/// <param name="idx"></param>
/// <param name="value"></param>
public void RaiseEvent(IODirection dir, int idx, Boolean value)
{
if (ValueChanged != null)
{
if (!mre.WaitOne(100))
{
RaiseMessage( MessageType.Error, "RaiseEvent WaitOne Timeout");
return;
}
mre.Reset();
bool curValue;
if (dir == IODirection.Input)
{
curValue = DIValue[idx];
DIValue[idx] = value;
}
else
{
curValue = DOValue[idx];
DOValue[idx] = value;
}
try
{
//이벤트를 할당한곳에서 오류가 나면 이곳에서 에러가 잡힌다.
ValueChanged(this, new IOValueEventArgs(dir, idx, curValue, value));
}
catch (Exception ex)
{
RaiseMessage(MessageType.Error, ex.Message);
}
finally
{
mre.Set();
}
}
}
//public Boolean GetFlag(byte idx)
//{
// return Flag[idx];
//}
public Boolean GetValueI(byte idx)
{
if (idx < DIValue.Length) return DIValue[idx];
else return false;
}
public Boolean GetValueO(byte idx)
{
if (idx < DOValue.Length) return DOValue[idx];
else return false;
}
//public Boolean SetValueI(int idx,Boolean value)
//{
// if (idx < DIValue.Length)
// {
// DIValue[idx] = value;
// return true;
// }
// else return false;
//}
public Boolean SetValue(byte idx, Boolean value)
{
byte SET_PINMODE = 3;
if (value == true) return Sendcommand(SET_PINMODE, idx, 1);
else return Sendcommand(SET_PINMODE, idx, 0);
}
public Boolean SetToggle(byte idx)
{
var curbalue = GetValueO(idx);
return SetValue(idx, !curbalue);
}
public string GetErrorMessage()
{
return errorMessage;
}
#endregion
}
}

View File

@@ -1,389 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using arDev.Arduino;
using COMM;
using AR;
namespace arDev
{
public class FakePLC : arDev.Arduino.DIO
{
private System.Threading.Thread thPLC;
public bool Shutdown { get; set; } = false;
public FakePLC()
{
VAR.Init(128);
}
~FakePLC()
{
System.Threading.Tasks.Task.Run(() =>
{
//쓰레드가 살아잇다면 대기한다
if (thPLC != null && thPLC.IsAlive)
{
System.Threading.Thread.Sleep(100);
}
this.Close();
});
}
private object lockobjdata = new object();
public enum eEEPAddress
{
EEP_IOINTERVAL = 0,
EEP_RESETCOUNT,
EEP_DIREVH,
EEP_DIREVL,
EEP_OPTION,
EEP_UPTIME,
};
public enum eCommand : byte
{
LOAD = 0, //EEPROM 불러오기
SAVE, //EEPROM 저장
RESET, //초기화
PINGCHK,
SET_PINMODE, //PINMODE 설정
SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, //셋팅값 요청
SET_FLAG,
SET_EEPROM,
SET_MANUALSPEED,
GET_SETTING = 50,
GUIDE_MOT = 90, //가이드커버(양쪽) 0=멈춤,1=UP,2=DN 아스키코드표 90=Z
SET_EEP_DIREV,
};
//public enum MotorType
//{
// Left = 0,
// Right
//}
//public enum Direction
//{
// CW = 0,
// CCW,
//}
//public enum RunType
//{
// Stop = 0,
// Up,
// Dn
//}
public enum DIName
{
PINI_EMG = 0,
PINI_BTN_1,
PINI_BTN_2,
PINI_BTN_3,
PINI_BTN_4,
PINI_OVERLOADL,
PINI_OVERLOADR,
PINI_EMPTY_07,
PINI_EMPTY_08,
PINI_BTN_ZUP,
PINI_BTN_ZDN,
PINI_LIMIT_LU,
PINI_LIMIT_LD,
PINI_LIMIT_RU,
PINI_LIMIT_RD,
PINI_STOP,
}
public enum DIPin
{
PINI_EMG = 30,
PINI_BTN_1,
PINI_BTN_2,
PINI_BTN_3,
PINI_BTN_4,
PINI_OVERLOADL,
PINI_OVERLOADR,
PINI_EMPTY_07,
PINI_EMPTY_08,
PINI_BTN_ZUP,
PINI_BTN_ZDN,
PINI_LIMIT_LU,
PINI_LIMIT_LD,
PINI_LIMIT_RU,
PINI_LIMIT_RD,
PINI_STOP,
}
public enum DOName
{
PINO_GUIDEMOTOR_LDIR,
PINO_GUIDEMOTOR_LRUN,
PINO_GUIDEMOTOR_RDIR,
PINO_GUIDEMOTOR_RRUN,
PINO_EMPTY_04,
PINO_EMPTY_05,
PINO_EMPTY_06,
PINO_EMPTY_07,
}
public enum DOPin
{
PINO_GUIDEMOTOR_LDIR = 22,
PINO_GUIDEMOTOR_LRUN,
PINO_GUIDEMOTOR_RDIR,
PINO_GUIDEMOTOR_RRUN,
PINO_EMPTY_04,
PINO_EMPTY_05,
PINO_EMPTY_06,
PINO_EMPTY_07,
}
public enum Rundirection : byte
{
Stop = 0,
Forward,
Backward,
Left,
Right,
EStop,
}
public enum ZMotDirection
{
Stop = 0,
Up,
Down
}
private bool Sendcommand(eCommand cmd, char p1, char p2)
{
return Sendcommand(cmd, (byte)p1, (byte)p2);
}
private bool Sendcommand(eCommand cmd, char p1, byte p2 = 0)
{
return Sendcommand(cmd, (byte)p1, p2);
}
private bool Sendcommand(eCommand cmd, byte p1 = 0, byte p2 = 0)
{
if (cmd != eCommand.PINGCHK)
{
if (cmd == eCommand.SET_FLAG)
{
//플래그값은 공용변수로 변경
var idx = (eVarBool)p1;
VAR.BOOL[idx] = p2 != 0;
RaiseMessage(MessageType.Send, string.Format("PLC CMD:{0} [{1}]=>{2}", cmd, (eVarBool)p1, p2));
}
else
RaiseMessage(MessageType.Send, string.Format("PLC CMD:{0}, P1:{1}, P2:{2}", cmd, p1, p2));
}
return Sendcommand((byte)cmd, p1, p2);
}
public Boolean GetValueI(DIName idx)
{
return GetValueI((byte)idx);
}
public Boolean GetValueO(DOName idx)
{
return GetValueO((byte)idx);
}
public Boolean GetFlag(int flag)
{
return VAR.BOOL[flag];
}
public Boolean GetFlag(COMM.eVarBool flag)
{
return VAR.BOOL[(int)flag];
}
public Boolean SetFlag(byte idx, Boolean value)
{
SetFlagTime[(int)idx] = DateTime.Now; //플래그기록을 시도한 시간
if (value == true)
return Sendcommand(eCommand.SET_FLAG, idx, 1);
else
return Sendcommand(eCommand.SET_FLAG, idx, 0);
}
//public Boolean SetOpt_AD4Invert(Boolean value)
//{
// var idx = (byte)PLCFlag.FLAG_ENABLE_AD4INVERT;
// SetFlagTime[idx] = DateTime.Now; //플래그기록을 시도한 시간
// if (value == true)
// return Sendcommand(eCommand.SET_FLAG, idx, 1);
// else
// return Sendcommand(eCommand.SET_FLAG, idx, 0);
//}
//public Boolean SetLog_SpeedControl(Boolean value)
//{
// var idx = (byte)PLCFlag.FLAG_ENABLE_LOG_SPEED;
// SetFlagTime[idx] = DateTime.Now; //플래그기록을 시도한 시간
// if (value == true)
// return Sendcommand(eCommand.SET_FLAG, idx, 1);
// else
// return Sendcommand(eCommand.SET_FLAG, idx, 0);
//}
public Boolean SetFlag(eVarBool flag, Boolean value)
{
VAR.BOOL[flag] = value;
return true;
}
public Boolean SetEEP(eEEPAddress address, byte value)
{
RaiseMessage(MessageType.Normal, string.Format("[M] Set EEP Rom Addr={0},Val={1}", address, value));
return Sendcommand(eCommand.SET_EEPROM, (byte)address, value);
}
public Boolean SetOutput(byte pinNO, Boolean Value)
{
if (Value == true) return Sendcommand(eCommand.SET_DOUTPUT, pinNO, 1);
else return Sendcommand(eCommand.SET_DOUTPUT, pinNO, 0);
}
public byte ApplySpeedH = 0;
public byte ApplySpeedL = 0;
public byte ApplySpeedC = 0;
public byte ApplySpeedZ = 0;
public DateTime SaveTime = DateTime.Parse("1982-11-23");
public Boolean SetPinReverse(byte High, byte Low)
{
RaiseMessage(MessageType.Normal,
string.Format("Pin Reverse H={0},L={1}", High, Low)
);
bool b1 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_DIREVH, High);
bool b2 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_DIREVL, Low);
return b1 && b2;
}
public Boolean SetMotorUpTime(byte value)
{
RaiseMessage(MessageType.Normal,
string.Format("Motor Up Time Value={0}", value)
);
bool b1 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_UPTIME, value);
return b1;
}
public Boolean SaveEEPROM()
{
RaiseMessage(MessageType.Normal,
string.Format("Save EEPROM")
);
bool b1 = Sendcommand(eCommand.SAVE, 0);
return b1;
}
public Boolean LoadEEPROM()
{
RaiseMessage(MessageType.Normal,
string.Format("Load EEPROM")
);
bool b1 = Sendcommand(eCommand.LOAD, 0);
return b1;
}
//public double ManualSpeed = 0.0;
//public bool SetManualSpeed(double Percvalue)
//{
// var Speed = (byte)((Percvalue / 100.0) * 255.0);
// ManualSpeed = Percvalue;
// // datamanager.COMCONTROLLER.Speak($"{Percvalue} 퍼센트 설정");
// RaiseMessage(MessageType.Normal,
// string.Format("Convert Speed Hold {0}%->{1}", Percvalue, Speed),
// false);
// return Sendcommand(eCommand.SET_MANUALSPEED, Speed);
//}
public DateTime LastPingTime = DateTime.Parse("1982-11-23");
public bool SendPing()
{
LastPingTime = DateTime.Now;
return Sendcommand(eCommand.PINGCHK, 0, 0);
}
public bool ZMot(ZMotDirection dir)
{
if (dir == ZMotDirection.Up)
return Sendcommand(eCommand.GUIDE_MOT, 'A', 'P'); //up
else if (dir == ZMotDirection.Down)
return Sendcommand(eCommand.GUIDE_MOT, 'A', 'N'); //down
else if (dir == ZMotDirection.Stop)
return Sendcommand(eCommand.GUIDE_MOT, 'A', 'S'); //stop
else return false;
}
public bool ZMot_Left(ZMotDirection dir)
{
if (dir == ZMotDirection.Up)
return Sendcommand(eCommand.GUIDE_MOT, 'L', 'P'); //up
else if (dir == ZMotDirection.Down)
return Sendcommand(eCommand.GUIDE_MOT, 'L', 'N'); //down
else if (dir == ZMotDirection.Stop)
return Sendcommand(eCommand.GUIDE_MOT, 'L', 'S'); //stop
else return false;
}
public bool ZMot_Right(ZMotDirection dir)
{
if (dir == ZMotDirection.Up)
return Sendcommand(eCommand.GUIDE_MOT, 'R', 'P'); //up
else if (dir == ZMotDirection.Down)
return Sendcommand(eCommand.GUIDE_MOT, 'R', 'N'); //down
else if (dir == ZMotDirection.Stop)
return Sendcommand(eCommand.GUIDE_MOT, 'R', 'S'); //stop
else return false;
}
/// <summary>
/// 오버로드 또는 L이 활성화되되면 True를 반환함
/// </summary>
/// <returns></returns>
public Boolean IsOverLoad()
{
if (GetValueI(DIName.PINI_OVERLOADL) || GetValueI(DIName.PINI_OVERLOADR)) return true;
else return false;
}
public Boolean IsLimitUp()
{
if (GetValueI(DIName.PINI_LIMIT_LU) || GetValueI(DIName.PINI_LIMIT_RU)) return true;
else return false;
}
public Boolean IsLimitDn()
{
if (GetValueI(DIName.PINI_LIMIT_LD) || GetValueI(DIName.PINI_LIMIT_RD)) return true;
else return false;
}
}
}

View File

@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{476C8E64-7B6B-4554-ACA2-04302715750F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Device</RootNamespace>
<AssemblyName>Device_PLC</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Arduino\EnumStruct.cs" />
<Compile Include="Arduino\EventsIO.cs" />
<Compile Include="Arduino\MemoryAccess.cs" />
<Compile Include="FakePLC.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommData\CommData.csproj">
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Device_PLC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Device_PLC")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("476c8e64-7b6b-4554-aca2-04302715750f")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,36 +0,0 @@
namespace arFrame.Control
{
partial class MenuControl
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -1,676 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace arFrame.Control
{
public partial class MenuControl : System.Windows.Forms.Control
{
private int bordersize = 0;
private int menubordersize = 1;
private int menuwidth = 100;
private int menugap = 5;
private System.Windows.Forms.Padding padding = new Padding(3, 3, 3, 3);
private System.Drawing.Color backcolor = System.Drawing.Color.White;
private System.Drawing.Color backcolor2 = System.Drawing.Color.Gainsboro;
private System.Drawing.Color bordercolor = System.Drawing.Color.Black;
private Boolean enablemenubakcolor = false;
private Boolean enablemenuborder = false;
private Boolean textattachtoimage = true;
[Category("arFrame"), DisplayName("메뉴")]
public MenuItem[] menus { get; set; }
private Rectangle[] rects = null;
[Category("arFrame"), DisplayName("테두리 굵기")]
public int BorderSize { get { return bordersize; } set { this.bordersize = value; Invalidate(); } }
[Category("arFrame"), DisplayName("메뉴 테두리 굵기")]
public int MenuBorderSize { get { return menubordersize; } set { this.menubordersize = value; Invalidate(); } }
[Category("arFrame"), DisplayName("메뉴 너비")]
public int MenuWidth { get { return menuwidth; } set { this.menuwidth = value; RemakeChartRect(); Invalidate(); } }
[Category("arFrame"), DisplayName("메뉴 간격")]
public int MenuGap { get { return menugap; } set { this.menugap = value; RemakeChartRect(); Invalidate(); } }
[Category("arFrame"), DisplayName("기능-메뉴별 배경색")]
public Boolean EnableMenuBackColor { get { return enablemenubakcolor; } set { this.enablemenubakcolor = value; Invalidate(); } }
[Category("arFrame"), DisplayName("기능-메뉴별 테두리")]
public Boolean EnableMenuBorder { get { return enablemenuborder; } set { this.enablemenuborder = value; Invalidate(); } }
[Category("arFrame"), DisplayName("글자를 이미지 다음에 표시"), Description("이미지가 있는 경우 해당 이미지 옆에 글자를 붙입니다")]
public Boolean TextAttachToImage { get { return textattachtoimage; } set { this.textattachtoimage = value; Invalidate(); } }
[Category("arFrame"), DisplayName("이미지 표시 여백(좌,상)")]
public System.Drawing.Point ImagePadding { get; set; }
[Category("arFrame"), DisplayName("이미지 표시 크기(너비,높이)")]
public System.Drawing.Size ImageSize { get; set; }
[Category("arFrame"), DisplayName("색상-테두리")]
public System.Drawing.Color BorderColor { get { return bordercolor; } set { this.bordercolor = value; Invalidate(); } }
[Category("arFrame"), DisplayName("내부 여백")]
public new System.Windows.Forms.Padding Padding { get { return padding; } set { this.padding = value; RemakeChartRect(); Invalidate(); } }
[Category("arFrame"), DisplayName("색상-배경1")]
public override System.Drawing.Color BackColor { get { return backcolor; } set { this.backcolor = value; Invalidate(); } }
[Category("arFrame"), DisplayName("색상-배경2")]
public System.Drawing.Color BackColor2 { get { return backcolor2; } set { this.backcolor2 = value; Invalidate(); } }
[Category("arFrame"), DisplayName("색상-글자")]
public override Color ForeColor { get { return base.ForeColor; } set { base.ForeColor = value; } }
private int mouseOverItemIndex = -1;
public MenuControl()
{
InitializeComponent();
// Set Optimized Double Buffer to reduce flickering
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
// Redraw when resized
this.SetStyle(ControlStyles.ResizeRedraw, true);
ImagePadding = new System.Drawing.Point(0, 0);
ImageSize = new System.Drawing.Size(24, 24);
if (MinimumSize.Width == 0 || MinimumSize.Height == 0)
MinimumSize = new Size(100, 50);
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
RemakeChartRect();
}
public event EventHandler<MenuEventArgs> ItemClick;
public class MenuEventArgs : EventArgs
{
public string Command { get; set; }
public int idx { get; set; }
public MenuEventArgs(string cmd_, int idx_)
{
this.Command = cmd_;
this.idx = idx_;
}
}
protected override void OnMouseClick(MouseEventArgs e)
{
// if(DesignMode)
// {
// if(e.Button == System.Windows.Forms.MouseButtons.Right)
// {
// System.Windows.Forms.MessageBox.Show("Sdf");
// }
// }
// else
{
//마우스클릭시 해당 버튼을 찾아서 반환한다.
if (menus == null || menus.Length < 1) return;
for (int i = 0; i < menus.Length; i++)
{
var rect = rects[i];
if (rect.Contains(e.Location))
{
var menu = menus[i];
//미사용개체는 이벤트를 아에 발생하지 않는다
if (menu.Enable == true && ItemClick != null)
ItemClick(this, new MenuEventArgs(menu.Command, i));
break;
}
}
}
}
protected override void OnMouseLeave(EventArgs e)
{
this.mouseOverItemIndex = -1;
this.Invalidate();
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (menus == null || menus.Length < 1)
{
this.mouseOverItemIndex = -1;
return;
}
for (int i = 0; i < menus.Length; i++)
{
var rect = rects[i];
if (rect.Contains(e.Location))
{
if (i != mouseOverItemIndex)
{
mouseOverItemIndex = i;
this.Invalidate();
}
break;
}
}
}
protected override void OnPaint(PaintEventArgs pe)
{
// if(DesignMode)
// {
// pe.Graphics.FillRectangle(Brushes.Red, this.DisplayRectangle);
// }
//else
{
//배경그리기
using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(DisplayRectangle, BackColor, BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
pe.Graphics.FillRectangle(sb, DisplayRectangle);
}
//테두리 그리기
if (BorderSize > 0)
{
pe.Graphics.DrawRectangle(new Pen(this.BorderColor, BorderSize),
this.DisplayRectangle.Left,
this.DisplayRectangle.Top,
this.DisplayRectangle.Width - 1,
this.DisplayRectangle.Height - 1);
}
//커서모양
if (mouseOverItemIndex == -1) this.Cursor = Cursors.Arrow;
else this.Cursor = Cursors.Hand;
if (rects == null) RemakeChartRect();
if (rects != null && rects.Length > 0)
{
StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
var items = menus.OrderBy(t => t.No);
int i = 0;
foreach (var menu in items)
{
var rect = rects[i];
//배경이 투명이 아니라면 그린다.
if (mouseOverItemIndex == i)
{
//마우스오버된놈이다.
using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, Color.FromArgb(100, Color.LightSkyBlue), Color.FromArgb(100, Color.DeepSkyBlue), System.Drawing.Drawing2D.LinearGradientMode.Vertical))
pe.Graphics.FillRectangle(sb, rect);
}
else
{
if (this.enablemenubakcolor == true && menu.BackColor != System.Drawing.Color.Transparent && menu.BackColor2 != System.Drawing.Color.Transparent)
{
using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, menu.BackColor, menu.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
pe.Graphics.FillRectangle(sb, rect);
}
}
//이미지표시
int ix, iy, iw, ih;
ix = iy = iw = ih = 0;
if (menu.Image != null)
{
ix = rect.Left;
iy = rect.Top;
iw = ImageSize.Width;
ih = ImageSize.Height;
if (menu.ImageAlign == ContentAlignment.BottomCenter || menu.ImageAlign == ContentAlignment.BottomLeft ||
menu.ImageAlign == ContentAlignment.BottomRight) iy += DisplayRectangle.Bottom - ih;
else if (menu.ImageAlign == ContentAlignment.MiddleCenter || menu.ImageAlign == ContentAlignment.MiddleLeft ||
menu.ImageAlign == ContentAlignment.MiddleRight) iy += (int)(DisplayRectangle.Top + ((rect.Height - ih) / 2.0));
else if (menu.ImageAlign == ContentAlignment.TopCenter || menu.ImageAlign == ContentAlignment.TopLeft ||
menu.ImageAlign == ContentAlignment.TopRight) iy += DisplayRectangle.Top;
if (menu.ImageAlign == ContentAlignment.BottomCenter || menu.ImageAlign == ContentAlignment.MiddleCenter ||
menu.ImageAlign == ContentAlignment.TopCenter) ix += (int)(DisplayRectangle.Left + ((rect.Width - iw) / 2.0));
else if (menu.ImageAlign == ContentAlignment.BottomLeft || menu.ImageAlign == ContentAlignment.MiddleLeft ||
menu.ImageAlign == ContentAlignment.TopLeft) ix += DisplayRectangle.Left;
else if (menu.ImageAlign == ContentAlignment.BottomRight || menu.ImageAlign == ContentAlignment.MiddleRight ||
menu.ImageAlign == ContentAlignment.TopRight) ix += DisplayRectangle.Right - iw;
if (menu.ImagePadding.X != 0 || menu.ImagePadding.Y != 0)
{
ix += menu.ImagePadding.X;
iy += menu.ImagePadding.Y;
}
else
{
ix += ImagePadding.X;
iy += ImagePadding.Y;
}
if (menu.ImageSize.Width != 0 && menu.ImageSize.Height != 0)
{
iw = menu.ImageSize.Width;
ih = menu.ImageSize.Height;
}
pe.Graphics.DrawImage(menu.Image,
new Rectangle(ix, iy, iw, ih));
}
//테두리를 그리는 속성과 트기가 설정된 경우에만 표시
if (mouseOverItemIndex == i)
{
pe.Graphics.DrawRectangle(new Pen(Color.DeepSkyBlue), rect);
}
else
{
if (EnableMenuBorder && MenuBorderSize > 0)
{
using (var p = new Pen(menu.BorderColor, MenuBorderSize))
pe.Graphics.DrawRectangle(p, rect);
}
}
//글자를 텍스트 이후에 붙이는 거라면?
if (menu.Image != null && TextAttachToImage)
{
var fsize = pe.Graphics.MeasureString(menu.Text, this.Font);
pe.Graphics.DrawString(menu.Text, this.Font, new SolidBrush(menu.ForeColor),
(float)(ix + iw + 1),
(float)(iy + ((ih - fsize.Height) / 2.0)));
}
else
{
if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.BottomLeft ||
menu.TextAlign == ContentAlignment.BottomRight) sf.LineAlignment = StringAlignment.Far;
else if (menu.TextAlign == ContentAlignment.MiddleCenter || menu.TextAlign == ContentAlignment.MiddleLeft ||
menu.TextAlign == ContentAlignment.MiddleRight) sf.LineAlignment = StringAlignment.Center;
else if (menu.TextAlign == ContentAlignment.TopCenter || menu.TextAlign == ContentAlignment.TopLeft ||
menu.TextAlign == ContentAlignment.TopRight) sf.LineAlignment = StringAlignment.Near;
if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.MiddleCenter ||
menu.TextAlign == ContentAlignment.TopCenter) sf.Alignment = StringAlignment.Center;
else if (menu.TextAlign == ContentAlignment.BottomLeft || menu.TextAlign == ContentAlignment.MiddleLeft ||
menu.TextAlign == ContentAlignment.TopLeft) sf.Alignment = StringAlignment.Near;
else if (menu.TextAlign == ContentAlignment.BottomRight || menu.TextAlign == ContentAlignment.MiddleRight ||
menu.TextAlign == ContentAlignment.TopRight) sf.Alignment = StringAlignment.Far;
pe.Graphics.DrawString(menu.Text, this.Font, new SolidBrush(menu.ForeColor), rect, sf);
}
i += 1;
}
sf.Dispose();
}
//if(DesignMode)
//{
// pe.Graphics.DrawString("deisgn", this.Font, Brushes.Red, 1, 1);
//}
}
/// <summary>
/// arFrame 전용 속성값을 복사 합니다
/// </summary>
/// <param name="ctl"></param>
public void copyTo(MenuControl ctl)
{
ctl.backcolor = this.backcolor;
ctl.backcolor2 = this.BackColor2;
ctl.MenuWidth = this.menuwidth;
ctl.menugap = this.menugap;
ctl.menus = this.menus;
ctl.menubordersize = this.menubordersize;
ctl.padding = this.padding;
ctl.ForeColor = this.ForeColor;
ctl.Font = this.Font;
ctl.EnableMenuBackColor = this.EnableMenuBackColor;
ctl.EnableMenuBorder = this.EnableMenuBorder;
ctl.ImagePadding = this.ImagePadding;
ctl.ImageSize = this.ImageSize;
ctl.TextAttachToImage = this.TextAttachToImage;
ctl.bordercolor = this.bordercolor;
ctl.bordersize = this.bordersize;
}
public void Save(string File)
{
//xml로 데이터를 저장자
System.Text.StringBuilder NewXml = new System.Text.StringBuilder();
NewXml.AppendLine("<?xml version='1.0' encoding='UTF-8'?>");
NewXml.AppendLine("<tindevil create='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'> ");
NewXml.AppendLine("</tindevil>");
if (System.IO.File.Exists(File)) System.IO.File.Delete(File);
System.IO.File.WriteAllText(File, NewXml.ToString().Replace('\'', '\"'), System.Text.Encoding.UTF8);
var vDocu = new XmlDocument();
vDocu.Load(File);
//var nsmgr = new XmlNamespaceManager(new System.Xml.NameTable());
//nsmgr.AddNamespace("x", "http://tindevil.com");
var Root = vDocu.DocumentElement;
//저장하려는 속성목록을 먼저 생성한다
//미사용 목록이 너무 많아서 그렇게 함
foreach (var m in this.GetType().GetMethods())
{
var mName = m.Name.ToLower();
if (mName.StartsWith("get_") == false || mName == "get_menus") continue;
var pt = this.GetType().GetProperty(m.Name.Substring(4));
if (pt != null)
{
var categoryName = GetCategoryName(pt);
if (categoryName.ToLower() != "arframe") continue;
//자료형에따라서 그값을 변경한다
var value = m.Invoke(this, null);
var newNode = vDocu.CreateElement(pt.Name);// m.Name.Substring(4));
newNode.InnerText = getValueString(m, value);
Root.AppendChild(newNode);
}
}
foreach (var item in this.menus.OrderBy(t => t.No))
{
var node = vDocu.CreateElement("Item");
var attNo = vDocu.CreateAttribute("No");
attNo.Value = item.No.ToString();
node.Attributes.Append(attNo);
foreach (var m in item.GetType().GetMethods())
{
var mName = m.Name.ToLower();
if (mName.StartsWith("get_") == false || mName == "get_no") continue;
var value = m.Invoke(item, null);
var sNode = vDocu.CreateElement(m.Name.Substring(4));
sNode.InnerText = getValueString(m, value);
node.AppendChild(sNode);
}
Root.AppendChild(node);
}
vDocu.Save(File);
}
public void Load(string File)
{
if (System.IO.File.Exists(File) == false) return;
List<MenuItem> NewMenu = new List<MenuItem>();
var vDocu = new XmlDocument();
vDocu.Load(File);
var Root = vDocu.DocumentElement; //루트요소(Tindevil)
//저장하려는 속성목록을 먼저 생성한다
//미사용 목록이 너무 많아서 그렇게 함
foreach (var m in this.GetType().GetMethods())
{
var mName = m.Name.ToLower();
if (mName.StartsWith("get_") == false || mName == "get_menus") continue;
var methodName = m.Name.Substring(4);
var pt = this.GetType().GetProperty(methodName);
if (pt != null)
{
var categoryName = GetCategoryName(pt);
if (categoryName.ToLower() != "arframe") continue;
//SEt명령이 있어야 사용이 가능하다
var setMethod = this.GetType().GetMethod("set_" + methodName);
if (setMethod == null) continue;
//값을 읽어온다
var Node = Root.SelectSingleNode(methodName);
if (Node != null)
{
var strValue = Node.InnerText;
var value = getValueFromString(m.ReturnType, strValue); // setValueString(m.ReturnType, setMethod, strValue);
setMethod.Invoke(this, new object[] { value });
}
}
}
//foreach (var item in this.menus.OrderBy(t => t.No))
//{
// var node = vDocu.CreateElement("Item");
// var attNo = vDocu.CreateAttribute("No");
// attNo.Value = item.No.ToString();
// node.Attributes.Append(attNo);
// foreach (var m in item.GetType().GetMethods())
// {
// var mName = m.Name.ToLower();
// if (mName.StartsWith("get_") == false || mName == "get_no") continue;
// var value = m.Invoke(item, null);
// var sNode = vDocu.CreateElement(m.Name.Substring(4));
// sNode.InnerText = getValueString(m, value);
// node.AppendChild(sNode);
// }
// Root.AppendChild(node);
//}
}
private string getValueString(System.Reflection.MethodInfo m, object value)
{
var strValue = "";
string valuetype = m.ReturnType.Name.ToLower();
if (m.ReturnType == typeof(System.Drawing.Color))
strValue = ((System.Drawing.Color)value).ToArgb().ToString();
else if (m.ReturnType == typeof(System.Drawing.Rectangle))
{
var rect = (System.Drawing.Rectangle)value;
strValue = string.Format("{0};{1};{2};{3}", rect.Left, rect.Top, rect.Width, rect.Height);
}
else if (m.ReturnType == typeof(System.Drawing.RectangleF))
{
var rectf = (System.Drawing.RectangleF)value;
strValue = string.Format("{0};{1};{2};{3}", rectf.Left, rectf.Top, rectf.Width, rectf.Height);
}
else if (m.ReturnType == typeof(Boolean))
{
strValue = ((Boolean)value) ? "1" : "0";
}
else if (m.ReturnType == typeof(System.Drawing.Point))
{
var pt1 = (Point)value;
strValue = string.Format("{0};{1}", pt1.X, pt1.Y);
}
else if (m.ReturnType == typeof(System.Drawing.PointF))
{
var ptf = (PointF)value;
strValue = string.Format("{0};{1}", ptf.X, ptf.Y);
}
else if (m.ReturnType == typeof(System.Drawing.Size))
{
var sz = (Size)value;
strValue = string.Format("{0};{1}", sz.Width, sz.Height);
}
else if (m.ReturnType == typeof(System.Drawing.SizeF))
{
var szf = (SizeF)value;
strValue = string.Format("{0};{1}", szf.Width, szf.Height);
}
else if (m.ReturnType == typeof(System.Drawing.Bitmap))
{
var bitmap = (Bitmap)value;
// Convert the image to byte[]
System.IO.MemoryStream stream = new System.IO.MemoryStream();
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] imageBytes = stream.ToArray();
strValue = Convert.ToBase64String(imageBytes);
}
else if (m.ReturnType == typeof(System.Windows.Forms.Padding))
{
var pd = (System.Windows.Forms.Padding)value;
strValue = string.Format("{0};{1};{2};{3}", pd.Left, pd.Top, pd.Right, pd.Bottom);
}
else
strValue = value.ToString();
return strValue;
}
private object getValueFromString(Type ReturnType, string strValue)
{
if (ReturnType == typeof(System.Drawing.Color))
{
var cint = int.Parse(strValue);
return System.Drawing.Color.FromArgb(cint);
}
else if (ReturnType == typeof(System.Drawing.Rectangle))
{
var buf = strValue.Split(';');
var x = int.Parse(buf[0]);
var y = int.Parse(buf[1]);
var w = int.Parse(buf[2]);
var h = int.Parse(buf[3]);
return new Rectangle(x, y, w, h);
}
else if (ReturnType == typeof(System.Drawing.RectangleF))
{
var buf = strValue.Split(';');
var x = float.Parse(buf[0]);
var y = float.Parse(buf[1]);
var w = float.Parse(buf[2]);
var h = float.Parse(buf[3]);
return new RectangleF(x, y, w, h);
}
else if (ReturnType == typeof(Boolean))
{
return strValue == "1";
}
else if (ReturnType == typeof(System.Drawing.Point))
{
var buf = strValue.Split(';');
var x = int.Parse(buf[0]);
var y = int.Parse(buf[1]);
return new Point(x, y);
}
else if (ReturnType == typeof(System.Drawing.PointF))
{
var buf = strValue.Split(';');
var x = float.Parse(buf[0]);
var y = float.Parse(buf[1]);
return new PointF(x, y);
}
else if (ReturnType == typeof(System.Drawing.Size))
{
var buf = strValue.Split(';');
var x = int.Parse(buf[0]);
var y = int.Parse(buf[1]);
return new Size(x, y);
}
else if (ReturnType == typeof(System.Drawing.SizeF))
{
var buf = strValue.Split(';');
var x = float.Parse(buf[0]);
var y = float.Parse(buf[1]);
return new SizeF(x, y);
}
else if (ReturnType == typeof(System.Drawing.Bitmap))
{
//문자을을 바이트로 전환다
byte[] imageBytes = Convert.FromBase64String(strValue);
Bitmap retval = null;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(imageBytes))
retval = new Bitmap(stream);
return retval;
}
else if (ReturnType == typeof(System.Windows.Forms.Padding))
{
var buf = strValue.Split(';');
var x = int.Parse(buf[0]);
var y = int.Parse(buf[1]);
var w = int.Parse(buf[2]);
var h = int.Parse(buf[3]);
return new Padding(x, y, w, h);
}
else if (ReturnType == typeof(Int16)) return Int16.Parse(strValue);
else if (ReturnType == typeof(Int32)) return Int32.Parse(strValue);
else if (ReturnType == typeof(Int64)) return Int64.Parse(strValue);
else if (ReturnType == typeof(UInt16)) return UInt16.Parse(strValue);
else if (ReturnType == typeof(UInt32)) return UInt32.Parse(strValue);
else
return strValue;
}
public string GetCategoryName(System.Reflection.PropertyInfo m)
{
var displayName = m
.GetCustomAttributes(typeof(CategoryAttribute), true)
.FirstOrDefault() as CategoryAttribute;
if (displayName != null)
return displayName.Category;
return "";
}
public string GetDisplayName(System.Reflection.MethodInfo m)
{
var displayName = m
.GetCustomAttributes(typeof(DisplayNameAttribute), true)
.FirstOrDefault() as DisplayNameAttribute;
if (displayName != null)
return displayName.DisplayName;
return "";
}
public void RemakeChartRect()
{
if (rects != null) rects = null;
if (menus == null || menus.Length < 1) return;
rects = new Rectangle[menus.Length];
int leftIdx = 0;
int rightIdx = 0;
int leftAcc = 0;
int rightAcc = 0;
int i = 0;
var menuList = this.menus.OrderBy(t => t.No).ToArray();
foreach (var menu in menuList)
{
int x, y, w, h;
// var menu = menus[i];
var mWidth = menuwidth;
if (menu.MenuWidth > 0) mWidth = menu.MenuWidth;
w = mWidth;
h = DisplayRectangle.Height - Padding.Top - Padding.Bottom;
if (menu.isRightMenu)
{
x = DisplayRectangle.Right - Padding.Right - (rightAcc) - (MenuGap * rightIdx);
y = DisplayRectangle.Top + Padding.Top;
rightAcc += 0;// = 0;// x;
rightIdx += 1;
}
else
{
x = DisplayRectangle.Left + Padding.Left + leftAcc + (MenuGap * leftIdx);
y = DisplayRectangle.Top + Padding.Top;
leftAcc += mWidth;
leftIdx += 1;
}
rects[i] = new Rectangle(x, y, w, h);
i += 1;
}
}
}
}

View File

@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace arFrame.Control
{
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class MenuItem
{
[Category("arFrame"),DisplayName("메뉴이름")]
public string Text { get; set; }
[Category("arFrame"), DisplayName("색상-테두리"), Description("메뉴속성의 테두리 기능이 켜져야 합니다")]
public System.Drawing.Color BorderColor { get; set; }
[Category("arFrame"),DisplayName("색상-배경1"),Description("메뉴속성의 배경 기능이 켜져야 합니다")]
public System.Drawing.Color BackColor { get; set; }
[Category("arFrame"), DisplayName("색상-배경2"), Description("메뉴속성의 배경 기능이 켜져야 합니다")]
public System.Drawing.Color BackColor2 { get; set; }
[Category("arFrame"),DisplayName("색상-글자")]
public System.Drawing.Color ForeColor { get; set; }
[Category("arFrame"),DisplayName("메뉴 구분자로 사용합니다")]
public Boolean isSeparate { get; set; }
[Category("arFrame"),DisplayName("오른쪽 붙임")]
public Boolean isRightMenu { get; set; }
[Category("arFrame"),DisplayName("실행 명령")]
public string Command { get; set; }
[Category("arFrame"),DisplayName("아이콘 이미지")]
public System.Drawing.Bitmap Image { get; set; }
[Category("arFrame"),DisplayName("글자 정렬 방식")]
public System.Drawing.ContentAlignment TextAlign { get; set; }
[Category("arFrame"),DisplayName("이미지 정렬 방식")]
public System.Drawing.ContentAlignment ImageAlign { get; set; }
[Category("arFrame"),DisplayName("글자 여백")]
public System.Windows.Forms.Padding Padding { get; set; }
[Category("arFrame"),DisplayName("메뉴 사용여부"),Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")]
public Boolean Enable { get; set; }
[Category("arFrame"),DisplayName("이미지 표시 여백(좌,상)")]
public System.Drawing.Point ImagePadding { get; set; }
[Category("arFrame"),DisplayName("이미지 표시 크기(너비,높이)")]
public System.Drawing.Size ImageSize { get; set; }
[Category("arFrame"),DisplayName("메뉴 간격")]
public int MenuWidth { get; set; }
[Category("arFrame"),DisplayName("번호")]
public int No { get; set; }
public MenuItem()
{
Enable = true;
BorderColor = System.Drawing.Color.FromArgb(20, 20, 20);
BackColor = System.Drawing.Color.DimGray;
BackColor2 = System.Drawing.Color.FromArgb(100, 100, 100);
ForeColor = System.Drawing.Color.Black;
Text = "Menu";
isRightMenu = false;
Command = string.Empty;
Image = null;
isSeparate = false;
TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
ImagePadding = new System.Drawing.Point(0, 0);
ImageSize = new System.Drawing.Size(0, 0);
MenuWidth = 0;
No = 0;
}
}
}

View File

@@ -1,36 +0,0 @@
namespace arFrame.Control
{
partial class MotCommandButton
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace arFrame.Control
{
public partial class MotCommandButton : Button
{
public enum eCommand
{
AbsoluteMove = 0,
RelativeMove ,
AcceptPosition
}
public MotCommandButton()
{
InitializeComponent();
motCommand = eCommand.AbsoluteMove;
motValueControl = null;
motAccControl = null;
motSpdControl = null;
}
public MotValueNumericUpDown motValueControl { get; set; }
public MotValueNumericUpDown motAccControl { get; set; }
public MotValueNumericUpDown motSpdControl { get; set; }
public eCommand motCommand { get; set; }
}
}

View File

@@ -1,36 +0,0 @@
namespace arFrame.Control
{
partial class MotLinkLabel
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace arFrame.Control
{
public partial class MotLinkLabel : System.Windows.Forms.LinkLabel
{
public MotLinkLabel()
{
InitializeComponent();
this.LinkColor = Color.Chartreuse;
}
public MotValueNumericUpDown motValueControl { get; set; }
}
}

View File

@@ -1,36 +0,0 @@
namespace arFrame.Control
{
partial class MotValueNumericUpDown
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace arFrame.Control
{
public partial class MotValueNumericUpDown : NumericUpDown
{
public MotValueNumericUpDown()
{
InitializeComponent();
MotionIndex = -1;
}
public int MotionIndex { get; set; }
}
}

View File

@@ -1,56 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace arFrame.Control
{
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class MotITem
{
public int idx { get; private set; }
[Category("arFrame"), DisplayName("Tag")]
public string Tag { get; set; }
[Category("arFrame"), DisplayName("글자 정렬 방식")]
public System.Drawing.ContentAlignment TextAlign { get; set; }
[Category("arFrame"), DisplayName("글자 여백")]
public System.Windows.Forms.Padding Padding { get; set; }
[Category("arFrame"), DisplayName("메뉴 사용여부"), Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")]
public Boolean Enable { get; set; }
public string Text { get; set; }
public Boolean Dirty { get; set; }
public System.Drawing.Rectangle[] subRect = null;
//모션 상태값
public Boolean[] State;
public double Position { get; set; }
public double PositionCmd { get; set; }
public System.Drawing.Color PositionColor { get; set; }
public System.Drawing.RectangleF rect { get; set; }
[Category("arFrame"), DisplayName("번호")]
public int No { get; set; }
public MotITem(int idx_)
{
this.Dirty = true;
PositionColor = System.Drawing.Color.White;
subRect = new System.Drawing.Rectangle[6];
rect = System.Drawing.RectangleF.Empty;
Enable = true;
this.idx = idx_;
TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
No = 0;
this.Text = string.Empty;
this.Enable = true;
this.State = new bool[] { false,false,false,false,false,false};
Position = 0;
PositionCmd = 0;
}
}
}

View File

@@ -1,36 +0,0 @@
namespace arFrame.Control
{
partial class MotionDisplay
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -1,306 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace arFrame.Control
{
public partial class MotionDisplay : System.Windows.Forms.Control
{
private Color[] colorB1 = new Color[] {
Color.MediumSeaGreen,
Color.DeepSkyBlue,
Color.Tomato,
Color.Purple,
Color.Tomato,
Color.FromArgb(40,40,40)
};
private Color[] colorB2 = new Color[] {
Color.SeaGreen,
Color.SteelBlue,
Color.Red,
Color.Indigo,
Color.Red,
Color.FromArgb(30,30,30)
};
private StringFormat sf = new StringFormat();
private string[] IndiName = new string[] { "INP","ORG","LIM","HST","ALM","" };
public MotITem[] Items;
private int _colcount = 3;
private int _rowcount = 2;
private Color _bordercolor = Color.Black;
private Color _gridcolor = Color.FromArgb(50, 50, 50);
private int _bordersize = 1;
private Padding _padding;
private string _postionformat = "";
private int _headerHeight = 16;
private Font _headerfont = new Font("Consolas",7f);
private int itemCount { get { return _colcount * _rowcount; } }
public new Font Font { get { return base.Font; } set { base.Font = value; this.Invalidate(); } }
public Font HeaderFont { get { return _headerfont; } set { _headerfont = value; this.Invalidate(); } }
public int HeaderHeight { get { return _headerHeight; } set { _headerHeight = value; RemakeChartRect(); this.Invalidate(); } }
public new Padding Padding { get { if (_padding == null) return Padding.Empty; else return _padding; } set { _padding = value; RemakeChartRect(); Invalidate(); } }
public int ColumnCount { get { return _colcount; } set { _colcount = value; ResetArray(); RemakeChartRect(); } }
public int RowCount { get { return _rowcount; } set { _rowcount = value; ResetArray(); RemakeChartRect(); } }
public int BorderSize { get { return _bordersize; } set { _bordersize = value; Invalidate(); } }
public Color BorderColor { get { return _bordercolor; } set { _bordercolor = value; Invalidate(); } }
public string PositionDisplayFormat { get { return _postionformat; } set { _postionformat = value; Invalidate(); } }
public Color GridColor { get { return _gridcolor; } set { _gridcolor = value; Invalidate(); } }
public new Boolean Enabled { get { return base.Enabled; } set { base.Enabled = value; Invalidate(); } }
public MotionDisplay()
{
InitializeComponent();
// Set Optimized Double Buffer to reduce flickering
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
// Redraw when resized
this.SetStyle(ControlStyles.ResizeRedraw, true);
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Center;
//값과 이름은 외부의 값을 사용한다
ResetArray();
if (MinimumSize.Width == 0 || MinimumSize.Height == 0)
MinimumSize = new Size(100, 50);
}
void ResetArray()
{
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
RemakeChartRect();
}
public void RemakeChartRect()
{
if (DisplayRectangle == Rectangle.Empty) return;
var baseRect = new Rectangle(
DisplayRectangle.Left + _padding.Left,
DisplayRectangle.Top + _padding.Top,
DisplayRectangle.Width - _padding.Left - _padding.Right,
DisplayRectangle.Height - _padding.Top - _padding.Bottom);
double x = 0;
double y = 0;
double w = baseRect.Width / (_colcount * 1.0);
double h = baseRect.Height / (_rowcount * 1.0);
if (this.Items == null || itemCount != this.Items.Length)
{
//아이템갯수가 달라졌으므로 다시 갱신해야함
var item = new MotITem[RowCount * ColumnCount];
for (int r = 0; r < RowCount; r++)
{
for (int c = 0; c < ColumnCount; c++)
{
int idx = r * ColumnCount + c;
item[idx] = new MotITem(idx);
item[idx].Enable = false;
item[idx].Padding = new Padding(0, 0, 0, 0);
item[idx].TextAlign = ContentAlignment.MiddleCenter;
x = baseRect.Left + (c * w);
y = baseRect.Top + (r * h);
item[idx].rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
item[idx].Dirty = true;
}
}
this.Items = item;
}
else
{
//아이템의 갯수는 같으므로 좌표값만 변경해준다.
for (int r = 0; r < RowCount; r++)
{
for (int c = 0; c < ColumnCount; c++)
{
int idx = r * ColumnCount + c;
var item = Items[idx];
x = (c * w);
y = (r * h);
item.rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
item.Dirty = true;
}
}
}
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs pe)
{
//배경그리기
//using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(DisplayRectangle, BackColor, BackColor2On, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
pe.Graphics.FillRectangle(new SolidBrush(this.BackColor), DisplayRectangle);
if (Items == null)
{
pe.Graphics.DrawString("no items", this.Font, Brushes.Red, 100, 100);
return;
}
var items = Items.OrderBy(t => t.No);
foreach (var menu in items)
{
drawItem(menu.idx, pe.Graphics);
}
//테두리 그리기
if (BorderSize > 0)
{
pe.Graphics.DrawRectangle(new Pen(this.BorderColor, BorderSize),
this.DisplayRectangle.Left,
this.DisplayRectangle.Top,
this.DisplayRectangle.Width - 1,
this.DisplayRectangle.Height - 1);
}
}
private void drawItem(int itemIndex, Graphics g = null)
{
if (g == null) g = this.CreateGraphics();
var item = this.Items[itemIndex];
// g.DrawString("rect null", this.Font, Brushes.White, 100, 100);
if (item.rect == RectangleF.Empty) return;
var rect = item.rect;// rects[i];
var diplayText = item.Text;
//byte Value = 0;
//배경이 투명이 아니라면 그린다.
//var bgColor1 = Color.DarkBlue; //BackColor1Off;
//var bgColor2 = Color.Blue;// BackColor2Off;
//if (Value != 0 && item.Enable != false)
//{
// //bgColor1 = Value == 1 ? BackColor1On : BackColor1Err;
// //bgColor2 = Value == 1 ? BackColor2On : BackColor2Err;
//}
//using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, bgColor1, bgColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
// g.FillRectangle(sb, rect);
// if (mouseOverItemIndex == menu.idx)
// this.Cursor = Cursors.Hand;
// else
// this.Cursor = Cursors.Arrow;
//테두리를 그리는 속성과 트기가 설정된 경우에만 표시
//if (mouseOverItemIndex == i)
// {
// pe.Graphics.DrawRectangle(new Pen(Color.DeepSkyBlue), rect.Left, rect.Top, rect.Width, rect.Height);
//}
//else
{
// using (var p = new Pen(BorderColor, 1))
// g.DrawRectangle(p, rect.Left, rect.Top, rect.Width, rect.Height);
}
//총 5개의 인디게이터와 하단에 위치값을 표시하는 영역이 있따.
//줄 영역은 50%비율로 처리함
if(item.Dirty)
{
//각 영역을 다시 그려줘야한다.
var indiWidth = rect.Width / 5.0;
// var indiHeight = rect.Height / 2.0;
for (int c = 0; c < 5; c++)
{
item.subRect[c] = new Rectangle((int)(c * indiWidth + item.rect.Left), (int)(item.rect.Top), (int)indiWidth, (int)HeaderHeight);
}
item.Dirty = false;
//위치값을 나타내는 영역
item.subRect[5] = new Rectangle((int)item.rect.Left, (int)(item.rect.Top + HeaderHeight), (int)rect.Width, (int)rect.Height - HeaderHeight );
}
for(int i = 0 ; i < item.subRect.Length;i++)
{
var B1 = colorB1[i];
var B2 = colorB2[i];
if (i < (item.subRect.Length - 1)) //상태표시칸은 현재 값에 따라서 색상을 달리한다
{
if ( this.Enabled == false || (item.State[i] == false && DesignMode == false))
{
B1 = Color.FromArgb(20,20,20);
B2 = Color.FromArgb(50,50,50);
}
}
var rt = item.subRect[i];
using (var br = new System.Drawing.Drawing2D.LinearGradientBrush(rt, B1, B2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
g.FillRectangle(br, rt);
// g.DrawRectangle(Pens.Yellow, rt);
if (i < (item.subRect.Length-1))
{
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
g.DrawString(IndiName[i], HeaderFont, Brushes.White, rt, sf);
}
else
{
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Far;
g.DrawString(item.Position.ToString(PositionDisplayFormat) + " [" + item.PositionCmd.ToString(PositionDisplayFormat) + "] ",
this.Font,
new SolidBrush(item.PositionColor),
rt,
sf);
}
}
//테두리선은 우측만 처리한다
for (int i = 0; i < item.subRect.Length ; i++)
{
var rt = item.subRect[i];
var x1 = rt.Right;
var y1 = rt.Top;
var x2 = rt.Right;
var y2 = rt.Bottom;
g.DrawLine(new Pen(GridColor), x1, y1, x2, y2);
}
var posRect = item.subRect[item.subRect.Length - 1];
g.DrawLine(new Pen(Color.Black,1), posRect.Left, posRect.Top, posRect.Right, posRect.Top);
//인덱스번호 출력
if (diplayText != "")
{
g.DrawString(string.Format("[{0}] {1}", item.idx, diplayText),
this.Font, new SolidBrush(this.ForeColor),
item.rect.Left + 3, item.rect.Top + 3);
}
}
}
}

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
// 어셈블리와 관련된 정보를 수정하려면
// 이 특성 값을 변경하십시오.
[assembly: AssemblyTitle("arFrameControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("arFrameControl")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("9fa3ef10-3c75-40a2-b3e6-a37900b26d0e")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A16C9667-5241-4313-888E-548375F85D29}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>arFrame.Control</RootNamespace>
<AssemblyName>arFrameControl</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GridView\ColorListItem.cs" />
<Compile Include="MotCommandButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotCommandButton.Designer.cs">
<DependentUpon>MotCommandButton.cs</DependentUpon>
</Compile>
<Compile Include="MotionView\MotITem.cs" />
<Compile Include="GridView\GridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GridView\GridView.Designer.cs">
<DependentUpon>GridView.cs</DependentUpon>
</Compile>
<Compile Include="MenuBar\MenuControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MenuBar\MenuControl.Designer.cs">
<DependentUpon>MenuControl.cs</DependentUpon>
</Compile>
<Compile Include="GridView\GridItem.cs" />
<Compile Include="MenuBar\MenuItem.cs" />
<Compile Include="MotionView\MotionDisplay.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotionView\MotionDisplay.Designer.cs">
<DependentUpon>MotionDisplay.cs</DependentUpon>
</Compile>
<Compile Include="MotLinkLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotLinkLabel.Designer.cs">
<DependentUpon>MotLinkLabel.cs</DependentUpon>
</Compile>
<Compile Include="MotValueNumericUpDown.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotValueNumericUpDown.Designer.cs">
<DependentUpon>MotValueNumericUpDown.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\arCtl\arControl.csproj">
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
<Name>arControl</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,222 +0,0 @@
namespace Test_NLRF100
{
partial class Form1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.radRs232 = new System.Windows.Forms.RadioButton();
this.radTcp = new System.Windows.Forms.RadioButton();
this.tbAddr = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btOpen = new System.Windows.Forms.Button();
this.logTextBox1 = new arCtl.LogTextBox();
this.btClose = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// radRs232
//
this.radRs232.AutoSize = true;
this.radRs232.Location = new System.Drawing.Point(21, 17);
this.radRs232.Name = "radRs232";
this.radRs232.Size = new System.Drawing.Size(57, 16);
this.radRs232.TabIndex = 0;
this.radRs232.Text = "RS232";
this.radRs232.UseVisualStyleBackColor = true;
//
// radTcp
//
this.radTcp.AutoSize = true;
this.radTcp.Checked = true;
this.radTcp.Location = new System.Drawing.Point(21, 39);
this.radTcp.Name = "radTcp";
this.radTcp.Size = new System.Drawing.Size(65, 16);
this.radTcp.TabIndex = 0;
this.radTcp.TabStop = true;
this.radTcp.Text = "TCP/IP";
this.radTcp.UseVisualStyleBackColor = true;
//
// tbAddr
//
this.tbAddr.Location = new System.Drawing.Point(93, 34);
this.tbAddr.Name = "tbAddr";
this.tbAddr.Size = new System.Drawing.Size(135, 21);
this.tbAddr.TabIndex = 1;
this.tbAddr.Text = "192.168.1.10";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(91, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 12);
this.label1.TabIndex = 2;
this.label1.Text = "Port / Address";
//
// btOpen
//
this.btOpen.Location = new System.Drawing.Point(250, 14);
this.btOpen.Name = "btOpen";
this.btOpen.Size = new System.Drawing.Size(90, 40);
this.btOpen.TabIndex = 3;
this.btOpen.Text = "Open";
this.btOpen.UseVisualStyleBackColor = true;
this.btOpen.Click += new System.EventHandler(this.btOpen_Click);
//
// logTextBox1
//
this.logTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.logTextBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
this.logTextBox1.ColorList = new arCtl.sLogMessageColor[0];
this.logTextBox1.DateFormat = "yy-MM-dd HH:mm:ss";
this.logTextBox1.DefaultColor = System.Drawing.Color.LightGray;
this.logTextBox1.EnableDisplayTimer = false;
this.logTextBox1.EnableGubunColor = true;
this.logTextBox1.Font = new System.Drawing.Font("Consolas", 9F);
this.logTextBox1.ListFormat = "[{0}] {1}";
this.logTextBox1.Location = new System.Drawing.Point(17, 66);
this.logTextBox1.MaxListCount = ((ushort)(200));
this.logTextBox1.MaxTextLength = ((uint)(4000u));
this.logTextBox1.MessageInterval = 50;
this.logTextBox1.Name = "logTextBox1";
this.logTextBox1.Size = new System.Drawing.Size(419, 331);
this.logTextBox1.TabIndex = 4;
this.logTextBox1.Text = "";
//
// btClose
//
this.btClose.Location = new System.Drawing.Point(346, 14);
this.btClose.Name = "btClose";
this.btClose.Size = new System.Drawing.Size(90, 40);
this.btClose.TabIndex = 5;
this.btClose.Text = "Close";
this.btClose.UseVisualStyleBackColor = true;
this.btClose.Click += new System.EventHandler(this.btClose_Click);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(20, 403);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(90, 40);
this.button1.TabIndex = 6;
this.button1.Text = "Read";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(116, 403);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(90, 40);
this.button2.TabIndex = 7;
this.button2.Text = "Stop";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button3.Enabled = false;
this.button3.Location = new System.Drawing.Point(212, 403);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(90, 40);
this.button3.TabIndex = 8;
this.button3.Text = "Help";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button4.Enabled = false;
this.button4.Location = new System.Drawing.Point(337, 403);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(90, 40);
this.button4.TabIndex = 9;
this.button4.Text = "Ping";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// timer1
//
this.timer1.Interval = 200;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(449, 450);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.btClose);
this.Controls.Add(this.logTextBox1);
this.Controls.Add(this.btOpen);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbAddr);
this.Controls.Add(this.radTcp);
this.Controls.Add(this.radRs232);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.RadioButton radRs232;
private System.Windows.Forms.RadioButton radTcp;
private System.Windows.Forms.TextBox tbAddr;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btOpen;
private arCtl.LogTextBox logTextBox1;
private System.Windows.Forms.Button btClose;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Timer timer1;
}
}

View File

@@ -1,124 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Test_NLRF100
{
public partial class Form1 : Form
{
arDev.NLRF100.Device dev;
public Form1()
{
InitializeComponent();
dev = new arDev.NLRF100.Device();
dev.Message += Dev_Message;
dev.ReceiveData += Dev_ReceiveData;
}
private void Dev_ReceiveData(object sender, arDev.NLRF100.Device.ReceviceDataEventArgs e)
{
//데이터를 읽었을때
logTextBox1.AddMsg("수신", string.Format("\n안테나={0},값={1}",e.Antena,e.DataString));
}
private void Dev_Message(object sender, arDev.NLRF100.Device.MessageEventArgs e)
{
if (e.isError) logTextBox1.AddMsg("ERROR", "\n"+e.Message);
else logTextBox1.AddMsg("\n"+e.Message);
}
private void btOpen_Click(object sender, EventArgs e)
{
if (dev != null && dev.bInit && dev.IsOpen)
{
dev.Close();
}
if (tbAddr.Text == "")
{
Util.MsgE("포트/HostIP 를 입력하세요");
return;
}
if (radRs232.Checked) dev.init(arDev.NLRF100.eConnType.RS232, tbAddr.Text);
else dev.init(arDev.NLRF100.eConnType.SOCKET, tbAddr.Text);
if (dev.IsOpen == false)
{
logTextBox1.AddMsg("ERROR", "접속실패");
}
else
{
logTextBox1.AddMsg("접속성공");
}
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btClose_Click(object sender, EventArgs e)
{
if (dev != null && dev.IsOpen)
{
dev.Close();
this.logTextBox1.AddMsg("접속 종료");
timer1.Stop();
}
}
private void button1_Click(object sender, EventArgs e)
{
//read
dev.Start();
}
private void button2_Click(object sender, EventArgs e)
{
//stop
dev.Stop();
}
private void button3_Click(object sender, EventArgs e)
{
//help
dev.Help();
}
private void button4_Click(object sender, EventArgs e)
{
//ping
dev.Ping();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = "접속상태:" + dev.IsOpen.ToString();
if(dev.IsOpen)
{
button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = true;
} else
{
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
}
}
}
}

View File

@@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Test_NLRF100
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Test_NLRF100")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test_NLRF100")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("2cdad6d3-2d25-4604-a46c-edec0eb308d8")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_NLRF100.Properties
{
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_NLRF100.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_NLRF100.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test_NLRF100</RootNamespace>
<AssemblyName>Test_NLRF100</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="arControl.Net4">
<HintPath>..\Sub\arCtl\obj\Debug\arControl.Net4.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,407 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace Test_NLRF100
{
public static class Util
{
#region "MessageBox"
public static void MsgI(string m, Boolean legacy = true)
{
//if(legacy)
{
MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
public static void MsgE(string m, Boolean legacy = false)
{
//if(legacy)
{
MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public static DialogResult MsgQ(string m, Boolean legacy = false, string btOK = "확인",string btCancel = "아니오")
{
//if(legacy)
{
DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return dlg;
}
}
#endregion
public static string SelectSerialPort()
{
var f = new System.Windows.Forms.Form();
f.WindowState = System.Windows.Forms.FormWindowState.Normal;
f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
f.Size = new System.Drawing.Size(800, 400);
f.MaximizeBox = false;
f.MinimizeBox = false;
f.Text = "Select Port";
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
var lst = new System.Windows.Forms.ListBox();
lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
lst.Dock = System.Windows.Forms.DockStyle.Fill;
lst.DoubleClick += (s1, e1) =>
{
if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
};
using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
{
var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
foreach (var port in portnames)
{
var desc = "";
var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
if (portInfo != null) desc = portInfo["Caption"].ToString();
lst.Items.Add(string.Format("{0} - {1}", port, desc));
}
}
f.Controls.Add(lst);
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var name = lst.SelectedItem.ToString().Split('-');
return name[0].Trim();
}
else return string.Empty;
}
public static void ScreenCaptrue(int _BitmapWidth, int _BitmapHeight, Point ptSouce)
{
try
{
Bitmap bitmap = new Bitmap(_BitmapWidth, _BitmapHeight);
Graphics _graphic = Graphics.FromImage(bitmap);
_graphic.CopyFromScreen(ptSouce, new Point(0, 0), new Size(_BitmapWidth, _BitmapHeight));
string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
System.IO.FileInfo grpath = new FileInfo(savefile);
if (!grpath.Directory.Exists) grpath.Directory.Create();
bitmap.Save(grpath.FullName, System.Drawing.Imaging.ImageFormat.Png);
Util.MsgI("화면 캡쳐 성공\n" +
"위치:" + grpath.Directory.FullName +"\n" +
"파일명: " + grpath.Name);
}
catch (Exception ex)
{
Util.MsgE("화면 캡쳐 실패\n" + ex.Message);
}
}
public static void SaveBugReport(string content, string subdirName = "BugReport")
{
try
{
var path = CurrentPath + subdirName;
if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
var file = path + "\\" + DateTime.Now.ToString("yyyyMMdd_HHmmss_fff") + ".txt";
System.IO.File.WriteAllText(file, content, System.Text.Encoding.UTF8);
}
catch
{
//nothing
}
}
public static void CopyData(System.Data.DataRow drSrc, System.Data.DataRow drDes)
{
if (drDes == null || drSrc == null) return;
foreach (System.Data.DataColumn col in drSrc.Table.Columns)
{
if (col.ColumnName.ToUpper() == "IDX") continue;
drDes[col.ColumnName] = drSrc[col.ColumnName];
}
}
/// <summary>
/// 현재실행중인폴더를 반환합니다.
/// </summary>
public static string CurrentPath
{
get
{
return AppDomain.CurrentDomain.BaseDirectory;
}
}
/// <summary>
/// 콤마와 줄바꿈등을 제거합니다.
/// </summary>
/// <returns></returns>
public static string ToCSVString(string src)
{
string retval = src.Replace("\r", "").Replace("\n", "").Replace(",", "");
return retval;
}
public static Boolean RunProcess(string file, string arg = "")
{
var fi = new System.IO.FileInfo(file);
if (!fi.Exists)
{
// Pub.log.AddE("Run Error : " + file);
return false;
}
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(file);
si.Arguments = arg;
prc.StartInfo = si;
prc.Start();
return true;
}
#region "convert"
public static string RectToStr(Rectangle rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string RectToStr(RectangleF rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string PointToStr(Point pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static string PointToStr(PointF pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
#endregion
#region "NIC"
/// <summary>
/// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
/// </summary>
/// <returns></returns>
public static Boolean ExistNIC(string NICName)
{
if (string.IsNullOrEmpty(NICName)) return false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
return true;
}
}
return false;
}
/// <summary>
/// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICDisable(string NICName)
{
//해당 nic 가 현재 목록에 존재하는지 확인한다.
string cmd = "interface set interface " + NICName + " disable";
Process prc = new Process();
ProcessStartInfo si = new ProcessStartInfo("netsh", cmd);
si.WindowStyle = ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에서 사라질때까지 기다린다.
DateTime SD = DateTime.Now;
Boolean timeout = false;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (!FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
timeout = true;
break; // TODO: might not be correct. Was : Exit While
}
}
return !timeout;
}
public static List<String> NICCardList()
{
List<String> Retval = new List<string>();
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet)
{
Retval.Add(Net.Name.ToUpper());
}
}
return Retval;
}
/// <summary>
/// 이더넷카드를 사용함으로 설정합니다.
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICEnable(string NICName)
{
string cmd = "interface set interface " + NICName + " enable";
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("netsh", cmd);
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에생길떄까지 대기
DateTime SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
////결이 완료될떄까지 기다린다.
SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet) continue;
if (Net.Name.ToLower() == NICName.ToLower())
{
//string data = Net.GetIPProperties().GatewayAddresses[0].ToString();
if (Net.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
}
if (FindNetwork)
return true;
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
}
#endregion
public static void RunExplorer(string arg)
{
System.Diagnostics.ProcessStartInfo si = new ProcessStartInfo("explorer");
si.Arguments = arg;
System.Diagnostics.Process.Start(si);
}
#region "watchdog"
public static void WatchDog_Run()
{
System.IO.FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "WatchCat.exe");
if (!fi.Exists) return;
var Exist = CheckExistProcess("watchcat");
if (Exist) return;
RunProcess(fi.FullName);
}
public static Boolean CheckExistProcess(string ProcessName)
{
foreach (var prc in System.Diagnostics.Process.GetProcesses())
{
if (prc.ProcessName.StartsWith("svchost")) continue;
if (prc.ProcessName.ToUpper() == ProcessName.ToUpper()) return true;
}
return false;
}
#endregion
#region "web function"
/// <summary>
/// URL로부터 문자열을 수신합니다.
/// </summary>
/// <param name="url"></param>
/// <param name="isError"></param>
/// <returns></returns>
public static string GetStrfromurl(string url, out Boolean isError)
{
isError = false;
string result = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
request.Timeout = 60000;
request.ReadWriteTimeout = 60000;
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse() as HttpWebResponse;
var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
result = txtReader.ReadToEnd();
}
catch (Exception ex)
{
isError = true;
result = ex.Message.ToString();
}
return result;
}
#endregion
}
}

View File

@@ -1,577 +0,0 @@
namespace Test_ProPLC
{
partial class Form1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
arFrame.Control.ColorListItem colorListItem1 = new arFrame.Control.ColorListItem();
arFrame.Control.ColorListItem colorListItem2 = new arFrame.Control.ColorListItem();
arFrame.Control.ColorListItem colorListItem3 = new arFrame.Control.ColorListItem();
arFrame.Control.ColorListItem colorListItem4 = new arFrame.Control.ColorListItem();
this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textbox1 = new System.Windows.Forms.ComboBox();
this.textbox2 = new System.Windows.Forms.ComboBox();
this.gv1 = new arFrame.Control.GridView();
this.gv2 = new arFrame.Control.GridView();
this.logSub = new arCtl.LogTextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.logMain = new arCtl.LogTextBox();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button16 = new System.Windows.Forms.Button();
this.button17 = new System.Windows.Forms.Button();
this.button18 = new System.Windows.Forms.Button();
this.button19 = new System.Windows.Forms.Button();
this.button20 = new System.Windows.Forms.Button();
this.button21 = new System.Windows.Forms.Button();
this.button22 = new System.Windows.Forms.Button();
this.button23 = new System.Windows.Forms.Button();
this.button24 = new System.Windows.Forms.Button();
this.button35 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(9, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(108, 36);
this.button1.TabIndex = 0;
this.button1.Text = "Conn";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(9, 333);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(108, 36);
this.button2.TabIndex = 4;
this.button2.Text = "Conn";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(123, 10);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(843, 21);
this.textBox3.TabIndex = 6;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(123, 333);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(843, 21);
this.textBox4.TabIndex = 7;
//
// textbox1
//
this.textbox1.FormattingEnabled = true;
this.textbox1.Location = new System.Drawing.Point(9, 52);
this.textbox1.Name = "textbox1";
this.textbox1.Size = new System.Drawing.Size(108, 20);
this.textbox1.TabIndex = 8;
//
// textbox2
//
this.textbox2.FormattingEnabled = true;
this.textbox2.Location = new System.Drawing.Point(9, 375);
this.textbox2.Name = "textbox2";
this.textbox2.Size = new System.Drawing.Size(108, 20);
this.textbox2.TabIndex = 9;
this.textbox2.Text = "COM31";
//
// gv1
//
this.gv1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.gv1.BorderSize = 1;
colorListItem1.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
colorListItem1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
colorListItem1.Remark = "";
colorListItem2.BackColor1 = System.Drawing.Color.Orange;
colorListItem2.BackColor2 = System.Drawing.Color.DarkOrange;
colorListItem2.Remark = "";
this.gv1.ColorList = new arFrame.Control.ColorListItem[] {
colorListItem1,
colorListItem2};
this.gv1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.gv1.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gv1.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
this.gv1.ForeColor = System.Drawing.Color.White;
this.gv1.ForeColorPin = System.Drawing.Color.WhiteSmoke;
this.gv1.Location = new System.Drawing.Point(123, 37);
this.gv1.MatrixSize = new System.Drawing.Point(8, 4);
this.gv1.MenuBorderSize = 1;
this.gv1.MenuGap = 5;
this.gv1.MinimumSize = new System.Drawing.Size(100, 50);
this.gv1.Name = "gv1";
this.gv1.Names = null;
this.gv1.ShadowColor = System.Drawing.Color.Black;
this.gv1.showDebugInfo = false;
this.gv1.ShowIndexString = true;
this.gv1.Size = new System.Drawing.Size(592, 169);
this.gv1.TabIndex = 10;
this.gv1.Tags = null;
this.gv1.Text = "gridView1";
this.gv1.TextAttachToImage = true;
this.gv1.Titles = null;
this.gv1.Values = null;
this.gv1.ItemClick += new System.EventHandler<arFrame.Control.GridView.ItemClickEventArgs>(this.gv1_ItemClick);
//
// gv2
//
this.gv2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.gv2.BorderSize = 1;
colorListItem3.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
colorListItem3.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
colorListItem3.Remark = "";
colorListItem4.BackColor1 = System.Drawing.Color.Orange;
colorListItem4.BackColor2 = System.Drawing.Color.DarkOrange;
colorListItem4.Remark = "";
this.gv2.ColorList = new arFrame.Control.ColorListItem[] {
colorListItem3,
colorListItem4};
this.gv2.Cursor = System.Windows.Forms.Cursors.Arrow;
this.gv2.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gv2.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
this.gv2.ForeColor = System.Drawing.Color.White;
this.gv2.ForeColorPin = System.Drawing.Color.WhiteSmoke;
this.gv2.Location = new System.Drawing.Point(123, 360);
this.gv2.MatrixSize = new System.Drawing.Point(8, 4);
this.gv2.MenuBorderSize = 1;
this.gv2.MenuGap = 5;
this.gv2.MinimumSize = new System.Drawing.Size(100, 50);
this.gv2.Name = "gv2";
this.gv2.Names = null;
this.gv2.ShadowColor = System.Drawing.Color.Black;
this.gv2.showDebugInfo = false;
this.gv2.ShowIndexString = true;
this.gv2.Size = new System.Drawing.Size(592, 169);
this.gv2.TabIndex = 11;
this.gv2.Tags = null;
this.gv2.Text = "gridView1";
this.gv2.TextAttachToImage = true;
this.gv2.Titles = null;
this.gv2.Values = null;
this.gv2.ItemClick += new System.EventHandler<arFrame.Control.GridView.ItemClickEventArgs>(this.gv2_ItemClick);
//
// logSub
//
this.logSub.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
this.logSub.ColorList = new arCtl.sLogMessageColor[0];
this.logSub.DateFormat = "yy-MM-dd HH:mm:ss";
this.logSub.DefaultColor = System.Drawing.Color.LightGray;
this.logSub.EnableDisplayTimer = true;
this.logSub.EnableGubunColor = true;
this.logSub.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.logSub.ListFormat = "[{0}] {1}";
this.logSub.Location = new System.Drawing.Point(123, 535);
this.logSub.MaxListCount = ((ushort)(200));
this.logSub.MaxTextLength = ((uint)(4000u));
this.logSub.MessageInterval = 50;
this.logSub.Name = "logSub";
this.logSub.Size = new System.Drawing.Size(592, 132);
this.logSub.TabIndex = 12;
this.logSub.Text = "";
//
// button3
//
this.button3.Location = new System.Drawing.Point(721, 360);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(152, 36);
this.button3.TabIndex = 13;
this.button3.Text = "Z-UP";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(721, 402);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(152, 36);
this.button4.TabIndex = 14;
this.button4.Text = "Z-STOP";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(721, 444);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(152, 36);
this.button5.TabIndex = 15;
this.button5.Text = "Z-DN";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// logMain
//
this.logMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
this.logMain.ColorList = new arCtl.sLogMessageColor[0];
this.logMain.DateFormat = "yy-MM-dd HH:mm:ss";
this.logMain.DefaultColor = System.Drawing.Color.LightGray;
this.logMain.EnableDisplayTimer = true;
this.logMain.EnableGubunColor = true;
this.logMain.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.logMain.ListFormat = "[{0}] {1}";
this.logMain.Location = new System.Drawing.Point(123, 212);
this.logMain.MaxListCount = ((ushort)(200));
this.logMain.MaxTextLength = ((uint)(4000u));
this.logMain.MessageInterval = 50;
this.logMain.Name = "logMain";
this.logMain.Size = new System.Drawing.Size(592, 115);
this.logMain.TabIndex = 16;
this.logMain.Text = "";
//
// button6
//
this.button6.BackColor = System.Drawing.Color.Tomato;
this.button6.ForeColor = System.Drawing.Color.White;
this.button6.Location = new System.Drawing.Point(721, 79);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(73, 36);
this.button6.TabIndex = 19;
this.button6.Text = "L_STOP";
this.button6.UseVisualStyleBackColor = false;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(721, 121);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(73, 36);
this.button7.TabIndex = 18;
this.button7.Text = "L-DN";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(721, 37);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(73, 36);
this.button8.TabIndex = 17;
this.button8.Text = "L-UP";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button9
//
this.button9.BackColor = System.Drawing.Color.Tomato;
this.button9.ForeColor = System.Drawing.Color.White;
this.button9.Location = new System.Drawing.Point(800, 78);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(73, 36);
this.button9.TabIndex = 22;
this.button9.Text = "R-STOP";
this.button9.UseVisualStyleBackColor = false;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(800, 120);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(73, 36);
this.button10.TabIndex = 21;
this.button10.Text = "R-DN";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button11
//
this.button11.Location = new System.Drawing.Point(800, 36);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(73, 36);
this.button11.TabIndex = 20;
this.button11.Text = "R-UP";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button12
//
this.button12.BackColor = System.Drawing.Color.White;
this.button12.ForeColor = System.Drawing.Color.Black;
this.button12.Location = new System.Drawing.Point(721, 205);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(152, 36);
this.button12.TabIndex = 25;
this.button12.Text = "STOP";
this.button12.UseVisualStyleBackColor = false;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// button13
//
this.button13.BackColor = System.Drawing.Color.White;
this.button13.Location = new System.Drawing.Point(721, 247);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(152, 36);
this.button13.TabIndex = 24;
this.button13.Text = "BACK";
this.button13.UseVisualStyleBackColor = false;
this.button13.Click += new System.EventHandler(this.button13_Click);
//
// button14
//
this.button14.BackColor = System.Drawing.Color.White;
this.button14.Location = new System.Drawing.Point(721, 163);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(152, 36);
this.button14.TabIndex = 23;
this.button14.Text = "GO";
this.button14.UseVisualStyleBackColor = false;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// button15
//
this.button15.Location = new System.Drawing.Point(879, 67);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(87, 24);
this.button15.TabIndex = 26;
this.button15.Text = "10";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click);
//
// button16
//
this.button16.Location = new System.Drawing.Point(879, 91);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(87, 24);
this.button16.TabIndex = 27;
this.button16.Text = "20";
this.button16.UseVisualStyleBackColor = true;
this.button16.Click += new System.EventHandler(this.button15_Click);
//
// button17
//
this.button17.Location = new System.Drawing.Point(879, 139);
this.button17.Name = "button17";
this.button17.Size = new System.Drawing.Size(87, 24);
this.button17.TabIndex = 29;
this.button17.Text = "40";
this.button17.UseVisualStyleBackColor = true;
this.button17.Click += new System.EventHandler(this.button15_Click);
//
// button18
//
this.button18.Location = new System.Drawing.Point(879, 115);
this.button18.Name = "button18";
this.button18.Size = new System.Drawing.Size(87, 24);
this.button18.TabIndex = 28;
this.button18.Text = "30";
this.button18.UseVisualStyleBackColor = true;
this.button18.Click += new System.EventHandler(this.button15_Click);
//
// button19
//
this.button19.Location = new System.Drawing.Point(879, 235);
this.button19.Name = "button19";
this.button19.Size = new System.Drawing.Size(87, 24);
this.button19.TabIndex = 33;
this.button19.Text = "80";
this.button19.UseVisualStyleBackColor = true;
this.button19.Click += new System.EventHandler(this.button15_Click);
//
// button20
//
this.button20.Location = new System.Drawing.Point(879, 211);
this.button20.Name = "button20";
this.button20.Size = new System.Drawing.Size(87, 24);
this.button20.TabIndex = 32;
this.button20.Text = "70";
this.button20.UseVisualStyleBackColor = true;
this.button20.Click += new System.EventHandler(this.button15_Click);
//
// button21
//
this.button21.Location = new System.Drawing.Point(879, 187);
this.button21.Name = "button21";
this.button21.Size = new System.Drawing.Size(87, 24);
this.button21.TabIndex = 31;
this.button21.Text = "60";
this.button21.UseVisualStyleBackColor = true;
this.button21.Click += new System.EventHandler(this.button15_Click);
//
// button22
//
this.button22.Location = new System.Drawing.Point(879, 163);
this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(87, 24);
this.button22.TabIndex = 30;
this.button22.Text = "50";
this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.button15_Click);
//
// button23
//
this.button23.Location = new System.Drawing.Point(879, 283);
this.button23.Name = "button23";
this.button23.Size = new System.Drawing.Size(87, 24);
this.button23.TabIndex = 35;
this.button23.Text = "100";
this.button23.UseVisualStyleBackColor = true;
this.button23.Click += new System.EventHandler(this.button15_Click);
//
// button24
//
this.button24.Location = new System.Drawing.Point(879, 259);
this.button24.Name = "button24";
this.button24.Size = new System.Drawing.Size(87, 24);
this.button24.TabIndex = 34;
this.button24.Text = "90";
this.button24.UseVisualStyleBackColor = true;
this.button24.Click += new System.EventHandler(this.button15_Click);
//
// button35
//
this.button35.Location = new System.Drawing.Point(879, 42);
this.button35.Name = "button35";
this.button35.Size = new System.Drawing.Size(87, 24);
this.button35.TabIndex = 46;
this.button35.Text = "0";
this.button35.UseVisualStyleBackColor = true;
this.button35.Click += new System.EventHandler(this.button15_Click);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(9, 401);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(108, 20);
this.comboBox1.TabIndex = 47;
this.comboBox1.Text = "57600";
//
// timer1
//
this.timer1.Interval = 250;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick_1);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(974, 677);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button35);
this.Controls.Add(this.button23);
this.Controls.Add(this.button24);
this.Controls.Add(this.button19);
this.Controls.Add(this.button20);
this.Controls.Add(this.button21);
this.Controls.Add(this.button22);
this.Controls.Add(this.button17);
this.Controls.Add(this.button18);
this.Controls.Add(this.button16);
this.Controls.Add(this.button15);
this.Controls.Add(this.button12);
this.Controls.Add(this.button13);
this.Controls.Add(this.button14);
this.Controls.Add(this.button9);
this.Controls.Add(this.button10);
this.Controls.Add(this.button11);
this.Controls.Add(this.button6);
this.Controls.Add(this.button7);
this.Controls.Add(this.button8);
this.Controls.Add(this.logMain);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.logSub);
this.Controls.Add(this.gv2);
this.Controls.Add(this.gv1);
this.Controls.Add(this.textbox2);
this.Controls.Add(this.textbox1);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.IO.Ports.SerialPort serialPort1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.ComboBox textbox1;
private System.Windows.Forms.ComboBox textbox2;
private arFrame.Control.GridView gv1;
private arFrame.Control.GridView gv2;
private arCtl.LogTextBox logSub;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private arCtl.LogTextBox logMain;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button16;
private System.Windows.Forms.Button button17;
private System.Windows.Forms.Button button18;
private System.Windows.Forms.Button button19;
private System.Windows.Forms.Button button20;
private System.Windows.Forms.Button button21;
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button23;
private System.Windows.Forms.Button button24;
private System.Windows.Forms.Button button35;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Timer timer1;
}
}

View File

@@ -1,659 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Test_ProPLC
{
public partial class Form1 : Form
{
arDev.FakePLC dev2;
public Form1()
{
InitializeComponent();
this.serialPort1.DataReceived += SerialPort1_DataReceived;
dev2 = new arDev.FakePLC();
this.dev2.ValueChanged += Dev2_ValueChanged;
this.dev2.Message += Dev2_Message;
this.FormClosed += Form1_FormClosed;
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
timer1.Stop();
}
private void Dev2_ValueChanged(object sender, arDev.Arduino.DIO.IOValueEventArgs e)
{
addMsg2($"val({e.ArrIDX}) -> {e.NewValue}");
}
byte[] buffer1;
List<byte> Tempbuffer1 = new List<byte>();
byte[] buffer2;
List<byte> Tempbuffer2 = new List<byte>();
Boolean STX11 = false;
Boolean STX21 = false;
Boolean ETX11 = false;
Boolean STX12 = false;
Boolean STX22 = false;
Boolean ETX12 = false;
//MAIN PLC
byte[] DIpinList1 = new byte[] { 22, 23, 24, 25, 26, 27, 28, 29, 41 };
string[] DIpinName1 = new string[] { "EMERGENCTY", "OVR_L", "LIDAR_STOP", "LIDAR_SLOW", "OVR_R", "MARK", "GATEOUT_B", "GATEOUT_F", "ALIGN" };
byte[] DOpinList1 = new byte[] { 33, 34, 35, 36, 37, 43, 44, 39, 40 };
string[] DopinName1 = new string[] { "MOT_POWER_GUIDE", "MOT_POWER_L", "MOT_POWER_R", "LIDAR_DIR", "CHARGE_ON", "MOT_DIR_L", "MOT_RUN_L", "MOT_DIR_R", "MOT_RUN_R" };
// SUB PLC
byte[] DIpinList2 = new byte[] { 22, 23, 24, 25, 41, 42, 43, 45, 38 };
string[] DIpinName2 = new string[] { "BTN_GUIDE_UP", "BTN_GUIDE_DN", "BTN_QA1", "BTN_QC", "LIM_HIGH_R", "LIM_LOW_R", "LIM_HIGH_L", "BTN_PACK", "LIM_LOW_L" };
byte[] DOpinList2 = new byte[] { 30, 31, 32, 33 };
string[] DopinName2 = new string[] { "GMOT_INT", "GMOT_DIR", "GMOT_RUN", "GMOT_STA" };
byte LEN1 = 0;
byte CHK1 = 0;
int bufferCount1 = 0;
byte LEN2 = 0;
byte CHK2 = 0;
int bufferCount2 = 0;
private void SerialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
bufferCount1 = this.serialPort1.BytesToRead;
byte[] rxBuffer = new byte[bufferCount1];
serialPort1.Read(rxBuffer, 0, bufferCount1);
foreach (byte incomingByte in rxBuffer)
{
if (STX11 == false)
{
if (incomingByte != '@')
{
STX21 = false;
ETX11 = false;
continue;
}
else
{
STX11 = true;
Tempbuffer1.Add(incomingByte);
}
}
else if (STX21 == false)
{
if (Tempbuffer1.Count != 1 || Tempbuffer1.Count < 1 || Tempbuffer1[0] != '@' || incomingByte != '@')
{
STX11 = false;
ETX11 = false;
continue;
}
else
{
STX21 = true;
Tempbuffer1.Add(incomingByte);
}
}
else
{
Tempbuffer1.Add(incomingByte);
//여기서부터는무조건 누적한다.
if (Tempbuffer1.Count == 3)
{
if (Tempbuffer1[0] != 0x40 || Tempbuffer1[1] != '@')
{
STX11 = false;
STX21 = false;
ETX11 = false;
LEN1 = 0;
Tempbuffer1.Clear();
}
else LEN1 = incomingByte; //데이터 길이가온다
}
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1) //체크섬이 왔다
{
CHK1 = incomingByte;
}
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1 + 1) //ETX1
{
if (incomingByte != 0x0D)
{
//ETX가 와야하는데 다른데이터가 왔다
STX11 = false;
STX21 = false;
ETX11 = false;
Console.WriteLine("에러 모두 파기");
Tempbuffer1.Clear();
}
}
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1 + 1 + 1)
{
//전체길이를 만족햇다.
if (incomingByte != 0x0A)
{
//ETX가 와야하는데 다른데이터가 왔다
STX11 = false;
STX21 = false;
ETX11 = false;
Console.WriteLine("에러 모두 파기");
Tempbuffer1.Clear();
}
else
{
STX11 = false;
STX21 = false;
ETX11 = false;
if (buffer1 == null) buffer1 = new byte[Tempbuffer1.Count];
else if (buffer1.Length != Tempbuffer1.Count) Array.Resize(ref buffer1, Tempbuffer1.Count);
Tempbuffer1.CopyTo(buffer1);
Tempbuffer1.Clear();
parser(buffer1, tbMsg1, 0);
}
}
}
}
}
private void Dev2_Message(object sender, arDev.arRS232.MessageEventArgs e)
{
addMsg2($"{e.Message}");
}
delegate void DisplayMessage(string message);
void parser(byte[] buffer, Action<string> func, int type)
{
// DisplayMessage messageTarget;
var hexString = buffer.GetHexString();
var len = buffer[2];
if (len + 6 != buffer.Length)
{
func(string.Format("길이오류 예상:{0},수신:{1},{2}", len + 5, buffer.Length, hexString));
}
else if (buffer[0] != 0x40 || buffer[1] != 0x40 || buffer[buffer.Length - 2] != 0x0D || buffer[buffer.Length - 1] != 0x0A)
{
func(string.Format("헤더 오류 : {0}", hexString));
}
else
{
var cmd = buffer[3];
if (cmd == 'I') //IOData
{
if (len != 15)
{
func("IO수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
}
else
{
var IOData = BitConverter.ToUInt32(buffer, 4);
var An1 = BitConverter.ToUInt16(buffer, 8);
var An2 = BitConverter.ToUInt16(buffer, 10);
var Ao11 = buffer[12];
var Ao12 = buffer[13];
var FGData = BitConverter.ToInt32(buffer, 14);
byte[] buf_iodata = new byte[4];
Array.Copy(buffer, 4, buf_iodata, 0, 4);
var ba = new System.Collections.BitArray(buf_iodata);
for (int i = 0; i < 32; i++)
{
Boolean val = ba[i];
if (val)
{
}
if (type == 0) this.gv1.setValue(i, val);
else this.gv2.setValue(i, val);
}
var binstr = Convert.ToString(IOData, 2).PadLeft(32, '0');
string msg = string.Format(DateTime.Now.ToString("mm:ss.fff") + " IO:{0},AN={1:0000},{2:0000},FG={3},AO={4},{5}",
binstr, An1, An2, FGData, Ao11, Ao12);
func(msg);
if (type == 0) gv1.Invalidate();
else gv2.Invalidate();
}
}
else if (cmd == 'T')
{
Boolean errorMessage = buffer[4] == 1;
var message = System.Text.Encoding.Default.GetString(buffer, 5, len - 2);//데이터타입과 에러여부 제거
if (type == 0)
addMsg1("Rx : " + hexString + ", 메세지: " + message);
else
addMsg2("Rx : " + hexString + ", 메세지: " + message);
}
else
{
if (type == 0)
addMsg1(DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(buffer));
else
addMsg2(DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(buffer));
//func();
}
}
//Console.WriteLine("Rx : " + hexString);
}
void tbMsg1(string m)
{
if (textBox3.InvokeRequired)
{
textBox3.BeginInvoke(new Action(() =>
{
textBox3.Text = (m + "\n");
// textBox3.ScrollToCaret();
}));
}
else
{
textBox3.Text = (m + "\n");
//textBox3.ScrollToCaret();
}
}
void tbMsg2(string m)
{
if (textBox4.InvokeRequired)
{
textBox4.BeginInvoke(new Action(() =>
{
textBox4.Text = (m + "\n");
// richTextBox2.ScrollToCaret();
}));
}
else
{
textBox4.Text = (m + "\n");
//richTextBox2.ScrollToCaret();
}
}
private void button1_Click(object sender, EventArgs e)
{
if (this.dev2.IsOpen)
{
this.serialPort1.Close();
this.button1.BackColor = SystemColors.Control;
}
else
{
if (textbox1.Text.isEmpty()) return;
this.serialPort1.PortName = textbox1.Text;
this.serialPort1.BaudRate = 250000;
this.serialPort1.Open();
button1.BackColor = Color.Lime;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = bufferCount1.ToString() + "/" + bufferCount2.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
if (textbox2.Text.isEmpty()) return;
if (this.dev2.IsOpen)
{
this.dev2.Close();
this.button2.BackColor = SystemColors.Control;
}
else
{
this.dev2.PortName = textbox2.Text;
this.dev2.BaudRate = int.Parse(comboBox1.Text);
this.dev2.Open();
button2.BackColor = Color.Lime;
// timer1.Start();
}
addMsg2($"open:{this.dev2.IsOpen}");
}
private void Form1_Load(object sender, EventArgs e)
{
textbox1.Items.Clear();
textbox2.Items.Clear();
foreach (var port in System.IO.Ports.SerialPort.GetPortNames())
{
textbox1.Items.Add(port);
textbox2.Items.Add(port);
}
// textbox1.Text = "COM15";
// textbox2.Text = "COM16";
List<Boolean> values = new List<bool>();
for (int i = 0; i < 32; i++)
values.Add(false);
this.gv1.setValue(values.ToArray());
this.gv2.setValue(values.ToArray());
//그리드뷰 값초기화
for (int i = 0; i < 32; i++)
{
string pinName = i.ToString();
if (i < 16 && i < DIpinName1.Length)
pinName = string.Format("[{0}:{2}] {1}", i, DIpinName1[i], DIpinList1[i]);
else if (i >= 16 && (i - 16) < DopinName1.Length)
pinName = string.Format("[{0}:{2}] {1}", i, DopinName1[i - 16], DOpinList1[i - 16]);
this.gv1.setTitle(i, pinName);
this.gv1.setValue(i, 0);
}
for (int i = 0; i < 32; i++)
{
string pinName = i.ToString();
if (i < 16)
{
var pin = (arDev.FakePLC.DIName)i;
pinName = $"[{i}] {pin}";
}
else
{
var pin = (arDev.FakePLC.DOName)(i-16);
pinName = $"[{i}] {pin}";
}
this.gv2.setTitle(i, pinName);
this.gv2.setValue(i, 0);
}
timer1.Start();
}
private void gv1_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
{
//sub item click
if (e.idx < 16)
{
Util.MsgE("입력은 상태를 변경할 수 없습니다");
}
else
{
//이 인덱스에 해당하는 포트번호를 가져왕야함
var dataIndex = e.idx - 16;
if (dataIndex >= 0)
{
var pinNo = DOpinList1[e.idx - 16];
var curVal = gv1.getValue(e.idx);
byte newval = (byte)(curVal == 0 ? 1 : 0);
Sendcommand1(eCommand1.SET_DOUTPUT, pinNo, newval);
}
else Util.MsgE("해당 주소는 허용되지 않습니다.");
}
}
byte makeChecksum(byte[] buffer)
{
//return 0;
byte chk = 0;
foreach (var b in buffer)
chk = (byte)(chk ^ b);
return chk;
}
enum eCommand1 : byte
{
LOAD = 0, //EEPROM 불러오기
SAVE, //EEPROM 저장
RESET, //초기화
SET_PINMODE, //PINMODE 설정
SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, 포트번호,값(0~255)
GET_SETTING = 50, //셋팅값 요청
MOT = 100, //p1(0=left,1=right), p2(0=stop,1=pos run,2=neg run)
MOVE_GO,
MOVE_BACK,
MOVE_LEFT,
MOVE_RIGHT,
MOVE_STOP
}
enum eCommand2 : byte
{
LOAD = 0, //EEPROM 불러오기
SAVE, //EEPROM 저장
RESET, //초기화
SET_PINMODE, //PINMODE 설정
SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
SET_AOUTPUT, //아날로그출력설정(포트번호,값[0~255])
GET_SETTING = 50, //셋팅값 요청
GUIDE_MOT,
SET_GUIDE_SPD = 100,//가이드커버(양쪽) 속도 설정(0~255)
}
void addMsg1(string m)
{
if (logMain.InvokeRequired)
{
logMain.BeginInvoke(new Action(() =>
{
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
logMain.AddMsg(m);
}));
}
else
{
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
logMain.AddMsg(m);
}
}
void addMsg2(string m)
{
if (logSub.InvokeRequired)
{
logSub.BeginInvoke(new Action(() =>
{
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
logSub.AddMsg(m);
}));
}
else
{
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
logSub.AddMsg(m);
}
}
private void gv2_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
{
//sub item click
if (e.idx < 16)
{
Util.MsgE("입력은 상태를 변경할 수 없습니다");
}
else
{
//이 인덱스에 해당하는 포트번호를 가져왕야함
var dataIndex = e.idx - 16;
if (dataIndex >= 0)
{
var pinNo = DOpinList2[e.idx - 16];
var curVal = gv2.getValue(e.idx);
byte newval = (byte)(curVal == 0 ? 1 : 0);
// Sendcommand2(eCommand2.SET_DOUTPUT, pinNo, newval);
}
else Util.MsgE("해당 주소는 허용되지 않습니다.");
}
}
void Sendcommand1(eCommand1 cmd, byte p1, byte p2)
{
//이번호의 상태를 on/off 해줘야함
List<byte> buffer = new List<byte>();
buffer.Add((byte)cmd); //command
buffer.Add(p1);
buffer.Add(p2);
byte dataLen = (byte)buffer.Count; //데이터길이
byte checksum = makeChecksum(buffer.ToArray());
buffer.Insert(0, (byte)'@'); //stx
buffer.Insert(1, (byte)'@'); //stx
buffer.Insert(2, dataLen);
buffer.Add(checksum); //길이를 제외한 실제 데이터 영역만 체크섬
buffer.Add(0x0D); //etx
buffer.Add(0x0A); //etx
addMsg1("Tx Buffer : " + buffer.ToArray().GetHexString());
if (this.serialPort1.IsOpen)
serialPort1.Write(buffer.ToArray(), 0, buffer.Count);
else
addMsg1("포트(2)가 열리지 않았습니다");
}
private void button3_Click(object sender, EventArgs e)
{
//-zup
dev2.ZMot(arDev.FakePLC.ZMotDirection.Up);
}
private void button4_Click(object sender, EventArgs e)
{
//z-stop
dev2.ZMot(arDev.FakePLC.ZMotDirection.Stop);
}
private void button5_Click(object sender, EventArgs e)
{
//z-down
dev2.ZMot(arDev.FakePLC.ZMotDirection.Down);
}
private void button8_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 0, 1);
}
private void button6_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 0, 0);
}
private void button7_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 0, 2);
}
private void button10_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 1, 2);
}
private void button9_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 1, 0);
}
private void button11_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOT, 1, 1);
}
private void button14_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOVE_GO, 0, 0);
}
private void button12_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOVE_STOP, 0, 0);
}
private void button13_Click(object sender, EventArgs e)
{
Sendcommand1(eCommand1.MOVE_BACK, 0, 0);
}
private void button15_Click(object sender, EventArgs e)
{
//지정된 %의 값을 전송한다
var but = sender as Button;
var percValue = byte.Parse(but.Text.ToString());
var realValue = (percValue / 100.0) * 255.0;
Sendcommand1(eCommand1.SET_AOUTPUT, 11, (byte)realValue);
Sendcommand1(eCommand1.SET_AOUTPUT, 12, (byte)realValue);
}
private void button34_Click(object sender, EventArgs e)
{
//지정된 %의 값을 전송한다
var but = sender as Button;
var percValue = byte.Parse(but.Text.ToString());
var realValue = (percValue / 100.0) * 255.0;
// Sendcommand2(eCommand2.SET_AOUTPUT, 11, (byte)realValue); //Z축 모터는 동일하게 사용한다
}
private void timer1_Tick_1(object sender, EventArgs e)
{
timer1.Stop();
if (dev2 != null && dev2.IsOpen)
{
for(byte i = 0; i < 32;i++)
{
bool v = false;
if (i < 16) v = dev2.GetValueI(i);
else v = dev2.GetValueO((byte)(i-16));
this.gv2.setValue(i, v);
}
this.gv2.Invalidate();
}
timer1.Start();
}
}
}

View File

@@ -1,126 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serialPort1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>95, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>205, 17</value>
</metadata>
</root>

View File

@@ -1,216 +0,0 @@

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Test_ProPLC
{
/// <summary>
/// generic method Extension
/// </summary>
public static class MethodExtensions
{
public static string ToString(this System.Drawing.Rectangle rect)
{
return string.Format("X={0},Y={1},W={2},H={3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string ToString(this System.Drawing.RectangleF rect)
{
return string.Format("X={0},Y={1},W={2},H={3}", rect.X, rect.Y, rect.Width, rect.Height);
}
//public static void SetBGColor(this System.Windows.Forms.Label ctl,System.Drawing.Color color1)
//{
// ctl.BackColor = System.Drawing.Color.Red;
//}
/// <summary>
/// 0101이 반복되는 문자열 형태로 전환합니다.
/// </summary>
/// <param name="arr"></param>
/// <returns></returns>
public static string BitString(this System.Collections.BitArray arr)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int i = arr.Length; i > 0; i--)
sb.Append(arr[i - 1] ? "1" : "0");
return sb.ToString();
}
/// <summary>
/// int 값으로 변환합니다.
/// </summary>
/// <param name="arr"></param>
/// <returns></returns>
public static int ValueI(this System.Collections.BitArray arr)
{
byte[] buf = new byte[4];
arr.CopyTo(buf, 0);
return BitConverter.ToInt32(buf, 0);
}
/// <summary>
/// 숫자인지 검사합니다.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static bool IsNumeric(this string input)
{
double data;
return double.TryParse(input, out data);
//return Regex.IsMatch(input, @"^\d+$");
}
/// <summary>
/// isnullorempty 를 수행합니다.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static Boolean isEmpty(this string input)
{
return string.IsNullOrEmpty(input);
}
/// <summary>
/// default 인코딩을 사용하여 문자열로 반환합니다.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string GetString(this Byte[] input)
{
return System.Text.Encoding.Default.GetString(input);
}
/// <summary>
/// 16진수 문자열 형태로 반환합니다.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string GetHexString(this Byte[] input)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (byte b in input)
sb.Append(" " + b.ToString("X2"));
return sb.ToString();
}
public static string Base64Encode(this string src)
{
string base64enc = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(src));
return base64enc;
}
public static string Base64Decode(this string src)
{
var base64dec = Convert.FromBase64String(src);
return System.Text.Encoding.UTF8.GetString(base64dec);
}
public static string UrlPathEncode(this string src)
{
string data = System.Web.HttpUtility.UrlPathEncode(src);
return data;
}
public static string UrlEncode(this string src)
{
string data = System.Web.HttpUtility.UrlEncode(src, System.Text.Encoding.UTF8);
return data;
}
public static string UrlDecode(this string src)
{
string data = System.Web.HttpUtility.UrlDecode(src, System.Text.Encoding.UTF8);
return data;
}
public static string toSizeStr(this Size rect)
{
return string.Format("{0};{1}", rect.Width, rect.Height);
}
public static string toPointStr(this PointF rect)
{
return string.Format("{0};{1}", rect.X, rect.Y);
}
public static string toPointStr(this Point rect)
{
return string.Format("{0};{1}", rect.X, rect.Y);
}
public static string toRectStr(this Rectangle rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Top, rect.Width, rect.Height);
}
public static string toRectStr(this RectangleF rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Top, rect.Width, rect.Height);
}
public static RectangleF toRectF(this string str)
{
var buffer = str.Split(';');
if (buffer.Length != 4) return RectangleF.Empty;
for (int i = 0; i < buffer.Length; i++)
if (buffer[i] == "") buffer[i] = "0";
return new RectangleF(float.Parse(buffer[0]), float.Parse(buffer[1]), float.Parse(buffer[2]), float.Parse(buffer[3]));
}
public static Rectangle toRect(this string str)
{
var buffer = str.Split(';');
if (buffer.Length != 4) return Rectangle.Empty;
for (int i = 0; i < buffer.Length; i++)
if (buffer[i] == "") buffer[i] = "0";
return new Rectangle(int.Parse(buffer[0]), int.Parse(buffer[1]), int.Parse(buffer[2]), int.Parse(buffer[3]));
}
public static Point toPoint(this string str)
{
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
var buffer = str.Split(';');
if (buffer.Length != 2) return Point.Empty;
for (int i = 0; i < buffer.Length; i++)
if (buffer[i] == "") buffer[i] = "0";
return new Point(int.Parse(buffer[0]), int.Parse(buffer[1]));
}
public static Size toSize(this string str)
{
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
var buffer = str.Split(';');
if (buffer.Length != 2) return Size.Empty;
for (int i = 0; i < buffer.Length; i++)
if (buffer[i] == "") buffer[i] = "0";
return new Size(int.Parse(buffer[0]), int.Parse(buffer[1]));
}
public static PointF toPointF(this string str)
{
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
var buffer = str.Split(';');
if (buffer.Length != 2) return PointF.Empty;
for (int i = 0; i < buffer.Length; i++)
if (buffer[i] == "") buffer[i] = "0";
return new PointF(float.Parse(buffer[0]), float.Parse(buffer[1]));
}
public static Rectangle Fix(this Rectangle rect, Size imgsize)
{
//영역보정
if (rect.Left < 1) rect.X = 1;
if (rect.Top < 1) rect.Y = 1;
if (rect.Right > imgsize.Width) rect.Width = imgsize.Width - rect.Left - 1;
if (rect.Bottom > imgsize.Height) rect.Height = imgsize.Height - rect.Top - 1;
if (rect.Width < 2 || rect.Height < 2) rect = Rectangle.Empty;
return rect;
}
public static RectangleF FixRoi(this RectangleF rect, Size imgsize)
{
//영역보정
if (rect.Left < 1) rect.X = 1;
if (rect.Top < 1) rect.Y = 1;
if (rect.Right > imgsize.Width) rect.Width = imgsize.Width - rect.Left - 1;
if (rect.Bottom > imgsize.Height) rect.Height = imgsize.Height - rect.Top - 1;
if (rect.Width < 2 || rect.Height < 2) rect = Rectangle.Empty;
return rect;
}
}
}

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Test_ProPLC
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Test_ProPLC")]
[assembly: AssemblyDescription("Test_ProPLC")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ATKEE1")]
[assembly: AssemblyProduct("Test_ProPLC")]
[assembly: AssemblyCopyright("Copyright ©ATK4 2020")]
[assembly: AssemblyTrademark("ATK4")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("9c027bf1-289f-4cc8-83f0-cb2b975c39c2")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("20.03.05.1100")]
[assembly: AssemblyFileVersion("20.03.05.1100")]

View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_ProPLC.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_ProPLC.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_ProPLC.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test_ProPLC</RootNamespace>
<AssemblyName>Test_ProPLC</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="arControl.Net4">
<HintPath>..\Sub\arCtl\bin\debug\arControl.Net4.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="MethodExtentions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SubProject\CommData\CommData.csproj">
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,461 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace Test_ProPLC
{
public static class Util
{
#region "MessageBox"
public static void MsgI(string m, Boolean legacy = false)
{
//if(legacy)
//{
MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
//}
}
public static void MsgE(string m, Boolean legacy = false)
{
//if(legacy)
//{
MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
//}
//else
//{
// var f = new fMessageWindow("오류 알림\n" + m);
// f.SetWindowColor(fMessageWindow.EWinColor.Error);
// f.btNo.Visible = false;
// f.btYes.Text = "확인";
// f.EnableUserClose = true;
// f.DialogMode = true;
// f.ShowDialog();
//}
}
public static DialogResult MsgQ(string m, Boolean legacy = false, string btOK = "확인",string btCancel = "아니오")
{
//if(legacy)
{
DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return dlg;
}
//else
//{
// var f = new fMessageWindow("선택 알림\n" + m);
// f.SetWindowColor(fMessageWindow.EWinColor.Attention);
// f.EnableUserClose = true;
// f.DialogMode = true;
// f.btNo.Text = btCancel;
// f.btYes.Text = btOK;
// var dlg = f.ShowDialog();
// return dlg;
//}
}
#endregion
public static string SelectSerialPort()
{
var f = new System.Windows.Forms.Form();
f.WindowState = System.Windows.Forms.FormWindowState.Normal;
f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
f.Size = new System.Drawing.Size(800, 400);
f.MaximizeBox = false;
f.MinimizeBox = false;
f.Text = "Select Port";
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
var lst = new System.Windows.Forms.ListBox();
lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
lst.Dock = System.Windows.Forms.DockStyle.Fill;
lst.DoubleClick += (s1, e1) =>
{
if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
};
using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
{
var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
foreach (var port in portnames)
{
var desc = "";
var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
if (portInfo != null) desc = portInfo["Caption"].ToString();
lst.Items.Add(string.Format("{0} - {1}", port, desc));
}
}
f.Controls.Add(lst);
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var name = lst.SelectedItem.ToString().Split('-');
return name[0].Trim();
}
else return string.Empty;
}
public static void ScreenCaptrue(int _BitmapWidth, int _BitmapHeight, Point ptSouce)
{
try
{
Bitmap bitmap = new Bitmap(_BitmapWidth, _BitmapHeight);
Graphics _graphic = Graphics.FromImage(bitmap);
_graphic.CopyFromScreen(ptSouce, new Point(0, 0), new Size(_BitmapWidth, _BitmapHeight));
string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
System.IO.FileInfo grpath = new FileInfo(savefile);
if (!grpath.Directory.Exists) grpath.Directory.Create();
bitmap.Save(grpath.FullName, System.Drawing.Imaging.ImageFormat.Png);
Util.MsgI("화면 캡쳐 성공\n" +
"위치:" + grpath.Directory.FullName +"\n" +
"파일명: " + grpath.Name);
}
catch (Exception ex)
{
Util.MsgE("화면 캡쳐 실패\n" + ex.Message);
}
}
public static void SaveBugReport(string content, string subdirName = "BugReport")
{
try
{
var path = CurrentPath + subdirName;
if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
var file = path + "\\" + DateTime.Now.ToString("yyyyMMdd_HHmmss_fff") + ".txt";
System.IO.File.WriteAllText(file, content, System.Text.Encoding.UTF8);
}
catch
{
//nothing
}
}
public static void CopyData(System.Data.DataRow drSrc, System.Data.DataRow drDes)
{
if (drDes == null || drSrc == null) return;
foreach (System.Data.DataColumn col in drSrc.Table.Columns)
{
if (col.ColumnName.ToUpper() == "IDX") continue;
drDes[col.ColumnName] = drSrc[col.ColumnName];
}
}
/// <summary>
/// 현재실행중인폴더를 반환합니다.
/// </summary>
public static string CurrentPath
{
get
{
return AppDomain.CurrentDomain.BaseDirectory;
}
}
/// <summary>
/// 콤마와 줄바꿈등을 제거합니다.
/// </summary>
/// <returns></returns>
public static string ToCSVString(string src)
{
string retval = src.Replace("\r", "").Replace("\n", "").Replace(",", "");
return retval;
}
public static Boolean RunProcess(string file, string arg = "")
{
var fi = new System.IO.FileInfo(file);
if (!fi.Exists)
{
// Pub.log.AddE("Run Error : " + file);
return false;
}
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(file);
si.Arguments = arg;
prc.StartInfo = si;
prc.Start();
return true;
}
#region "convert"
public static string RectToStr(Rectangle rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string RectToStr(RectangleF rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string PointToStr(Point pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static string PointToStr(PointF pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static Rectangle StrToRect(string str)
{
if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.Rectangle(
int.Parse(roibuf1[0]),
int.Parse(roibuf1[1]),
int.Parse(roibuf1[2]),
int.Parse(roibuf1[3]));
}
public static RectangleF StrToRectF(string str)
{
if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.RectangleF(
float.Parse(roibuf1[0]),
float.Parse(roibuf1[1]),
float.Parse(roibuf1[2]),
float.Parse(roibuf1[3]));
}
public static Point StrToPoint(string str)
{
if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.Point(
int.Parse(roibuf1[0]),
int.Parse(roibuf1[1]));
}
public static PointF StrToPointF(string str)
{
if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.PointF(
float.Parse(roibuf1[0]),
float.Parse(roibuf1[1]));
}
#endregion
#region "NIC"
/// <summary>
/// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
/// </summary>
/// <returns></returns>
public static Boolean ExistNIC(string NICName)
{
if (string.IsNullOrEmpty(NICName)) return false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
return true;
}
}
return false;
}
/// <summary>
/// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICDisable(string NICName)
{
//해당 nic 가 현재 목록에 존재하는지 확인한다.
string cmd = "interface set interface " + NICName + " disable";
Process prc = new Process();
ProcessStartInfo si = new ProcessStartInfo("netsh", cmd);
si.WindowStyle = ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에서 사라질때까지 기다린다.
DateTime SD = DateTime.Now;
Boolean timeout = false;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (!FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
timeout = true;
break; // TODO: might not be correct. Was : Exit While
}
}
return !timeout;
}
public static List<String> NICCardList()
{
List<String> Retval = new List<string>();
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet)
{
Retval.Add(Net.Name.ToUpper());
}
}
return Retval;
}
/// <summary>
/// 이더넷카드를 사용함으로 설정합니다.
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICEnable(string NICName)
{
string cmd = "interface set interface " + NICName + " enable";
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("netsh", cmd);
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에생길떄까지 대기
DateTime SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
////결이 완료될떄까지 기다린다.
SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet) continue;
if (Net.Name.ToLower() == NICName.ToLower())
{
//string data = Net.GetIPProperties().GatewayAddresses[0].ToString();
if (Net.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
}
if (FindNetwork)
return true;
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
}
#endregion
public static void RunExplorer(string arg)
{
System.Diagnostics.ProcessStartInfo si = new ProcessStartInfo("explorer");
si.Arguments = arg;
System.Diagnostics.Process.Start(si);
}
#region "watchdog"
public static void WatchDog_Run()
{
System.IO.FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "WatchCat.exe");
if (!fi.Exists) return;
var Exist = CheckExistProcess("watchcat");
if (Exist) return;
RunProcess(fi.FullName);
}
public static Boolean CheckExistProcess(string ProcessName)
{
foreach (var prc in System.Diagnostics.Process.GetProcesses())
{
if (prc.ProcessName.StartsWith("svchost")) continue;
if (prc.ProcessName.ToUpper() == ProcessName.ToUpper()) return true;
}
return false;
}
#endregion
#region "web function"
/// <summary>
/// URL로부터 문자열을 수신합니다.
/// </summary>
/// <param name="url"></param>
/// <param name="isError"></param>
/// <returns></returns>
public static string GetStrfromurl(string url, out Boolean isError)
{
isError = false;
string result = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
request.Timeout = 60000;
request.ReadWriteTimeout = 60000;
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse() as HttpWebResponse;
var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
result = txtReader.ReadToEnd();
}
catch (Exception ex)
{
isError = true;
result = ex.Message.ToString();
}
return result;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>