internal IPersistence AuthenticateByMasterPassword(IPersistence persistence, IStartupUi startupUi, string masterPasswordArg = null) { bool authenticated = persistence.Security.Authenticate(startupUi.KnowsUserPassword, masterPasswordArg); if (!authenticated) { startupUi.Exit(); } bool initialized = persistence.Initialize(); if (!initialized) { return(this.TryFallbackToPrimaryPersistence(persistence, startupUi)); } return(persistence); }
private IPersistence TryFallbackToPrimaryPersistence(IPersistence persistence, IStartupUi startupUi) { bool fallbackInitialized = false; IPersistence newPersistence = null; if (persistence.TypeId != FilePersistence.TYPE_ID && startupUi.UserWantsFallback()) { newPersistence = this.FallBackToPrimaryPersistence(persistence.Security); fallbackInitialized = newPersistence.Initialize(); } if (!fallbackInitialized) { startupUi.Exit(); } return(newPersistence); }
internal IPersistence AuthenticateByMasterPassword(IPersistence persistence, IStartupUi startupUi) { var authenticated = persistence.Security.Authenticate(startupUi.KnowsUserPassword); if (!authenticated) { startupUi.Exit(); } var initialized = persistence.Initialize(); if (!initialized) { return(this.TryFallbackToPrimaryPersistence(persistence, startupUi)); } return(persistence); }