public void MoveSQFolder(string pathTo) { SQLiteRepositoryDAO repoDao = new SQLiteRepositoryDAO(); LocalRepository repo = repoDao.RootRepo(); PhysicalRepositoryController controller = new PhysicalRepositoryController(repo); KillSynchronizers(); controller.MoveDir(repo.Path, pathTo); repo.Path = pathTo; repoDao.Update(repo); InitializeSynchronizers(false); Program.Controller.Alert("SQFolder moved to "+ pathTo); }
public void InitializeSynchronizers(bool recovery = false) { if (recovery) { repo.Recovering = true; SQLiteRepositoryDAO dao = new SQLiteRepositoryDAO(); dao.Update(repo); } if (recovery || repo.Recovering) { SQLiteEventDAO eventDao = new SQLiteEventDAO(this.repo); eventDao.RemoveAllUnsynchronized(); recoverySynchronizer.Start(); } else { recoverySynchronizer.Skip(); } localSynchronizer.Start (); remoteSynchronizer.Start (); synchronizerResolver.Start(); }
public void InitializeSynchronizers(bool initRecovery = false) { SQLiteRepositoryDAO repoDAO = new SQLiteRepositoryDAO(); LocalRepository repo = repoDAO.FindOrCreateByRootName(RuntimeSettings.HomePath); if (initRecovery || repo.Recovering) { initRecovery = true; repo.Recovering = true; repoDAO.Update(repo); } Thread.Sleep(5000); Thread startSync; startSync = new Thread(delegate() { try { Logger.LogInfo("INFO", "Initializing Synchronizers!"); synchronizerResolver = SynchronizerResolver.GetInstance(); recoverySynchronizer = RecoverySynchronizer.GetInstance(); remoteSynchronizer = RemoteEventsSynchronizer.GetInstance(); localSynchronizer = LocalEventsSynchronizer.GetInstance(); if (initRecovery) { recoverySynchronizer.Start(); while (!((RecoverySynchronizer)recoverySynchronizer).StartedSync) Thread.Sleep(1000); synchronizerResolver.Start(); while (!recoverySynchronizer.FinishedSync) { Thread.Sleep(1000); } } else { synchronizerResolver.Start(); } localSynchronizer.Start(); remoteSynchronizer.Start(); loadedSynchronizers = true; Logger.LogInfo("INFO", "Synchronizers Ready!"); if (initRecovery || repo.Recovering) { repo.Recovering = false; repoDAO.Update(repo); } ErrorType = ERROR_TYPE.NULL; OnIdle(); } catch (Exception e) { Console.WriteLine(e.Message); } }); startSync.Start(); }