InstallDev( DRV_H.SendCommanddeg fptrSendCommand, DRV_H.AddMsgdeg fptrAddMsg, DRV_H.WriteResultdeg fptrWriteResult, DRV_H.WriteProcessDatadeg fptrWriteProcessData, DRV_H.WriteTestStatusdeg fptrWriteTestStatus) { try { m_fptrSendCommand = fptrSendCommand; m_fptrAddMsg = fptrAddMsg; m_fptrWriteResult = fptrWriteResult; m_fptrWriteProcessData = fptrWriteProcessData; m_fptrWriteTestStatus = fptrWriteTestStatus; DevConfigManager.InitConfig(); if (!DevConfigManager.ready) { throw new NullReferenceException(); } StringBuilder buffer = new StringBuilder(256); string serverName = DevConfigManager.GetConfigString("SERVER_DB", "DB_SERVER", string.Empty, buffer, buffer.Capacity); string instanceName = DevConfigManager.GetConfigString("SERVER_DB", "DB_NAME", string.Empty, buffer, buffer.Capacity); string uid = DevConfigManager.GetConfigString("SERVER_DB", "UID", string.Empty, buffer, buffer.Capacity); string pwd = DevConfigManager.GetConfigString("SERVER_DB", "PWD", string.Empty, buffer, buffer.Capacity); string connectioString = "server={0}; Initial Catalog={1};User Id={2};Password={3};" .FormatWith(serverName, instanceName, uid, pwd); PUBControl.SYS_LOG.write_log("dllinstall.log", "CONNECTION STRING -> " + connectioString); dbConfig.DB_SERVER = serverName; dbConfig.DB_NAME = instanceName; dbConfig.UID = uid; dbConfig.PWD = pwd; dbConfig.g_strConnectionStringSqlClient1 = connectioString; m_wndMain = new WndMain(); m_wndMain.ControlBox = false; m_wndMain.Hide(); DLL_READY = true; } catch (Exception ex) { PUBControl.SYS_LOG.write_log("dllinstall.log", "EXCEPTION ->" + ex.Message); PUBControl.SYS_LOG.write_log("dllinstall.log", "CALL STACK ->" + ex.StackTrace); return(false); } return(true); }
InstallDev( DRV_H.SendCommanddeg fptrSendCommand, DRV_H.AddMsgdeg fptrAddMsg, DRV_H.WriteResultdeg fptrWriteResult, DRV_H.WriteProcessDatadeg fptrWriteProcessData, DRV_H.WriteTestStatusdeg fptrWriteTestStatus) { m_fptrSendCommand = fptrSendCommand; m_fptrAddMsg = fptrAddMsg; m_fptrWriteResult = fptrWriteResult; m_fptrWriteProcessData = fptrWriteProcessData; m_fptrWriteTestStatus = fptrWriteTestStatus; DevConfigManager.InitConfig(); if (!DevConfigManager.ready) { throw new NullReferenceException(); } StringBuilder buffer = new StringBuilder(256); string serverName = DevConfigManager.GetConfigString("SERVER_DB", "DB_SERVER", string.Empty, buffer, buffer.Capacity); string instanceName = DevConfigManager.GetConfigString("SERVER_DB", "DB_NAME", string.Empty, buffer, buffer.Capacity); string uid = DevConfigManager.GetConfigString("SERVER_DB", "UID", string.Empty, buffer, buffer.Capacity); string pwd = DevConfigManager.GetConfigString("SERVER_DB", "PWD", string.Empty, buffer, buffer.Capacity); string connectioString = $"server={serverName}; Initial Catalog={instanceName};User Id={uid};Password={pwd};"; string canEdit = DevConfigManager.GetConfigString("SERVER_DB", "EDIT_INFO", string.Empty, buffer, buffer.Capacity); dbConfig.DB_SERVER = serverName; dbConfig.DB_NAME = instanceName; dbConfig.UID = uid; dbConfig.PWD = pwd; dbConfig.g_strConnectionStringSqlClient1 = connectioString; m_wndMain = new WndMain(canEdit == "1") { ControlBox = false }; m_wndMain.Hide(); m_wndConfig = new WndConfig { ControlBox = false }; m_wndConfig.Hide(); DLL_READY = true; return(true); }