public void InitializeTestLab()
 {
     SetDefaultFileLocations();
     File.Delete(settings.FileLocations.Favorites);
     this.Persistence = new FilePersistence();
     this.Persistence.Initialize();
 }
Example #2
0
 internal Favorites(FilePersistence persistence)
 {
     this.persistence = persistence;
     this.dispatcher = persistence.Dispatcher;
     this.groups = this.persistence.GroupsStore;
     this.cache = new Dictionary<Guid,IFavorite>();
 }
Example #3
0
        /// <summary>
        ///     Fall back to file persistence, in case of not available database
        /// </summary>
        private FilePersistence FallBackToPrimaryPersistence(PersistenceSecurity security)
        {
            Logging.Fatal("SQL Persistence layer failed to load. Fall back to File persistence");
            var newSecurity = new PersistenceSecurity(security);
            var persistence = new FilePersistence(newSecurity, this.favoriteIcons, this.connectionManager);

            this.settings.PersistenceSecurity = newSecurity;
            return(persistence);
        }
 /// <summary>
 /// Fall back to file persistence, in case of not available database
 /// </summary>
 internal static void FallBackToPrimaryPersistence(PersistenceSecurity security)
 {
     PromptForFallback();
     var newSecurity = new PersistenceSecurity(security);
     var persistence = new FilePersistence(newSecurity);
     Settings.Instance.PersistenceSecurity = newSecurity;
     Nested.instance.persistence = persistence;
     persistence.Initialize();
 }
Example #5
0
 internal Favorites(FilePersistence persistence, FavoriteIcons favoriteIcons, ConnectionManager connectionManager)
 {
     this.persistence       = persistence;
     this.favoriteIcons     = favoriteIcons;
     this.connectionManager = connectionManager;
     this.dispatcher        = persistence.Dispatcher;
     this.groups            = this.persistence.GroupsStore;
     this.cache             = new Dictionary <Guid, IFavorite>();
     this.batchUpdates      = new FavoriteBatchUpdates(persistence);
 }
Example #6
0
        /// <summary>
        /// Fall back to file persistence, in case of not available database
        /// </summary>
        internal FilePersistence FallBackToPrimaryPersistence(PersistenceSecurity security)
        {
            Logging.Fatal("SQL Persistence layer failed to load. Fall back to File persistence");
            var newSecurity = new PersistenceSecurity(security);
            var persistence = new FilePersistence(newSecurity, favoriteIcons, connectionManager);

            settings.PersistenceSecurity = newSecurity;
            persistence.Initialize();
            return(persistence);
        }
 public void SaveLoadNotesTest()
 {
     IFavorite favorite = this.AddFavorite();
     const string SPECIAL_CHARACTERS = "čočka\r\nčočka"; // some example special characters
     favorite.Notes = SPECIAL_CHARACTERS;
     this.Persistence.Favorites.Update(favorite);
     var secondary = new FilePersistence();
     secondary.Initialize();
     IFavorite checkfavorite = secondary.Favorites.FirstOrDefault();
     Assert.AreEqual(SPECIAL_CHARACTERS, checkfavorite.Notes, "favorite notes were not saved properly");
 }
Example #8
0
 internal Groups(FilePersistence persistence)
 {
     this.persistence = persistence;
     this.dispatcher = persistence.Dispatcher;
     this.cache = new Dictionary<Guid,IGroup>();
 }
 private IPersistence RunUpgrade()
 {
     var persistence = new FilePersistence();
     var contentUpgrade = new FilesV2ContentUpgrade(persistence, GetMasterPassword);
     contentUpgrade.Run();
     settings.ForceReload(); // because we changed its file, while upgrading
     return persistence;
 }
Example #10
0
 private static IGroup GetFromSecondaryPersistence()
 {
     var secondaryPersistence = new FilePersistence();
     secondaryPersistence.Initialize();
     return secondaryPersistence.Groups[GROUP_NAME2];
 }
Example #11
0
 internal Groups(FilePersistence persistence)
 {
     this.persistence = persistence;
     this.dispatcher  = persistence.Dispatcher;
     this.cache       = new Dictionary <Guid, IGroup>();
 }
 private FilePersistence InitializeSecondaryPersistence(TestFileWatch testFileWatch)
 {
     var secondaryPersistence = new FilePersistence(new PersistenceSecurity(), testFileWatch);
     // let the persistence load initial state
     secondaryPersistence.Initialize();
     secondaryPersistence.Dispatcher.FavoritesChanged += this.DispatcherOnFavoritesChanged;
     secondaryPersistence.Dispatcher.GroupsChanged += this.DispatcherOnGroupsChanged;
     return secondaryPersistence;
 }