@@ -12,35 +12,35 @@ public class SettingsDictionary : IDictionary<string, string>
1212 private readonly IDictionary < string , string > _dict ;
1313 private readonly string _settingsPath ;
1414 private XDocument _settings ;
15-
15+ private string nameVariable = "StringVariable" ;
1616 public SettingsDictionary ( string settingsPath )
1717 {
1818 _settingsPath = settingsPath ;
1919 _settings = XDocument . Load ( _settingsPath ) ;
2020
21- _dict = _settings . Root . Descendants ( "StringVariable" ) . ToDictionary (
21+ _dict = _settings . Root . Descendants ( nameVariable ) . ToDictionary (
2222 v => v . Attribute ( "name" ) . Value ,
2323 v => v . Attribute ( "value" ) . Value ) ;
2424 }
2525
2626 private void SetVariable ( string name , string value )
2727 {
28- var variable = _settings . Root . Descendants ( "StringVariable" ) . Where ( x => x . Attribute ( "name" ) . Value == name ) . FirstOrDefault ( ) ;
28+ var variable = _settings . Root . Descendants ( nameVariable ) . Where ( x => x . Attribute ( "name" ) . Value == name ) . FirstOrDefault ( ) ;
2929 if ( variable != null )
3030 {
3131 variable . Attribute ( "value" ) . Value = value . ToString ( ) ;
3232 }
3333 else
3434 {
3535 _settings . Root . Descendants ( "Variables" ) . First ( ) . Add (
36- new XElement ( "StringVariable" , new XAttribute ( "name" , name ) , new XAttribute ( "value" , value ) ) ) ;
36+ new XElement ( nameVariable , new XAttribute ( "name" , name ) , new XAttribute ( "value" , value ) ) ) ;
3737 }
3838 _settings . Save ( _settingsPath ) ;
3939 }
4040
4141 private void RemoveVariable ( string name )
4242 {
43- var variable = _settings . Root . Descendants ( "StringVariable" ) . Where ( x => x . Attribute ( "name" ) . Value == name ) . FirstOrDefault ( ) ;
43+ var variable = _settings . Root . Descendants ( nameVariable ) . Where ( x => x . Attribute ( "name" ) . Value == name ) . FirstOrDefault ( ) ;
4444 if ( variable != null )
4545 {
4646 variable . Remove ( ) ;
@@ -50,7 +50,7 @@ private void RemoveVariable(string name)
5050
5151 private void ClearVariables ( )
5252 {
53- var variables = _settings . Root . Descendants ( "StringVariable" ) ;
53+ var variables = _settings . Root . Descendants ( nameVariable ) ;
5454 foreach ( var variable in variables )
5555 {
5656 variable . Remove ( ) ;
0 commit comments