Guest User

Untitled

a guest
Aug 11th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. Two Setups For Same Project (visual studio 2008 , c#)
  2. public void GetSettings()
  3. {
  4. string fileName = "./Names.xml";
  5.  
  6. if (File.Exists(fileName))
  7. {
  8. XmlTextReader xml = new XmlTextReader(fileName);
  9.  
  10. while (xml.Read())
  11. {
  12. if (xml.Name.Equals("pgsql"))
  13. {
  14. try
  15. {
  16. button2.Text = xml.GetAttribute("button2");
  17. button3.Text = xml.GetAttribute("button3");
  18. button4.Text = xml.GetAttribute("button4");
  19. button5.Text = xml.GetAttribute("button5");
  20. }
  21. catch (Exception)
  22. {
  23. throw new Exception("Settings: Failed to get all settings");
  24. }
  25. }
  26. }
  27. }
  28. else
  29. {
  30. throw new Exception("Settings: pgsql.xml not found!");
  31. }
  32. }
Add Comment
Please, Sign In to add comment