using System;
using System.Text;
using System.IO;
using System.Collections;
namespace System.util
{
///
/// Summary description for Properties.
///
public class Properties
{
private Hashtable _col;
private const string whiteSpaceChars = " \t\r\n\f";
private const string keyValueSeparators = "=: \t\r\n\f";
private const string strictKeyValueSeparators = "=:";
public Properties()
{
_col = new Hashtable();
}
public string Remove(string key) {
string retval = (string)_col[key];
_col.Remove(key);
return retval;
}
public IEnumerator GetEnumerator() {
return _col.GetEnumerator();
}
public bool ContainsKey(string key) {
return _col.ContainsKey(key);
}
public virtual void Add(string key, string value) {
_col[key] = value;
}
public void AddAll(Properties col) {
foreach (string itm in col.Keys) {
_col[itm] = col[itm];
}
}
public int Count {
get {
return _col.Count;
}
}
public virtual string this[string key] {
get {
return (string)_col[key];
}
set {
_col[key] = value;
}
}
public ICollection Keys {
get {
return _col.Keys;
}
}
public void Clear() {
_col.Clear();
}
public void Load(Stream inStream) {
StreamReader inp = new StreamReader(inStream, Encoding.GetEncoding(1252));
while (true) {
// Get next line
String line = inp.ReadLine();
if (line == null)
return;
if (line.Length > 0) {
// Find start of key
int len = line.Length;
int keyStart;
for (keyStart=0; keyStart= 0) && (line[index--] == '\\'))
slashCount++;
return (slashCount % 2 == 1);
}
}
}