Files
2025-12-11 14:04:39 +08:00

29 lines
854 B
C#

using System.Reflection;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
namespace IotManager.Common
{
public class StaticData
{
public static ScriptEngine eng = Python.CreateEngine();
public static ScriptScope scope1 = eng.CreateScope();
public static ScriptScope scope2 = eng.CreateScope();
public static ScriptScope scope3 = eng.CreateScope();
public static void GetWebAPIMethod()
{
eng.Runtime.LoadAssembly(Assembly.GetExecutingAssembly());
eng.ExecuteFile("script\\webapi.py", scope1);
}
public static void GetWebAPIMethod1()
{
eng.ExecuteFile("script\\CommonData.py", scope2);
}
public static void GetWebAPIMethod2()
{
eng.ExecuteFile("script\\b.py", scope1);
}
}
}