/// <summary> /// 载入参数 /// </summary> public void LoadData() { FileStream myFileStream = null; try { //DebugHelper.Write("加载系统配置参数。。。"); XmlSerializer mySerializer = new XmlSerializer(typeof(AppSettingInfo)); myFileStream = new FileStream(XmlFile, FileMode.Open); appsettinginfo = (AppSettingInfo)mySerializer.Deserialize(myFileStream); myFileStream.Close(); } catch (Exception err) { //DebugHelper.Write(err); appsettinginfo = GetDefaultValue(); } finally { if (myFileStream != null) { myFileStream.Close(); } } }
/// <summary> /// 设置默认参数值 /// </summary> /// <returns></returns> private AppSettingInfo GetDefaultValue() { AppSettingInfo l = new AppSettingInfo(); l.Key = Guid.NewGuid().ToString(); return l; }