public int CreateEnum(String name) { EnumCollection c; for (int i = 0; i < Collections.Count; i++) { c = Collections.ElementAt(i); if (c.Name == name) { return(i); } } c = new EnumCollection(name); Collections.Add(c); return(Collections.Count - 1); }
private void Load() { try { StreamReader reader = new StreamReader(Misc.Common.SaveFolder + Misc.Common.EnumConfigFile); while (reader.EndOfStream == false) { String s = reader.ReadLine(); String[] val = s.Split(Misc.Common.Whitespaces, StringSplitOptions.RemoveEmptyEntries); int index = CreateEnum(val[0]); EnumCollection c = Collections.ElementAt(index); for (int i = 1; i < val.GetLength(0); i++) { c.Values.Add(val[i]); } } } catch (FileNotFoundException) { Console.Out.WriteLine("File was not found. Creating default one"); } }