PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/gui (windows)/GUI/CoreSettings.cs

https://github.com/Steeslice/StealthNet-Alt
C# | 55 lines | 33 code | 9 blank | 13 comment | 6 complexity | c0c15f41e3656d5d8724fc112a3d2eb8 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-2.1
  1. //StealthNet
  2. //Copyright (C) 2009 Lars Regensburger, Roland Moch, T.Norad
  3. //This program is free software; you can redistribute it and/or
  4. //modify it under the terms of the GNU General Public License
  5. //as published by the Free Software Foundation; either version 2
  6. //of the License, or (at your option) any later version.
  7. //This program is distributed in the hope that it will be useful,
  8. //but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. //GNU General Public License for more details.
  11. //You should have received a copy of the GNU General Public License
  12. //along with this program; if not, write to the Free Software
  13. //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. using System;
  15. namespace Regensburger.RShare
  16. {
  17. public sealed class CoreSettings
  18. : ICoreSettings
  19. {
  20. public string this[string propertyName]
  21. {
  22. get
  23. {
  24. if (propertyName == null)
  25. throw new ArgumentNullException("propertyName");
  26. return Properties.Settings.Default[propertyName].ToString();
  27. }
  28. set
  29. {
  30. if (propertyName == null)
  31. throw new ArgumentNullException("propertyName");
  32. if (value == null)
  33. throw new ArgumentNullException("value");
  34. Properties.Settings.Default[propertyName] = value;
  35. }
  36. }
  37. public void Save()
  38. {
  39. Properties.Settings.Default.Save();
  40. }
  41. public void Upgrade()
  42. {
  43. Properties.Settings.Default.Upgrade();
  44. }
  45. }
  46. }