using OpenTap.Addin.Util; using System.Collections.Concurrent; namespace OpenTap.Addin { public class FileGlobalsContext { ConcurrentDictionary map = new ConcurrentDictionary(); public RuntimeVariable GetFileGlobals(TestPlan plan, TestPlanRun run) { string path = plan.VisualPath; if (!map.ContainsKey(path)) { var runtimeVariablePool = new ConcurrentDictionary(); foreach (var data in plan.Variables) { RuntimeVariable runTime = data.ToRuntime(run); if (runTime is null) continue; runtimeVariablePool[runTime.__name___] = runTime; } map[path] = new RuntimeVariable(run, ConstNames.FileGlobalsName, runtimeVariablePool); } return map[path]; } } }