Пример #1
0
        public bool Save()
        {
            try
            {
                if (_license == null)
                {
                    return(false);
                }

                using (StreamWriter sw = File.CreateText(FileName))
                {
                    DataCrypto dc     = new DataCrypto();
                    string     xmlstr = _license.ToXMLString();
                    sw.Write(dc.Encrypto(XMLHeader + xmlstr));
                    //sw.Write(XMLHeader + xmlstr);
                }

                _lastError = null;
                return(true);
            }
            catch (Exception err)
            {
                _lastError = err;
                return(false);
            }
        }
Пример #2
0
        public bool Load()
        {
            try
            {
                using (StreamReader sr = File.OpenText(FileName))
                {
                    //string xmlstr = sr.ReadToEnd();
                    DataCrypto dc     = new DataCrypto();
                    string     xmlstr = dc.Decrypto(sr.ReadToEnd());
                    _license = XObjectManager.CreateObject(xmlstr, typeof(GWLicense)) as GWLicense;
                }

                _lastError = null;
                return(_license != null);
            }
            catch (Exception err)
            {
                _lastError = err;
                return(false);
            }
        }