string logPath = AppDomain.CurrentDomain.BaseDirectory + "logs\\"; UpdateAppLogsSettings(logPath);
public void UpdateAppLogsSettings(string path) { bool bShowError = false; XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); if (xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[1].ChildNodes[0].ChildNodes[1].Attributes[2].Name == "initializeData") { string tempName = xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[1].ChildNodes[0].ChildNodes[1].Attributes[2].Value; xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[1].ChildNodes[0].ChildNodes[1].Attributes[2].Value = path + Path.GetFileName(tempName); } else bShowError = true; if (xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[2].ChildNodes[0].ChildNodes[1].Attributes[2].Name == "initializeData") { string tempName = xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[2].ChildNodes[0].ChildNodes[1].Attributes[2].Value; xmlDoc.DocumentElement["system.diagnostics"].ChildNodes[0].ChildNodes[2].ChildNodes[0].ChildNodes[1].Attributes[2].Value = path + Path.GetFileName(tempName); } else bShowError = true; if (!bShowError) { xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); System.Configuration.ConfigurationManager.RefreshSection("section/subSection"); } } catch (Exception) { bShowError = true; } if (bShowError) { tbResults.AppendText("************* ERROR ****************\n"); tbResults.AppendText("Could not relocate log files.\n"); tbResults.AppendText("************************************\n"); } return; } Yes, I know xml can be changed but do to the nature of my project it isn't one of my concerns. -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.