From 53e656200368a983e563550e2cc1acbc6d86b729 Mon Sep 17 00:00:00 2001
From: chr <chrry550@outlook.com>
Date: 星期三, 08 四月 2026 19:57:14 +0800
Subject: [PATCH] 完善代码

---
 OpenTap/Engine/Addin/VariableContext.cs |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/OpenTap/Engine/Addin/VariableContext.cs b/OpenTap/Engine/Addin/VariableContext.cs
index dce9c8e..c5a2cd4 100644
--- a/OpenTap/Engine/Addin/VariableContext.cs
+++ b/OpenTap/Engine/Addin/VariableContext.cs
@@ -1,5 +1,8 @@
 锘縰sing System.Collections.Concurrent;
+using System.Collections.Generic;
 using System.Dynamic;
+using System.IO;
+using System.Numerics;
 
 namespace OpenTap.Addin
 {
@@ -69,5 +72,17 @@
                 }
             }
         }
+
+        public static VariableContext FromTestVariables(IEnumerable<TestVariable> variables)
+        {
+            var runtimeVariablePool = new ConcurrentDictionary<string, RuntimeVariable>();
+            foreach (var data in variables)
+            {
+                RuntimeVariable runTime = data.ToRuntime();
+                if (runTime == null) continue;
+                runtimeVariablePool[runTime.Name] = runTime;
+            }
+            return new VariableContext(runtimeVariablePool);
+        }
     }
 }

--
Gitblit v1.9.1