/// <summary> /// 反序列化 /// </summary> /// <param name="type">对象类型</param> /// <param name="filename">文件路径</param> /// <returns></returns> public static object Load(Type type, string path) { Stream stream = null; try { //stream = XOR.ReadAndDecrypt(path);//异或解密 stream = Utils.ReadFileToStream(path); XmlSerializer serializer = new XmlSerializer(type); return(serializer.Deserialize(stream)); } catch (Exception ex) { throw ex; } finally { if (stream != null) { stream.Close(); } } }