/// <summary> /// 初始化桥接功能 /// </summary> public static bool InitializeBridge() { bool connected = false; try { string iniFilePath = Application.StartupPath + SqlConfiguration.INI_CFG_PATH; //生产环境连接配置 IWriteSQLConfigValue cfgNormal = new INIFileWriter(iniFilePath); //串口设置 SerialPortConfig.IniFile = iniFilePath; SerialPortConfig.Read(); //设置配置信息 SqlConfiguration.SetSQLConfig(cfgNormal); connected = SqlConfiguration.TestConnection(true); //测试AdoDirect连接 PubConstant.SqliteConnstr = "Data Source=" + Application.StartupPath + @"\db\HookData.db"; } catch (Exception ex) { Msg.ShowException(ex); } //测试桥接是否成功 if (false == connected) { Msg.Warning(TEST_BRIDGE_FAILED); } return(connected); }