using UnityEngine; using System.IO; using System.Collections.Generic; using System; using System.Xml.Serialization; using AX.TrackRecord; public class GetRecordXml { /** * 单独的根据灾情和FileName来获取数据 */ private static GetRecordXml stance; public static GetRecordXml GetInstance() { if (stance == null) { stance = new GetRecordXml(); } return stance; } public Record_One_root LoadRecord_DeserializeXMLToRecord(string filename) { string path =ExamInfoHelpClass.CurrentWorkPath + filename; if (File.Exists(path)) { //反序列化XML StreamReader reader = new StreamReader(path); Record_One_root record = new Record_One_root(); XmlSerializer xml = new XmlSerializer(typeof(Record_One_root)); record = xml.Deserialize(reader) as Record_One_root; reader.Close(); //Debug.Log("LoadRecord_DeserializeXMLToRecord"); return record; } return null; } }