/// <summary> /// 设置数据库参数 /// </summary> public static void SetConnectionString() { try { string xmlFile = System.Windows.Forms.Application.StartupPath + "\\Setting.xml"; if (!System.IO.File.Exists(xmlFile)) { throw(new Exception("配置文件不存在")); } myXML _XML = new myXML(xmlFile); string server = _XML.GetElement("DataBaseOra", "Server"); //string database = _XML.GetElement("DataBaseOra", "DataBase"); string user = _XML.GetElement("DataBaseOra", "User"); string password = _XML.GetElement("DataBaseOra", "Password"); //try //{ // user = DEncrypt.DEncrypt.Decrypt(_XML.GetElement("DataBaseOra", "User")); // password = DEncrypt.DEncrypt.Decrypt(_XML.GetElement("DataBaseOra", "Password")); //} //catch (Exception ex) //{ // user = ""; // password = ""; //} SetConnectionString(server, user, password); } catch (Exception ex) { throw (ex); } }
/// <summary> /// 设置数据库参数 /// </summary> public static void SetConnectionString() { try { string xmlFile = System.Windows.Forms.Application.StartupPath + "\\Setting.xml"; if (!System.IO.File.Exists(xmlFile)) { MessageBox.Show("配置文件不存在!", "提示"); return; } myXML _XML = new myXML(xmlFile); string server = _XML.GetElement("DataBase", "Server"); string database = _XML.GetElement("DataBase", "DataBase"); string user, password; try { user = _XML.GetElement("DataBase", "User"); // DEncrypt.DEncrypt.Decrypt(_XML.GetElement("DataBase", "User")); password = _XML.GetElement("DataBase", "Password"); // DEncrypt.DEncrypt.Decrypt(_XML.GetElement("DataBase", "Password")); } catch (Exception ex) { user = ""; password = ""; } SetConnectionString(server, database, user, password); } catch (Exception ex) { throw (ex); } }
public static string GetFilePath(string tag) { try { string xmlFile = System.Windows.Forms.Application.StartupPath + "\\Setting.xml"; if (!System.IO.File.Exists(xmlFile)) { throw (new Exception("配置文件不存在")); } myXML _XML = new myXML(xmlFile); string filepath = ""; try { filepath = _XML.GetElement("FilePath", tag); } catch (Exception ex) { throw (new Exception("配置文件内未配置该地址")); } return(filepath); } catch (Exception ex) { throw (ex); } }
public string SetConnectionString() { try { string xmlFile = System.Windows.Forms.Application.StartupPath + "\\Setting.xml"; if (!System.IO.File.Exists(xmlFile)) { throw (new Exception("配置文件不存在")); } myXML _XML = new myXML(xmlFile); string ServiceURL = _XML.GetElement("MapServices", "IP"); ServiceURL += " "; ServiceURL += _XML.GetElement("MapServices", "serverName"); return(ServiceURL); } catch (Exception ex) { throw (ex); } }