#region ================== Namespaces using System; using System.Collections.Generic; using CodeImp.DoomBuilder.Rendering; #endregion namespace CodeImp.DoomBuilder.Data { internal class CvarsCollection { #region ================== Variables internal readonly Dictionary Integers; internal readonly Dictionary Floats; internal readonly Dictionary Colors; internal readonly Dictionary Booleans; internal readonly Dictionary Strings; internal readonly HashSet AllNames; #endregion #region ================== Constructor public CvarsCollection() { Integers = new Dictionary(StringComparer.OrdinalIgnoreCase); Floats = new Dictionary(StringComparer.OrdinalIgnoreCase); Colors = new Dictionary(StringComparer.OrdinalIgnoreCase); Booleans = new Dictionary(StringComparer.OrdinalIgnoreCase); Strings = new Dictionary(StringComparer.OrdinalIgnoreCase); AllNames = new HashSet(StringComparer.OrdinalIgnoreCase); } #endregion #region ================== Methods public bool AddValue(string name, int value) { if(AllNames.Contains(name)) return false; AllNames.Add(name); Integers.Add(name, value); return true; } public bool AddValue(string name, float value) { if(AllNames.Contains(name)) return false; AllNames.Add(name); Floats.Add(name, value); return true; } public bool AddValue(string name, PixelColor value) { if(AllNames.Contains(name)) return false; AllNames.Add(name); Colors.Add(name, value); return true; } public bool AddValue(string name, bool value) { if(AllNames.Contains(name)) return false; AllNames.Add(name); Booleans.Add(name, value); return true; } public bool AddValue(string name, string value) { if(AllNames.Contains(name)) return false; AllNames.Add(name); Strings.Add(name, value); return true; } #endregion } }