Пример #1
0
        public static HardwareDoc LoadObj()
        {
            HardwareDoc   pDoc;
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(HardwareDoc));
            FileStream    fsReader      = null;

            try
            {
                fsReader = File.OpenRead(@".//Parameter/Hardware/HardwareDoc" + ".xml");
                pDoc     = (HardwareDoc)xmlSerializer.Deserialize(fsReader);
                fsReader.Close();
                pDoc.dicHardwareData = pDoc.listHardwareData.ToDictionary(p => p.Name);

                foreach (HardwareData item in pDoc.listHardwareData)
                {
                    item.DataInit();
                }
            }
            catch// (Exception eMy)
            {
                if (fsReader != null)
                {
                    fsReader.Close();
                }
                pDoc = new HardwareDoc();
            }
            return(pDoc);
        }
Пример #2
0
 public static void LoadDoc()
 {
     docHardware = HardwareDoc.LoadObj();
 }