public static DataDoc LoadObj() { DataDoc pDoc = null; FileStream fs = null; try { fs = File.OpenRead(@".//Parameter/Data/SystemData.xml"); XmlSerializer xml = new XmlSerializer(typeof(DataDoc)); pDoc = (DataDoc)xml.Deserialize(fs); fs.Close(); pDoc.dicDataGroup = pDoc.listDataGroup.ToDictionary(p => p.strGroupName); foreach (DataGroup item in pDoc.listDataGroup) { item.dicDataItem = item.listDataItem.ToDictionary(p => p.strItemName); } } catch (Exception) { if (null != fs) { fs.Close(); } pDoc = new DataDoc(); } return(pDoc); }
public static void LoadData() { docData = DataDoc.LoadObj(); }