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/TestPlanRun.cs | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/OpenTap/Engine/TestPlanRun.cs b/OpenTap/Engine/TestPlanRun.cs
index ccd9810..c705591 100644
--- a/OpenTap/Engine/TestPlanRun.cs
+++ b/OpenTap/Engine/TestPlanRun.cs
@@ -49,15 +49,18 @@
static readonly TraceSource log = Log.CreateSource("TestPlan");
static readonly TraceSource resultLog = Log.CreateSource("Resources");
+ public VariableContext LocalsRuntime { get; internal set; }
+
/// <summary>
/// FileGlobals运行时
/// </summary>
public VariableContext ParametersRuntime { get; private set; }
+ public FileGlobalsContext fileGlobalsContext { get; private set; }
/// <summary>
/// FileGlobals运行时
/// </summary>
- public VariableContext FileGlobalsRuntime { get; private set; }
+ public VariableContext FileGlobalsRuntime { get => fileGlobalsContext?.GetFileGlobals(plan); }
/// <summary>
/// StationGlobals运行时
@@ -675,21 +678,31 @@
void RefreshFileGlobals()
{
- if (variableContainer?.FileGlobals != null)
+ //if (variableContainer?.FileGlobals != null)
+ //{
+ // FileGlobalsRuntime = variableContainer.FileGlobals;
+ //}
+ //else
+ //{
+ // var runtimeVariablePool = new ConcurrentDictionary<string, RuntimeVariable>();
+ // foreach (var data in plan.Variables)
+ // {
+ // RuntimeVariable runTime = data.ToRuntime();
+ // if (runTime == null) continue;
+ // runtimeVariablePool[runTime.Name] = runTime;
+ // }
+ // this.FileGlobalsRuntime = new VariableContext(runtimeVariablePool);
+ //}
+
+ if (variableContainer?.fileGlobalsContext != null)
{
- FileGlobalsRuntime = variableContainer.FileGlobals;
+ fileGlobalsContext = variableContainer.fileGlobalsContext;
}
else
{
- var runtimeVariablePool = new ConcurrentDictionary<string, RuntimeVariable>();
- foreach (var data in plan.Variables)
- {
- RuntimeVariable runTime = data.ToRuntime();
- if (runTime == null) continue;
- runtimeVariablePool[runTime.Name] = runTime;
- }
- this.FileGlobalsRuntime = new VariableContext(runtimeVariablePool);
- }
+ fileGlobalsContext = new FileGlobalsContext();
+ var _ = fileGlobalsContext.GetFileGlobals(plan);
+ }
}
void RefreshStationGlobals()
--
Gitblit v1.9.1