public INIFile( [NotNull] Stream fileStream ) {
if ( fileStream == null )
throw new ArgumentNullException( "fileStream" );
StreamReader reader = new StreamReader( fileStream );
Dictionary<string, string> section = null;
while ( true ) {
string line = reader.ReadLine();
if ( line == null )
break;
line = line.Trim();
if ( line.StartsWith( "#" ) )
continue;
if ( line.StartsWith( "[" ) ) {
string sectionName = line.Substring( 1, line.IndexOf( ']' ) - 1 ).Trim().ToLower();
section = new Dictionary<string, string>();
contents.Add( sectionName, section );
} else if ( line.Contains( Separator ) && section != null ) {
string keyName = line.Substring( 0, line.IndexOf( Separator ) ).TrimEnd().ToLower();
string valueName = line.Substring( line.IndexOf( Separator ) + 1 ).TrimStart();
section.Add( keyName, valueName );
}
}
}