public SaveDb(Context ctx, IKp2aApp app, OnFinish finish, bool dontSave) : base(finish) { _ctx = ctx; _app = app; _dontSave = dontSave; }
public AfterUpdate(PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnFinish finish) : base(finish) { _backup = backup; _updatedEntry = updatedEntry; _app = app; }
public BuiltInFileStorage(IKp2aApp app) { _app = app; //use the obsolute CertificatePolicy because the ServerCertificateValidationCallback isn't called in Mono for Android (?) //ServicePointManager.CertificatePolicy = new CertificatePolicity(app); IOConnection.CertificateValidationCallback = app.CertificateValidationCallback; }
public DeleteEntry(Context ctx, IKp2aApp app, PwEntry entry, OnFinish finish) : base(finish, app) { Ctx = ctx; Db = app.GetDb(); _entry = entry; }
/// <summary> /// Constructor for sync /// </summary> /// <param name="ctx"></param> /// <param name="app"></param> /// <param name="finish"></param> /// <param name="dontSave"></param> /// <param name="streamForOrigFile">Stream for reading the data from the (changed) original location</param> public SaveDb(Context ctx, IKp2aApp app, OnFinish finish, bool dontSave, Stream streamForOrigFile) : base(finish) { _ctx = ctx; _app = app; _dontSave = dontSave; _streamForOrigFile = streamForOrigFile; }
public MoveElement(IStructureItem elementToMove, PwGroup targetGroup, Context ctx, IKp2aApp app, OnFinish finish) : base(finish) { _elementToMove = elementToMove; _targetGroup = targetGroup; _ctx = ctx; _app = app; }
public CreateDb(IKp2aApp app, Context ctx, IOConnectionInfo ioc, OnFinish finish, bool dontSave) : base(finish) { _ctx = ctx; _ioc = ioc; _dontSave = dontSave; _app = app; }
public UpdateEntry(Context ctx, IKp2aApp app, PwEntry oldE, PwEntry newE, OnFinish finish) : base(finish) { _ctx = ctx; _app = app; _onFinishToRun = new AfterUpdate(oldE, newE, app, finish); }
protected AddEntry(Context ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish) : base(finish) { _ctx = ctx; _parentGroup = parentGroup; _app = app; _entry = entry; _onFinishToRun = new AfterAdd(app.GetDb(), entry, OnFinishToRun); }
public LoadDb(IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, String keyfileOrProvider, OnFinish finish) : base(finish) { _app = app; _ioc = ioc; _databaseData = databaseData; _compositeKey = compositeKey; _keyfileOrProvider = keyfileOrProvider; _rememberKeyfile = app.GetBooleanPreference(PreferenceKey.remember_keyfile); }
public EditGroup(Context ctx, IKp2aApp app, String name, PwIcon iconid, PwUuid customIconId, PwGroup group, OnFinish finish) : base(finish) { _ctx = ctx; _name = name; _iconId = iconid; Group = group; _customIconId = customIconId; _app = app; _onFinishToRun = new AfterEdit(this, OnFinishToRun); }
private AddGroup(Context ctx, IKp2aApp app, String name, int iconid, PwGroup parent, OnFinish finish, bool dontSave) : base(finish) { _ctx = ctx; _name = name; _iconId = iconid; Parent = parent; DontSave = dontSave; _app = app; _onFinishToRun = new AfterAdd(this, OnFinishToRun); }
public ProgressTask(IKp2aApp app, Context ctx, RunnableOnFinish task) { _task = task; _handler = app.UiThreadHandler; _app = app; // Show process dialog _progressDialog = app.CreateProgressDialog(ctx); _progressDialog.SetTitle(_app.GetResourceString(UiStringKey.progress_title)); _progressDialog.SetMessage("Initializing..."); // Set code to run when this is finished _task.OnFinishToRun = new AfterTask(task.OnFinishToRun, _handler, _progressDialog); _task.SetStatusLogger(new ProgressDialogStatusLogger(_app, _handler, _progressDialog)); }
public static bool TrySaveDatabase(IKp2aApp app) { bool saveSuccesful = false; SaveDb save = new SaveDb(Application.Context, app, new ActionOnFinish((success, message) => { saveSuccesful = success; if (!success) { Kp2aLog.Log("Error during TestBase.SaveDatabase: " + message); } }), false); save.Run(); save.JoinWorkerThread(); return saveSuccesful; }
public static void Copy(IOConnectionInfo targetIoc, IOConnectionInfo sourceIoc, IKp2aApp app) { IFileStorage sourceStorage = app.GetFileStorage(sourceIoc, false); //don't cache source. file won't be used ever again IFileStorage targetStorage = app.GetFileStorage(targetIoc); using ( var writeTransaction = targetStorage.OpenWriteTransaction(targetIoc, app.GetBooleanPreference( PreferenceKey.UseFileTransactions))) { using (var writeStream = writeTransaction.OpenFile()) { sourceStorage.OpenFileForRead(sourceIoc).CopyTo(writeStream); } writeTransaction.CommitWrite(); } }
public SearchDbHelper(IKp2aApp app) { _app = app; }
public SkyDriveFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.SkyDriveFileStorage(ClientId, ctx), app) { }
public LegacyFtpStorage(IKp2aApp app) : base(app) { }
public DropboxFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.DropboxV2Storage(ctx, AppKey, AppSecret), app) { }
public static AddEntry GetInstance(Activity ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish) { return(new AddEntry(ctx, app, entry, parentGroup, finish)); }
public CheckDatabaseForChanges(Activity context, IKp2aApp app, OnFinish finish) : base(context, finish) { _context = context; _app = app; }
protected DeleteRunnable(Activity activity, OnFinish finish, IKp2aApp app) : base(activity, finish) { App = app; }
public GoogleDriveFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.GoogleDriveFileStorage(), app) { }
public MyCursorAdapter(FileSelectActivity activity, ICursor c, IKp2aApp app) : base(activity, c) { _activity = activity; _app = app; }
public AfterUpdate(Activity activity, PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnFinish finish) : base(activity, finish) { _backup = backup; _updatedEntry = updatedEntry; _app = app; }
public static bool ContainsAllTemplates(IKp2aApp app) { return(TemplateEntries.All(t => app.GetDb().Entries.ContainsKey(t.Uuid))); }
public DeleteMultipleItemsFromOneDatabase(Activity activity, Database db, List <IStructureItem> elementsToDelete, OnFinish finish, IKp2aApp app) : base(activity, finish, app) { _elementsToDelete = elementsToDelete; SetMembers(activity, db); //determine once. The property is queried for each delete operation, but might return false //after one entry/group is deleted (and thus in recycle bin and thus can't be recycled anymore) _canRecycle = DetermineCanRecycle(); ShowDatabaseIocInStatus = true; }
public static AddGroup GetInstance(Context ctx, IKp2aApp app, String name, int iconid, PwGroup parent, OnFinish finish, bool dontSave) { return new AddGroup(ctx, app, name, iconid, parent, finish, dontSave); }
public TestControllableSelectStorageLocationActivity(IKp2aApp app) : base(app) { _app = app; StartFileStorageSelection(RequestCodeFileStorageSelectionForPrimarySelect, true, false); }
public ExportDb(Activity activity, IKp2aApp app, OnFinish onFinish, FileFormatProvider fileFormat, IOConnectionInfo targetIoc) : base(activity, onFinish) { _app = app; this._fileFormat = fileFormat; _targetIoc = targetIoc; }
public JavaFileStorage(IJavaFileStorage jfs, IKp2aApp app) { _jfs = jfs; _app = app; }
public SynchronizeCachedDatabase(Context context, IKp2aApp app, OnFinish finish) : base(finish) { _context = context; _app = app; }
//creates a local ioc where the sourceIoc can be stored to public static IOConnectionInfo GetInternalIoc(IOConnectionInfo sourceIoc, Context ctx, IKp2aApp app) { Java.IO.File internalDirectory = IoUtil.GetInternalDirectory(ctx); var filestorage = app.GetFileStorage(sourceIoc); string targetPath = filestorage.GetFilenameWithoutPathAndExt(sourceIoc); targetPath = targetPath.Trim("|\\?*<\":>+[]/'".ToCharArray()); if (targetPath == "") { targetPath = "internal"; } if (new File(internalDirectory, targetPath).Exists()) { int c = 1; var ext = UrlUtil.GetExtension(targetPath); var filenameWithoutExt = UrlUtil.StripExtension(targetPath); do { c++; targetPath = filenameWithoutExt + c; if (!String.IsNullOrEmpty(ext)) { targetPath += "." + ext; } } while (new File(internalDirectory, targetPath).Exists()); } return(IOConnectionInfo.FromPath(new File(internalDirectory, targetPath).CanonicalPath)); }
public SynchronizeCachedDatabase(Context context, IKp2aApp app, OnFinish finish) : base(finish) { _context = context; _app = app; }
public DeleteEntry(Activity activiy, IKp2aApp app, PwEntry entry, OnFinish finish) : base(activiy, finish, app) { Ctx = activiy; Db = app.FindDatabaseForElement(entry); _entry = entry; }
public static IOConnectionInfo ImportFileToInternalDirectory(IOConnectionInfo sourceIoc, Context ctx, IKp2aApp app) { var targetIoc = GetInternalIoc(sourceIoc, ctx, app); IoUtil.Copy(targetIoc, sourceIoc, app); return(targetIoc); }
public GoogleDriveFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.GoogleDriveFileStorage(), app) { }
public SearchDbHelper(IKp2aApp app) { _app = app; }
public LocalFileStorage(IKp2aApp app) : base(app) { }
public DropboxFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.DropboxFileStorage(ctx, AppKey, AppSecret), app) { }
public LegacyWebDavStorage(IKp2aApp app) : base(app) { }
public OneDriveFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.OneDriveStorage(ctx, ClientId), app) { }
public MoveElements(List <IStructureItem> elementsToMove, PwGroup targetGroup, Activity ctx, IKp2aApp app, OnFinish finish) : base(ctx, finish) { _elementsToMove = elementsToMove; _targetGroup = targetGroup; _ctx = ctx; _app = app; }
public SelectStorageLocationActivityBase(IKp2aApp app) { _app = app; }
public ProgressDialogStatusLogger(IKp2aApp app, Handler handler, IProgressDialog pd) { _app = app; _progressDialog = pd; _handler = handler; }
public void TestLoadEditSaveWhenModified() { //create the default database: IKp2aApp app = SetupAppWithDefaultDatabase(); IOConnection.DeleteFile(new IOConnectionInfo { Path = DefaultFilename }); //save it and reload it so we have a base version SaveDatabase(app); app = LoadDatabase(DefaultFilename, DefaultPassword, DefaultKeyfile); foreach (var group in app.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("app c: " + group.Name); } //load once more: var app2 = LoadDatabase(DefaultFilename, DefaultPassword, DefaultKeyfile); //modifiy once: PwGroup group2 = new PwGroup(true, true, "TestGroup2", PwIcon.Apple); app2.GetDb().KpDatabase.RootGroup.AddGroup(group2, true); foreach (var group in app.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("app b: " + group.Name); } SaveDatabase(app2); _testCacheSupervisor.Reset(); foreach (var group in app.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("app d: " + group.Name); } Assert.IsNull(((TestKp2aApp)app).LastYesNoCancelQuestionTitle); _testCacheSupervisor.AssertNoCall(); //modify the database by adding a group: PwGroup group1 = new PwGroup(true, true, "TestGroup", PwIcon.Apple); app.GetDb().KpDatabase.RootGroup.AddGroup(group1, true); foreach (var group in app.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("app a: " + group.Name); } //save the database again: _testCacheSupervisor.Reset(); SaveDatabase(app); Assert.AreEqual(((TestKp2aApp)app).LastYesNoCancelQuestionTitle, UiStringKey.TitleSyncQuestion); _testCacheSupervisor.AssertNoCall(); //load database to a new app instance: IKp2aApp resultApp = LoadDatabase(DefaultFilename, DefaultPassword, DefaultKeyfile); app2.GetDb().KpDatabase.RootGroup.AddGroup(group1, true); foreach (var group in app.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("app: " + group.Name); } foreach (var group in resultApp.GetDb().KpDatabase.RootGroup.Groups) { Kp2aLog.Log("resultApp: " + group.Name); } //ensure the change was saved: AssertDatabasesAreEqual(app2.GetDb().KpDatabase, resultApp.GetDb().KpDatabase); }
public WebDavFileStorage(IKp2aApp app) : base(new Keepass2android.Javafilestorage.WebDavStorage(app.CertificateErrorHandler), app) { }
public SftpFileStorage(IKp2aApp app) : base(new Keepass2android.Javafilestorage.SftpStorage(), app) { }
public TestFileStorage(IKp2aApp app) { _builtIn = new BuiltInFileStorage(app); }
public Database(IDrawableFactory drawableFactory, IKp2aApp app) { DrawableFactory = drawableFactory; _app = app; CanWrite = true; //default }
public static void Copy(IOConnectionInfo targetIoc, IOConnectionInfo sourceIoc, IKp2aApp app) { IFileStorage sourceStorage = app.GetFileStorage(sourceIoc, false); //don't cache source. file won't be used ever again IFileStorage targetStorage = app.GetFileStorage(targetIoc); using ( var writeTransaction = targetStorage.OpenWriteTransaction(targetIoc, app.GetBooleanPreference( PreferenceKey.UseFileTransactions))) { using (var writeStream = writeTransaction.OpenFile()) { sourceStorage.OpenFileForRead(sourceIoc).CopyTo(writeStream); } writeTransaction.CommitWrite(); } }
protected DeleteRunnable(OnFinish finish, IKp2aApp app) : base(finish) { App = app; }
public SynchronizeCachedDatabase(Activity context, IKp2aApp app, OnFinish finish) : base(context, finish) { _context = context; _app = app; }
public AfterAdd(Activity activity, Database db, PwEntry entry, IKp2aApp app, OnFinish finish) : base(activity, finish) { _db = db; _entry = entry; _app = app; }
public KdbDatabaseFormat(IKp2aApp app) { _app = app; }
public static AddGroup GetInstance(Context ctx, IKp2aApp app, string name, int iconid, PwUuid groupCustomIconId, PwGroup parent, OnFinish finish, bool dontSave) { return(new AddGroup(ctx, app, name, iconid, groupCustomIconId, parent, finish, dontSave)); }
public ExportDb(IKp2aApp app, OnFinish onFinish, FileFormatProvider fileFormat, IOConnectionInfo targetIoc) : base(onFinish) { _app = app; this._fileFormat = fileFormat; _targetIoc = targetIoc; }
public ProgressDialogStatusLogger(IKp2aApp app, Handler handler, IProgressDialog pd) { _app = app; _progressDialog = pd; _handler = handler; }
public static AddEntry GetInstance(Context ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish) { return new AddEntry(ctx, app, entry, parentGroup, finish); }
public PCloudFileStorage(Context ctx, IKp2aApp app) : base(new Keepass2android.Javafilestorage.PCloudFileStorage(ctx, ClientId), app) { }