using arookas.IO.Binary; using System.Collections; using System.Collections.Generic; namespace arookas { class sunDataTable : IEnumerable { List data = new List(10); public int Count { get { return data.Count; } } public int Add(string value) { int index = data.IndexOf(value); if (index < 0) { index = data.Count; data.Add(value); } return index; } public void Clear() { data.Clear(); } public void Write(aBinaryWriter writer) { int ofs = 0; foreach (var value in this) { writer.WriteS32(ofs); ofs += value.Length + 1; // include terminator } foreach (var value in this) { writer.WriteString(value, aBinaryStringFormat.NullTerminated); } } public IEnumerator GetEnumerator() { return data.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }