public MyPlugin(ICoolQApi coolQApi) : base(coolQApi) { //获取本地配置 systemConfigJson = MySystemUtil.GetSystemConfigJson(); if (systemConfigJson == null) { MessageBox.Show("不能加载" + MySystemUtil.GetSystemConfigJsonPath() + ",请重启");//程序即将退出 } else { mainForm = new MainForm(); mainForm.Show(); mainForm.setCoolQApi(CoolQApi); } }
/// <summary> /// 获取本地配置文件 /// </summary> /// <returns></returns> public static SystemConfigJson GetSystemConfigJson() { try { if (!File.Exists(GetSystemConfigJsonPath())) { return(null); } else { MyJsonUtil <SystemConfigJson> myJsonUtil = new MyJsonUtil <SystemConfigJson>(); string content = MyFileUtil.readFileAll(GetSystemConfigJsonPath()); SystemConfigJson systemConfigJson = myJsonUtil.parseJsonStr(content); return(systemConfigJson); } }catch (Exception e) { return(null); } }