From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 Plugin.CurrentSensorControl/Entity/OPCContext.cs |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/Plugin.CurrentSensorControl/Entity/OPCContext.cs b/Plugin.CurrentSensorControl/Entity/OPCContext.cs
new file mode 100644
index 0000000..04ed98a
--- /dev/null
+++ b/Plugin.CurrentSensorControl/Entity/OPCContext.cs
@@ -0,0 +1,40 @@
+锘縰sing ConnectionUtil;
+using OPCConnection;
+
+namespace Plugin.CurrentSensorControl.Entity
+{
+    public class OPCContext
+    {
+        private static Dictionary<string, SCADAApi> cache = new Dictionary<string, SCADAApi>();
+        private static string opcIP = "127.0.0.1";
+        private static int opcPort = 6543;
+        private static int localPort = 18888;
+
+        public static SCADAApi Get(string name)
+        {
+            if (!cache.ContainsKey(name))
+            {
+                var client = new OPCClient();
+                if (!client.Connect2(opcIP, opcPort, localPort, out string errMsg))
+                {
+
+                }
+                else
+                {
+
+                }
+                cache[name] = client;
+            }
+            return cache[name];
+        }
+
+        public static bool Connect(string name)
+        {
+            if (cache.ContainsKey(name))
+            {
+                return cache[name].Connect2(opcIP, opcPort, localPort, out string errMsg) == true;
+            }
+            return false;
+        }
+    }
+}

--
Gitblit v1.9.1