示例#1
0
 protected void OnModuleImported(PythonDataPlugin plugin, DataStore ds, ScriptWrapper sc)
 {
     try
     {
         //获取脚本方函数对象,函数的原型是请参考apple_apps.py里面的run
         var func = sc.GetScopeFunction <DataStore, bool, IDescriptiveProgress, CancellationToken, ParserResults>($"run");
         if (func != null)
         {
             //运行此函数(建议在脚本里断点调试)
             var results = func(ds, true, plugin.Progress, plugin.CancellationToken);
         }
     }
     catch (Exception e)
     {
         TraceService.Trace(TraceLevel.Error, e.Message);
     }
 }