Esempio n. 1
0
        public static string Serialize(Base passwordsList)
        {
            using (StringWriter textWriter = new StringWriter())
            {
                XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
                ns.Add("", "");

                XmlSerializer serializer = new XmlSerializer(typeof(Base));
                serializer.Serialize(textWriter, passwordsList, ns);
                return textWriter.ToString();
            }
        }
Esempio n. 2
0
 public static string Serialize(Base passwordsBase)
 {
     return JsonConvert.SerializeObject(passwordsBase);
 }
Esempio n. 3
0
 public static string Serialize(Base passwordsList)
 {
     return JSONWorker.Serialize(passwordsList);
 }
Esempio n. 4
0
 public bool Create(string path)
 {
     Base = new Base();
     return SaveAs(path);
 }
Esempio n. 5
0
        private bool MapData()
        {
            Base = new Base();
            byte[] dataBytes = ReadAllBytes();

            string dataStr;
            if (EncryptionKey != null)//decrypt
            {
                CryptoBase crypto = new CryptoBase(EncryptionKey);
                if (dataBytes.Length < CryptoBase.IVLength)
                    return false;
                if (!crypto.DecryptAll(dataBytes, out dataStr))
                    return false;
            }
            else
            {
                if (dataBytes.Length == 0)
                    return false;
                dataStr = Encoding.ASCII.GetString(dataBytes);
            }

            Base = Serializer.Deserialize(dataStr);
            return true;
        }