public static int EnsureEntry(string type, ImageFile icon, int id) { if (icon.Path.EndsWith("000000.tex")) { throw new ArgumentException("bad icon", "icon"); } var key = type + ", " + id; if (_entries.ContainsKey(key)) { return(id); } // New entries here! var entry = new IconEntry() { Type = type, Id = id, Icon = icon }; _entries[entry.Key] = entry; HasNewEntries = true; return(id); }
public static void Initialize() { var separator = new[] { ", " }; var text = File.ReadAllText("Supplemental\\icon-db.txt") .Replace("\r\n", "\n") .Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var line in text) { var parts = line.Split(separator, StringSplitOptions.None); var entry = new IconEntry() { Type = parts[0], Id = int.Parse(parts[1]) }; _entries[entry.Key] = entry; } }