private bool loadRecord()
        {
            var raw = readRawData();

            if (raw != null)
            {
                byte[] cipher = Convert.FromBase64String(raw);

                using (Stream stream = new MemoryStream(cipher))
                {
                    var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                    accountRecords = (AccountRecords)bformatter.Deserialize(stream);
                }
            }
            accRecInit();

            return(true);
        }
        private void accRecInit()
        {
            if (accountRecords == null)
            {
                accountRecords = new AccountRecords();
            }

            if (accountRecords.accountList == null)
            {
                accountRecords.accountList = new List <string>();
            }
            if (accountRecords.passwdList == null)
            {
                accountRecords.passwdList = new List <string>();
            }
            if (accountRecords.methodList == null)
            {
                accountRecords.methodList = new List <int>();
            }
        }
Example #3
0
        public bool importRecord(string raw)
        {
            try
            {
                byte[] cipher = Convert.FromBase64String(raw);

                using (Stream stream = new MemoryStream(cipher))
                {
                    var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                    accountRecords = (AccountRecords)bformatter.Deserialize(stream);
                }
                accRecInit();
                storeRecord();
            }
            catch
            {
                return(false);
            }

            return(true);
        }