Example #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();
            }
        }
Example #2
0
 public bool Connect(PSDDevice psdDevice)
 {
     var connected = psdDevice.Connect();
     if (connected)
     {
         Psd = psdDevice;
         Name = Psd.ToString();
         Base = new Base();
     }
     else
         Psd = null;
     return connected;
 }
Example #3
0
 public SetPsdResult Connect(PSDDevice psdDevice)
 {
     var connected = psdDevice.Connect();
     if (connected)
     {
         Psd = psdDevice;
         Name = Psd.ToString();
         Base = new Base();
         if (!Psd.Login(LoginPass))
             return SetPsdResult.WrongPassword;
     }
     else
         Psd = null;
     return connected ? SetPsdResult.Connected : SetPsdResult.NotConnected;
 }
 public Base ConvertToPSD()
 {
     Base resBase = new Base();
     resBase.PassGroup = new PwGroupConverter(_kpBase.RootGroup).ConvertToPSD();
     return resBase;
 }
Example #5
0
 public static string Serialize(Base passwordsBase)
 {
     return JsonConvert.SerializeObject(passwordsBase);
 }
Example #6
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;
        }
Example #7
0
 public bool Create(string path)
 {
     Base = new Base();
     return SaveAs(path);
 }
Example #8
0
 public static string Serialize(Base passwordsList)
 {
     return JSONWorker.Serialize(passwordsList);
 }