public override bool Load() { lock (this) { if (!base.Load()) { return(false); } if (Config != null && Config.IsPasswordSecret == true) { DataCrypto dc = new DataCrypto(); Config.LoginUser = dc.Decrypto(Config.LoginUser); Config.LoginPassword = dc.Decrypto(Config.LoginPassword); Config.IsPasswordSecret = false; } return(true); } }
private void Init() { // 读取第一行版本信息 string version_line = stream_reader.ReadLine(); if (crypto) { version_line = dc.Decrypto(version_line); } string name = null, value = null; if (ParsePorperty(version_line, ref name, ref value)) { if (string.Compare(name, "version", true) == 0) { int.TryParse(value, out version); } } }
public bool Load() { try { using (StreamReader sr = File.OpenText(FileName)) { string xmlstr = sr.ReadToEnd(); if (EnabledCrypto) { xmlstr = _cry.Decrypto(xmlstr); } _config = XObjectManager.CreateObject <T>(xmlstr); } _lastError = XObjectManager.LastError; return(_config != null); } catch (Exception err) { _lastError = err; return(false); } }