Exemplo n.º 1
0
        public String GetVaultAsJson()
        {
            var obj = new SecureVaultObject <String>
            {
                Created = DateTime.Now,
                Objects = _vaultObjects
            };

            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

            return(jsonString);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the vault from disk using given FileName;
        /// </summary>
        public void Load()
        {
            ValidateFileName();

            if (!System.IO.File.Exists(FullFileName))
            {
                throw new ArgumentException($"File '{FullFileName}' not found");
            }

            string contents = System.IO.File.ReadAllText(FullFileName);
            SecureVaultObject <String> svo =
                Newtonsoft.Json.JsonConvert.DeserializeObject <SecureVaultObject <String> >(contents);

            _vaultObjects = svo.Objects;
        }