Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
    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);
            }
        }
    }
Exemplo n.º 3
0
        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);
            }
        }