Exemplo n.º 1
0
        public void AddNewRecord()
        {
            var openData = new OpenCryptoKeysData()
            {
                CanTrade = CanTrade, CanWithdraw = CanWithdraw, IPs = IPs, Passphrase = Passphrase
            };

            if (UseExpireDate)
            {
                openData.ExpireDate = ExpireDate;
            }
            var encrypted = EncryptedRecordDataModel <OpenCryptoKeysData> .Create(EncryptedDictionary, Display, Key ?? string.Empty, Secret ?? string.Empty, openData);

            Records.Add(encrypted);
            if (EncryptedDictionary.KeyPassword != null)
            {
                EncryptedDictionary.EncryptAll();
                EncryptedDictionary.Save(FilenameSecret);
                OpenRecords.Add(new OpenRecordDataModel <OpenCryptoKeysData>()
                {
                    Display = Display, PairingKey = encrypted.PairingKey, OpenData = openData
                });
                SaveOpenRecords(FilenameOpen);
            }

            Display       = Key = Secret = Passphrase = IPs = null;
            UseExpireDate = CanTrade = CanWithdraw = false;
            foreach (var value in new string[] { nameof(Display), nameof(Key), nameof(Secret), nameof(Passphrase), nameof(IPs),
                                                 nameof(UseExpireDate), nameof(CanTrade), nameof(CanWithdraw) })
            {
                PropertyChanged(this, new PropertyChangedEventArgs(value));
            }
        }
Exemplo n.º 2
0
        public void AddNewRecord()
        {
            var encrypted = EncryptedRecordDataModel <object> .Create(EncryptedDictionary, Display, Key ?? string.Empty, Secret ?? string.Empty, null);

            Records.Add(encrypted);
            if (EncryptedDictionary.KeyPassword != null)
            {
                EncryptedDictionary.EncryptAll();
                EncryptedDictionary.Save("secrets.json");
                OpenRecords.Add(new OpenRecordDataModel <object>()
                {
                    Display = Display, PairingKey = encrypted.PairingKey
                });
                SaveOpenRecords("open_data.json");
            }

            Display = Key = Secret = null;
            foreach (var value in new string[] { nameof(Display), nameof(Key), nameof(Secret) })
            {
                PropertyChanged(this, new PropertyChangedEventArgs(value));
            }
        }