public override void Install(IDictionary stateSaver) { try { base.Install(stateSaver); string dir = this.Context.Parameters["dir"]; Directory.SetCurrentDirectory(dir); string formType = this.Context.Parameters["formType"]; //类型1为计量站,2为验票站 string systemName = this.Context.Parameters["systemName"]; //系统名称 string customerName = this.Context.Parameters["customerName"];//打印报表时前面的名称 string taxObject = this.Context.Parameters["tax"];//规费计算 if (taxObject != "2") { taxObject = "1"; } string ip = this.Context.Parameters["ip"];//消息队列服务器IP RWini rw = new RWini(); rw.inipath = dir + "\\Settings.ini"; bool r = rw.ExistINIFile(); rw.IniWriteValue("SysInfo", "FormType",formType); rw.IniWriteValue("SysInfo", "SystemName",systemName); rw.IniWriteValue("SysInfo", "CustomerName",customerName); //System.Diagnostics.Debugger.Launch(); XmlDocument doc = new XmlDocument(); doc.Load(dir + "\\CoalTraffic.exe.config"); foreach (System.Xml.XmlNode node in doc["configuration"]["appSettings"]) { if (node.Name == "add") { if (node.Attributes.GetNamedItem("key").Value == "TaxObject") { node.Attributes.GetNamedItem("value").Value = taxObject; } } } foreach (System.Xml.XmlNode node in doc["configuration"]["system.serviceModel"]["client"]) { if (node.Name == "endpoint") { node.Attributes.GetNamedItem("address").Value = "net.msmq://" + ip + "/private/CTOSMessagingQueue"; } } doc.Save(dir + "\\CoalTraffic.exe.config"); } catch(Exception ex) { Log.WriteLog(ex); } }