protected virtual void ParsePropertyReader(IConfigPropertiesReader reader) { char[] equals = { '=' }; string line = reader.ReadLine(); int lineNumber = 0; while (line != null) { if (!IsCommentOrEmptyLine(line)) { string[] keyValuePair = line.Split(equals, 2); AssertKeyValuePairsAreValid(keyValuePair, lineNumber); string key = keyValuePair[0].Trim(); string val = keyValuePair[1].Trim(); if (ContainsKey(key)) { Remove(key); } Add(key, val); } line = reader.ReadLine(); lineNumber++; } }
public ConfigPropertiesCollection AddPropertiesFromReader(IConfigPropertiesReader reader) { if (reader == null) { throw new ArgumentNullException("reader", "The ConfigPropertiesReader cannot be null"); } ParsePropertyReader(reader); return(this); }