예제 #1
0
        private void OpenDataStore()
        {
            try
            {
                if (string.IsNullOrEmpty(Path) || string.IsNullOrEmpty(pwdBox.Password))
                {
                    throw new Exception("A path and password are required.");
                }
                else if (!Path.EndsWith(Extension))
                {
                    Path += Extension;
                }

                IDataStore ds = new SQLiteDataStore(Path, pwdBox.Password);
                ds.Open();

                DataStore = ds;

                pathHistory.AddItem(Path);
                settings.History = pathHistory.SerializeToString();
                settings.Save();

                Cancelled = false;
                openDatabaseWindow.Close();
            }
            catch (Exception e)
            {
                MessageBoxFactory.ShowError(e);
            }
        }
예제 #2
0
        private void Test()
        {
            IDataStore client = new SQLiteDataStore("test.db", "test", false);

            client.Open();

            var pwd = new PasswordItem()
            {
                Name = "test", Username = "******", Password = "******"
            };

            (var passwords, var entries) = GetData(client);

            client.AddPassword(pwd);
            client.AddEntry(new Entry()
            {
                Name = "test", CredentialId = pwd.ID
            });

            (passwords, entries) = GetData(client);

            client.DeletePassword(pwd);

            (passwords, entries) = GetData(client);
        }