public static void ReadManufacturerSettings(GXManufacturerCollection Manufacturers, String path) { Manufacturers.Clear(); if (Directory.Exists(path)) { Type[] extraTypes = new Type[] { typeof(GXManufacturerCollection), typeof(GXManufacturer), typeof(GXObisCodeCollection), typeof(GXObisCode), typeof(GXObisValueItem), typeof(GXObisValueItemCollection), typeof(GXDLMSAttribute), typeof(GXAttributeCollection) }; XmlSerializer x = new XmlSerializer(typeof(GXManufacturer), extraTypes); foreach (string it in Directory.GetFiles(path, "*.obx")) { using (Stream stream = File.Open(it, FileMode.Open)) { using (TextReader reader = new StreamReader(stream)) { try { GXManufacturer man = (GXManufacturer)x.Deserialize(reader); Manufacturers.Add(man); } catch (Exception Ex) { System.Diagnostics.Debug.WriteLine(Ex.Message); } } } } } }
public static void ReadManufacturerSettings(GXManufacturerCollection Manufacturers) { ReadManufacturerSettings(Manufacturers, ObisCodesPath); }