internal void TryLoadModules()
        {
            try
            {
                var dir = Api.GetAppDirectory();

                if (Directory.Exists(dir) &&
                    Directory.EnumerateFiles(dir, "*.dll").Count() > 0)
                {
                    ComposeModules(dir);
                }
                else
                {
                    ComposeModules();
                }

                Api.AddLog(CoolQLogLevel.Info, "模块加载", $"共加载{Modules.Count()}个模块");

                foreach (var m in Modules)
                {
                    Log(LogLevel.Info, $"已加载模块:[{m.ModuleName},版本{m.Version}]");
                }
            }
            catch (Exception e)
            {
                Log(LogLevel.Warning, "加载模块失败!" + e);
            }
        }
Пример #2
0
 private void TryLoadModules()
 {
     try
     {
         timer.Elapsed += (s, e) =>
         {
             var dir = Api.GetAppDirectory();
             if (Directory.Exists(dir))
             {
                 ComposeModules(dir);
                 Api.AddLog(CoolQLogLevel.Info, "模块加载", $"共加载{Modules.Count()}个模块");
             }
             else
             {
                 if (dir != null)
                 {
                     Directory.CreateDirectory(dir);
                 }
             }
         };
         timer.Enabled = true;
     }
     catch (Exception e)
     {
         Api.AddLog(CoolQLogLevel.Warning, "警告", "加载模块失败!" + e);
     }
 }