/// <summary> /// Salva a alteração no arquivo de configuração do serviço /// </summary> /// <param name="objService">ObjServiceTrocaXMLConfig</param> public void SaveConfigService(ObjServiceTrocaXMLConfig objService) { ObjServiceTrocaXMLConfig objServiceBkp = GetConfigService; objServiceBkp.connectionStrings.add.connectionString = objService.connectionStrings.add.connectionString; objServiceBkp.systemServiceModel.client.endpoint.address = objService.systemServiceModel.client.endpoint.address; objServiceBkp.appSettings.add = objService.appSettings.add; SerializeXml <ObjServiceTrocaXMLConfig> serializa = new SerializeXml <ObjServiceTrocaXMLConfig>(); string objSerializado = serializa.serializeXmlForGTE(objServiceBkp); using (StreamWriter writer = new StreamWriter("ServiceTrocaXML.exe.config", false)) { writer.WriteLine(objSerializado); } }
private ObjServiceTrocaXMLConfig GetObj() { ConnectionString conString = new ConnectionString(); AddConnectionString addConnectionString = new AddConnectionString(); addConnectionString.connectionString = GetStringConnection(); conString.add = addConnectionString; SystemServiceModel systemServiceModel = new SystemServiceModel(); ClientServiceModel client = new ClientServiceModel(); EndpontClient endpointClient = new EndpontClient(); endpointClient.address = txtPathWebService.Text; client.endpoint = endpointClient; systemServiceModel.client = client; AppSetting appSettings = new AppSetting(); AddAppSetting saveXML = new AddAppSetting(); AddAppSetting log = new AddAppSetting(); AddAppSetting delay = new AddAppSetting(); saveXML.key = Option.SAVE_XML; saveXML.value = (cbSaveXML.Checked ? "1" : "0"); log.key = Option.PATH_LOG; log.value = txtPathLog.Text; delay.key = Option.DELAY_PROCCESS; delay.value = txtDelayProcess.Text; List <AddAppSetting> listaApp = new List <AddAppSetting>(); listaApp.Add(saveXML); listaApp.Add(log); listaApp.Add(delay); appSettings.add = listaApp; ObjServiceTrocaXMLConfig objSalve = new ObjServiceTrocaXMLConfig(); objSalve.connectionStrings = conString; objSalve.systemServiceModel = systemServiceModel; objSalve.appSettings = appSettings; return(objSalve); }