Ejemplo 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();
            }
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 5
0
 public static string Serialize(Base passwordsBase)
 {
     return JsonConvert.SerializeObject(passwordsBase);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 7
0
 public bool Create(string path)
 {
     Base = new Base();
     return SaveAs(path);
 }
Ejemplo n.º 8
0
 public static string Serialize(Base passwordsList)
 {
     return JSONWorker.Serialize(passwordsList);
 }