private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "config.xml"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } XElement xe = XElement.Load(configPath); var elements = from ele in xe.Elements() select ele; txtCCplayerIP.Text = elements.FirstOrDefault(ele => ele.Name == "IP").Value; txtCCplayerPort.Text = elements.FirstOrDefault(ele => ele.Name == "Port").Value; txtCCplayerServer.Text = elements.FirstOrDefault(ele => ele.Name == "TsSheduleCenterHttpSerUrl").Value; } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化CMDServer配置文件异常", e.StackTrace); } }
public int FromSql(string sql) { try { sqlConn.Open(); } catch { MixLogHelper.Error(GetType().Name, "数据库连接异常:" + connectString); return(-100); } try { SqlCommand command = new SqlCommand(); command.Connection = sqlConn; command.CommandText = sql; return(command.ExecuteNonQuery()); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "sql语句执行错误:" + sql, e.StackTrace); return(-100); } finally { sqlConn.Close(); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "DataTranNewGUI.exe"); hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } txtSliceCount.Text = AppConfigurator.GetAppConfig("SliceCount", configPath); txtSliceTime.Text = AppConfigurator.GetAppConfig("SliceTime", configPath); textServerIp.Text = AppConfigurator.GetAppConfig("ServerIP", configPath); txtServerPort.Text = AppConfigurator.GetAppConfig("ServerPort", configPath); txtBasePath.Text = AppConfigurator.GetAppConfig("BasePath", configPath); txtMonBasePath.Text = AppConfigurator.GetAppConfig("MonBasePath", configPath); txtFTPHost.Text = AppConfigurator.GetAppConfig("FTPHost", configPath); txtFTPPort.Text = AppConfigurator.GetAppConfig("FTPPort", configPath); txtFTPUserName.Text = AppConfigurator.GetAppConfig("FTPUserName", configPath); txtFTPPwd.Text = AppConfigurator.GetAppConfig("FTPPwd", configPath); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化Record配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "Skin", "Main_dlg.xml"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } XElement xe = XElement.Load(configPath); var editElements = xe.XPathSelectElements("//Edit"); textEdt_InputIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_InputIP").Attribute("text").Value; textEdt_InputPort.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_InputPort").Attribute("text").Value; textEdt_SeverIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_SeverIP").Attribute("text").Value; textEdt_ServerPort.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_ServerPort").Attribute("text").Value; textEdt_LoalIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_LoalIP").Attribute("text").Value; textEdt_Localport.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_Localport").Attribute("text").Value; } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化Demultiplex配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "Config.ini"); hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } if (iniFile == null) { iniFile = new IniFileOperator(configPath); } txtWAVFilePath.Text = iniFile.ReadString("FilesPath", "WavFilesPath", ""); txtMP3FilePath.Text = iniFile.ReadString("FilesPath", "Mp3FilesPath", ""); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化Record配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath1 = Path.Combine(path, @"webapps\ginkgo\WEB-INF\classes", "db.properties"); string configPath2 = Path.Combine(path, @"webapps\ginkgo\WEB-INF", "web.xml"); string configPath3 = Path.Combine(path, @"conf", "server.xml"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath1); MixLogHelper.Info(GetType().Name, configPath2); MixLogHelper.Info(GetType().Name, configPath3); } hasConfigFile = File.Exists(configPath1) && File.Exists(configPath2); if (!File.Exists(configPath1) || !File.Exists(configPath2)) { MessageBox.Show(this, "配置文件不存在"); return; } propertyFileOperator = new PropertyFileOperator(configPath1); textJDBCUrl.Text = propertyFileOperator.GetPropertiesText("jdbcUrl"); textBrokerUrl.Text = propertyFileOperator.GetPropertiesText("brokerURL"); textAdminUserOrgCode.Text = propertyFileOperator.GetPropertiesText("adminUserOrgCode"); textUpdateSrvTime.Text = propertyFileOperator.GetPropertiesText("updateSrvTime"); textUpdateSrvStatus.Text = propertyFileOperator.GetPropertiesText("updateSrvStatus"); txt_hlsUrl.Text = propertyFileOperator.GetPropertiesText("hlsUrl"); txt_hlsMappedUrl.Text = propertyFileOperator.GetPropertiesText("hlsMappedUrl"); txt_updateUrl.Text = propertyFileOperator.GetPropertiesText("updateUrl"); txt_updateMappedUrl.Text = propertyFileOperator.GetPropertiesText("updateMappedUrl"); txtaudioInnerNet.Text = propertyFileOperator.GetPropertiesText("audioInnerNet"); txtaudioInnerPort.Text = propertyFileOperator.GetPropertiesText("audioInnerPort"); txtaudioOuterNet.Text = propertyFileOperator.GetPropertiesText("audioOuterNet"); txtaudioOuterPort.Text = propertyFileOperator.GetPropertiesText("audioOuterPort"); txtinnerNet.Text = propertyFileOperator.GetPropertiesText("innerNet"); txtinnerPort.Text = propertyFileOperator.GetPropertiesText("innerPort"); txtouterNet.Text = propertyFileOperator.GetPropertiesText("outerNet"); txtouterPort.Text = propertyFileOperator.GetPropertiesText("outerPort"); XElement xeWeb = XElement.Load(configPath2); var elements = xeWeb.XPathSelectElements("//*"); var media = elements.FirstOrDefault(ele => ele.Name.LocalName == "param-name" && ele.Value == "mediaUrl"); var value = (media.NextNode as XElement).Value; textMediaUrl.Text = value; //XElement xeServer = XElement.Load(configPath3); //var contextElements = xeServer.XPathSelectElements("//Context"); //textDocBase.Text = contextElements.FirstOrDefault(q => q.Attributes("docBase").Count() > 0).Attribute("docBase").Value; } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化CMDServer配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "InstructionServer.ini"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } if (iniFile == null) { iniFile = new IniFileOperator(configPath); } textServerName.Text = iniFile.ReadString("Database", "ServerName", ""); textDataBase.Text = iniFile.ReadString("Database", "DataBase", ""); textLogID.Text = iniFile.ReadString("Database", "LogID", ""); textLogPass.Text = iniFile.ReadString("Database", "LogPass", ""); textMQServerIP.Text = iniFile.ReadString("MQ", "MQIP", ""); textMQServerPORT.Text = iniFile.ReadString("MQ", "MQPORT", ""); textMQServerTopicName.Text = iniFile.ReadString("MQ", "TopicName", ""); cbBoxProtocol.SelectedValue = iniFile.ReadInteger("ProtocolType", "ProtocolType", 1); textLocalHost.Text = iniFile.ReadString("LocalHost", "IP", ""); textTCPReceivePort.Text = iniFile.ReadString("TCP", "ReceivePort", ""); textElementaryPid.Text = iniFile.ReadString("TSSendInfo", "ElementaryPid", ""); textStream_id.Text = iniFile.ReadString("TSSendInfo", "Stream_id", ""); textProgram_id.Text = iniFile.ReadString("TSSendInfo", "Program_id", ""); textPMT_Pid.Text = iniFile.ReadString("TSSendInfo", "PMT_Pid", ""); textSection_length.Text = iniFile.ReadString("TSSendInfo", "Section_length", ""); textsDestSockAddress.Text = iniFile.ReadString("TSSendInfo", "sDestSockAddress", ""); textStream_BitRate.Text = iniFile.ReadString("TSSendInfo", "Stream_BitRate", ""); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化Ts指令服务配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "gxreback.ini"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } if (iniFile == null) { iniFile = new IniFileOperator(configPath); } textServerName.Text = iniFile.ReadString("Database", "ServerName", ""); textDataBase.Text = iniFile.ReadString("Database", "DataBase", ""); textLogID.Text = iniFile.ReadString("Database", "LogID", ""); textLogPass.Text = iniFile.ReadString("Database", "LogPass", ""); textIP.Text = iniFile.ReadString("LocalHost", "LoaclIP", ""); textUDPPORT.Text = iniFile.ReadString("LocalHost", "UDPLocalPort", ""); textTCPPORT.Text = iniFile.ReadString("LocalHost", "TCPLocalPort", ""); textMQServer.Text = iniFile.ReadString("MQ", "MQIP", ""); textMQServerPORT.Text = iniFile.ReadString("MQ", "MQPORT", ""); textMQTopicName.Text = iniFile.ReadString("MQ", "TopicName", ""); txtFTPServer.Text = iniFile.ReadString("Reback", "FTPServer", ""); txtFTPPort.Text = iniFile.ReadString("Reback", "FTPPort", ""); txtFTPUserName.Text = iniFile.ReadString("Reback", "FTPUserName", ""); txtFTPPwd.Text = iniFile.ReadString("Reback", "FTPPwd", ""); txtftppath.Text = iniFile.ReadString("Reback", "ftppath", ""); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化广西协议回传服务配置文件异常", e.StackTrace); } }
public bool ExecuteCommand(ArrayList varSqlList) { bool success = false; try { sqlConn.Open(); } catch { MixLogHelper.Error(GetType().Name, "数据库连接异常:" + connectString); return(false); } SqlTransaction varTrans = sqlConn.BeginTransaction(); SqlCommand command = new SqlCommand(); command.Connection = sqlConn; command.Transaction = varTrans; try { foreach (string varcommandText in varSqlList) { command.CommandText = varcommandText; command.ExecuteNonQuery(); } varTrans.Commit(); success = true; } catch (Exception ex) { varTrans.Rollback(); MixLogHelper.Error(GetType().Name, "执行sql脚本错误", ex.StackTrace); success = false; } finally { sqlConn.Close(); } return(success); }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "Skin", "Main_dlg.xml"); string configPathIni = Path.Combine(Path.GetDirectoryName(path), "Config.ini"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); MixLogHelper.Info(GetType().Name, configPathIni); } hasConfigFile = File.Exists(configPath) && File.Exists(configPathIni); if (!File.Exists(configPath) || !File.Exists(configPathIni)) { MessageBox.Show(this, "配置文件不存在"); return; } if (iniFile == null || iniFile.IniFileName != configPathIni) { iniFile = new IniFileOperator(configPathIni); } textHost.Text = iniFile.ReadString("HostConfig", "Host", ""); textPort.Text = iniFile.ReadString("HostConfig", "Port", ""); textUserName.Text = iniFile.ReadString("HostConfig", "UserName", ""); textWatchWord.Text = Encoding.Default.GetString(Convert.FromBase64String(iniFile.ReadString("HostConfig", "WatchWord", ""))); XElement xe = XElement.Load(configPath); var editElements = xe.XPathSelectElements("//Edit"); textEdt_InputIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_InputIP").Attribute("text").Value; textEdt_InputPort.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_InputPort").Attribute("text").Value; textEdt_SeverIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_SeverIP").Attribute("text").Value; textEdt_ServerPort.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_ServerPort").Attribute("text").Value; textEdt_LoalIP.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_LoalIP").Attribute("text").Value; textEdt_Localport.Text = editElements.FirstOrDefault(q => q.Attribute("name").Value == "edt_Localport").Attribute("text").Value; } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化Record配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "JT.exe.config"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } XmlDocument dom = new XmlDocument(); dom.Load(configPath); System.Xml.XmlNode root = dom.SelectSingleNode("configuration"); string strConfig = @"configuration/connectionStrings/add"; System.Xml.XmlNode node = dom.SelectSingleNode(strConfig); string[] pps = node.Attributes["connectionString"].Value.Split(';'); string JTSQLIP = "", JTDataBase = "", JTLogID = "", JTLogPass = ""; for (int i = 0; i < pps.Length; i++) { if (pps[i].Contains("Data Source")) { JTSQLIP = pps[i].Split('=')[1]; } if (pps[i].Contains("Initial Catalog")) { JTDataBase = pps[i].Split('=')[1]; } if (pps[i].Contains("User ID")) { JTLogID = pps[i].Split('=')[1]; } if (pps[i].Contains("Password")) { JTLogPass = pps[i].Split('=')[1]; } } txtJTSQLIP.Text = JTSQLIP; txtJTDataBase.Text = JTDataBase; txtJTLogID.Text = JTLogID; txtJTLogPass.Text = JTLogPass; string strConfigString = @"configuration/userSettings/CarMS.Properties.Settings/setting[@name='{0}']/value"; System.Xml.XmlNode xmlNodeComOne = dom.SelectSingleNode(string.Format(strConfigString, "ComOne")); txtJTLocalHost.Text = xmlNodeComOne.InnerText; System.Xml.XmlNode xmlNodeBotOne = dom.SelectSingleNode(string.Format(strConfigString, "BotOne")); txtJTPort.Text = xmlNodeBotOne.InnerText; } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化JTEXE配置文件异常", e.StackTrace); } }
private void InitData() { try { string configPath = Path.Combine(Path.GetDirectoryName(path), "TsSheduleCenter.ini"); if (System.Configuration.ConfigurationManager.AppSettings["LogConfigPathFlag"] != "0") { MixLogHelper.Info(GetType().Name, configPath); } hasConfigFile = File.Exists(configPath); if (!File.Exists(configPath)) { MessageBox.Show(this, "配置文件不存在"); return; } if (iniFile == null) { iniFile = new IniFileOperator(configPath); } textServerName.Text = iniFile.ReadString("Database", "ServerName", ""); textDataBase.Text = iniFile.ReadString("Database", "DataBase", ""); textLogID.Text = iniFile.ReadString("Database", "LogID", ""); textLogPass.Text = iniFile.ReadString("Database", "LogPass", ""); textIP.Text = iniFile.ReadString("UDP", "IP", ""); textPORT.Text = iniFile.ReadString("UDP", "PORT", ""); textMicroPORT.Text = iniFile.ReadString("UDP", "MicroPORT", ""); textMicroRecPORT.Text = iniFile.ReadString("UDP", "MicroRecPORT", ""); textRTSPPORT.Text = iniFile.ReadString("UDP", "RTSPPORT", ""); textCAIP.Text = iniFile.ReadString("UDP", "CAIP", ""); textCAPORT.Text = iniFile.ReadString("UDP", "CAPORT", ""); textCAGAP.Text = iniFile.ReadString("UDP", "CAGAP", ""); textCATIMES.Text = iniFile.ReadString("UDP", "CATIMES", ""); textMQIP.Text = iniFile.ReadString("UDP", "MQIP", ""); textMQPORT.Text = iniFile.ReadString("UDP", "MQPORT", ""); textMQUSER.Text = iniFile.ReadString("UDP", "MQUSER", ""); textMQPWD.Text = iniFile.ReadString("UDP", "MQPWD", ""); textRECTOPIC.Text = iniFile.ReadString("UDP", "RECTOPIC", ""); textSENDTOPIC.Text = iniFile.ReadString("UDP", "SENDTOPIC", ""); cbBoxMICROMODE.SelectedValue = iniFile.ReadInteger("SYSSET", "MICROMODE", 1); textMULTIPLEXERFLAG.Text = iniFile.ReadString("SYSSET", "MULTIPLEXERFLAG", ""); textMULTIPLEXERIP.Text = iniFile.ReadString("SYSSET", "MULTIPLEXERIP", ""); textMULTIPLEXERPORT.Text = iniFile.ReadString("SYSSET", "MULTIPLEXERPORT", ""); textURL.Text = iniFile.ReadString("SYSSET", "URL", ""); textSwitchFreq.Text = iniFile.ReadString("SYSSET", "SwitchFreq", ""); textCCPlayPath.Text = iniFile.ReadString("SYSSET", "CCPlayPath", ""); textAmTimeOut.Text = iniFile.ReadString("SYSSET", "AmTimeOut", ""); textPORTL.Text = iniFile.ReadString("SYSSET", "PORTL", ""); textPORTH.Text = iniFile.ReadString("SYSSET", "PORTH", ""); textLOCALPATH.Text = iniFile.ReadString("SYSSET", "LOCALPATH", ""); textURLPATH.Text = iniFile.ReadString("SYSSET", "URLPATH", ""); textGBSTUDIONO.Text = iniFile.ReadString("SYSSET", "GBSTUDIONO", ""); textSTUDIONO.Text = iniFile.ReadString("SYSSET", "STUDIONO", ""); textLEDtxtLenth.Text = iniFile.ReadString("LED", "LEDtxtLenth", ""); txtCCPlayHttpPath.Text = iniFile.ReadString("SYSSET", "CCPlayHttpPath", ""); txtCCPlayHttpSerPort.Text = iniFile.ReadString("SYSSET", "CCPlayHttpSerPort", ""); } catch (Exception e) { MixLogHelper.Error(GetType().Name, "初始化TsSheduleCenter配置文件异常", e.StackTrace); } }