private void init(string path) { types = new Hashtable(); enums = new Hashtable(); fields = new Hashtable(); TypeDictionaryBase.readFile("..\\..\\Dictionary\\types.txt", types); EnumDictionaryBase.readFile("..\\..\\Dictionary\\enums.txt", enums); TypeDictionaryBase.readFile("Dictionary\\types.txt", types); EnumDictionaryBase.readFile("Dictionary\\enums.txt", enums); FieldDictionaryBase.readFile("Dictionary\\fields.txt", fields); TypeDictionaryBase.readFolder(path + "\\Data Dictionary\\Extended Data Types", types); EnumDictionaryBase.readFolder(path + "\\Data Dictionary\\Base Enums", enums); FieldDictionaryBase.readFolder(path + "\\Data Dictionary\\Tables", fields); }
static public void readFolder(string path, Hashtable collection) { if (Directory.Exists(path)) { string[] files = System.IO.Directory.GetFiles(path, "*.xpo"); foreach (string file in files) { string name = file.Substring(path.Length + 1, file.Length - path.Length - 5); EnumDictionaryBase d = new EnumDictionaryBase(); d.Name = name; if (!collection.ContainsKey(d.Key)) { collection.Add(d.Key, d); } } } }
static public void readFile(string filename, Hashtable collection) { if (File.Exists(filename)) { using (StreamReader reader = new StreamReader(filename)) { string line = reader.ReadLine(); while (line != null) { EnumDictionaryBase d = new EnumDictionaryBase(); string[] values = line.Split(';'); d.Name = values[0]; if (!collection.ContainsKey(d.Key)) { collection.Add(d.Key, d); } line = reader.ReadLine(); } } } }