@@ -8,8 +8,8 @@ public partial class ConfigNode
88 public string Name { get ; set ; } = string . Empty ;
99 public ConfigNode Parent { get ; set ; }
1010
11- public MixedCollection < string , string > Values { get ; } = new MixedCollection < string , string > ( ) ;
12- public MixedCollection < string , ConfigNode > Nodes { get ; } = new MixedCollection < string , ConfigNode > ( ) ;
11+ public MixedCollection < string , string > Values { get ; private set ; } = new MixedCollection < string , string > ( ) ;
12+ public MixedCollection < string , ConfigNode > Nodes { get ; private set ; } = new MixedCollection < string , ConfigNode > ( ) ;
1313
1414 public int Depth => Parent ? . Depth + 1 ?? 0 ;
1515
@@ -26,14 +26,16 @@ public ConfigNode(string contents)
2626 {
2727 if ( line . Contains ( CfgNodeConstants . ValueSeparator ) )
2828 {
29- currentNode . CreateValue ( line . Substring ( 0 , line . IndexOf ( CfgNodeConstants . ValueSeparator , StringComparison . Ordinal ) ) . Trim ( ) ,
30- line . Substring ( line . LastIndexOf ( CfgNodeConstants . ValueSeparator , StringComparison . Ordinal ) + CfgNodeConstants . ValueSeparator . Length ) . Trim ( ) ) ;
29+ currentNode . CreateValue ( new CfgNodeValue < string , string > ( line . Substring ( 0 , line . IndexOf ( CfgNodeConstants . ValueSeparator , StringComparison . Ordinal ) ) . Trim ( ) ,
30+ line . Substring ( line . LastIndexOf ( CfgNodeConstants . ValueSeparator , StringComparison . Ordinal ) + CfgNodeConstants . ValueSeparator . Length ) . Trim ( ) ) ) ;
3131
3232 continue ;
3333 }
3434 if ( line . TrimEnd ( ) . Equals ( CfgNodeConstants . OpenNodeSymbol ) )
3535 {
36- currentNode = currentNode . CreateNode ( previousLine ) ;
36+ var newNode = new ConfigNode ( previousLine , this ) ;
37+ currentNode . AddNode ( newNode ) ;
38+ currentNode = newNode ;
3739 continue ;
3840 }
3941 if ( line . TrimEnd ( ) . Equals ( CfgNodeConstants . CloseNodeSymbol ) )
@@ -58,9 +60,9 @@ public bool IsEmpty()
5860 {
5961 return Values . IsEmpty ( ) && Nodes . IsEmpty ( ) ;
6062 }
61-
62- #region Base overrides
6363
64+ #region Base overrides
65+
6466 public override string ToString ( )
6567 {
6668 return CfgNodeWriter . WriteConfigNode ( this ) ;
0 commit comments