/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new instance.
		/// </summary>
		/// <param name="useMemoryWsManager">if set to <c>true</c> a memory-based writing system
		/// manager will be used.</param>
		/// <param name="bulkLoadDomain">The domain to bulk load.</param>
		/// <param name="projectId">the project identification</param>
		/// ------------------------------------------------------------------------------------
		public BackendStartupParameter(bool useMemoryWsManager, BackendBulkLoadDomain bulkLoadDomain,
			IProjectIdentifier projectId)
		{
			m_useMemoryWsManager = useMemoryWsManager;
			m_bulkLoadDomain = bulkLoadDomain;
			m_projectId = projectId;
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Create a new instance.
 /// </summary>
 /// <param name="useMemoryWsManager">if set to <c>true</c> a memory-based writing system
 /// manager will be used.</param>
 /// <param name="bulkLoadDomain">The domain to bulk load.</param>
 /// <param name="projectId">the project identification</param>
 /// ------------------------------------------------------------------------------------
 public BackendStartupParameter(bool useMemoryWsManager, BackendBulkLoadDomain bulkLoadDomain,
                                IProjectIdentifier projectId)
 {
     m_useMemoryWsManager = useMemoryWsManager;
     m_bulkLoadDomain     = bulkLoadDomain;
     m_projectId          = projectId;
 }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the Paratext project, if any, that is associated with the specified FieldWorks
        /// project.
        /// </summary>
        /// <returns>The associated project, or null if there is none.</returns>
        /// ------------------------------------------------------------------------------------
        public static ScrText GetAssociatedProject(IProjectIdentifier projectId)
        {
            ScrText assocProj = s_ptHelper.GetProjects().FirstOrDefault(scrText =>
                                                                        scrText.AssociatedLexicalProject.ToString() == projectId.PipeHandle);

            s_ptHelper.ReloadProject(assocProj);
            return(assocProj);
        }
Esempio n. 4
0
        protected FdoCache BootstrapSystem(IProjectIdentifier projectId, BackendBulkLoadDomain loadType, FdoSettings settings)
        {
            var retval = m_internalRestart ? FdoCache.CreateCacheFromExistingData(projectId, "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories, settings, new DummyProgressDlg()) :
                         FdoCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories, settings);
            var dataSetup = retval.ServiceLocator.GetInstance <IDataSetup>();

            dataSetup.LoadDomain(loadType);
            return(retval);
        }
Esempio n. 5
0
        /// <summary>
        /// Actually create the system.
        /// Called by subclass overrides of CreateCache(), with parameters that suit
        /// the subclass.
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="loadType"></param>
        /// <returns>a working FdoCache</returns>
        protected FdoCache BootstrapSystem(IProjectIdentifier projectId, BackendBulkLoadDomain loadType)
        {
            // This thread helper will be disposed in FixtureTeardown along with the cache.
            var retval = m_internalRestart ? FdoCache.CreateCacheFromExistingData(projectId, "en", new DummyProgressDlg()) :
                         FdoCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", new ThreadHelper());
            var dataSetup = retval.ServiceLocator.GetInstance <IDataSetup>();

            dataSetup.LoadDomain(loadType);
            return(retval);
        }
Esempio n. 6
0
        /// <summary>
        /// Answer whether the project appears to have a LIFT repo.
        /// </summary>
        /// <returns></returns>
        public static bool DoesProjectHaveLiftRepo(IProjectIdentifier projectId)
        {
            // useful to return false on null for some unit tests
            if (projectId == null)
            {
                return(false);
            }
            string otherRepoPath = Path.Combine(projectId.ProjectFolder, LcmFileHelper.OtherRepositories);

            if (!Directory.Exists(otherRepoPath))
            {
                return(false);
            }
            string liftFolder = Directory.EnumerateDirectories(otherRepoPath, "*_LIFT").FirstOrDefault();

            return(!String.IsNullOrEmpty(liftFolder) && IsMercurialRepo(liftFolder));
        }
Esempio n. 7
0
        /// <summary>
        /// Actually create the system.
        /// Called by subclass overrides of CreateCache(), with parameters that suit
        /// the subclass.
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="loadType"></param>
        /// <param name="settings"></param>
        /// <returns>a working LcmCache</returns>
        protected LcmCache BootstrapSystem(IProjectIdentifier projectId, BackendBulkLoadDomain loadType, LcmSettings settings)
        {
            LcmCache retval;

            if (m_internalRestart)
            {
                retval = LcmCache.CreateCacheFromExistingData(projectId, "en", new DummyLcmUI(), TestDirectoryFinder.LcmDirectories,
                                                              settings, new DummyProgressDlg());
            }
            else
            {
                retval = LcmCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", new DummyLcmUI(),
                                                                  TestDirectoryFinder.LcmDirectories, settings);
            }

            var dataSetup = retval.ServiceLocator.GetInstance <IDataSetup>();

            dataSetup.LoadDomain(loadType);
            return(retval);
        }
Esempio n. 8
0
		/// <summary>
		/// Actually create the system.
		/// Called by subclass overrides of CreateCache(), with parameters that suit
		/// the subclass.
		/// </summary>
		/// <param name="projectId"></param>
		/// <param name="loadType"></param>
		/// <param name="settings"></param>
		/// <returns>a working FdoCache</returns>
		protected FdoCache BootstrapSystem(IProjectIdentifier projectId, BackendBulkLoadDomain loadType, FdoSettings settings)
		{
			var retval = m_internalRestart ? FdoCache.CreateCacheFromExistingData(projectId, "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories, settings, new DummyProgressDlg()) :
				FdoCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", new DummyFdoUI(), FwDirectoryFinder.FdoDirectories, settings);
			var dataSetup = retval.ServiceLocator.GetInstance<IDataSetup>();
			dataSetup.LoadDomain(loadType);
			return retval;
		}
Esempio n. 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the Paratext project, if any, that is associated with the specified FieldWorks project.
		/// </summary>
		/// <returns>The associated project, or null if there is none.</returns>
		/// ------------------------------------------------------------------------------------
		public static ScrText GetAssociatedProject(IProjectIdentifier projectId)
		{
			ScrText assocProj = s_ptHelper.GetProjects().FirstOrDefault(scrText =>
				scrText.AssociatedLexicalProject.ToString() == projectId.PipeHandle);
			s_ptHelper.ReloadProject(assocProj);
			return assocProj;
		}
Esempio n. 10
0
 /// <summary>
 /// Answer whether the project appears to have a FLEx repo. This is currently determined by its having a .hg folder.
 /// </summary>
 /// <returns></returns>
 public static bool DoesProjectHaveFlexRepo(IProjectIdentifier projectId)
 {
     // useful to return false on null for some unit tests
     return(projectId != null && IsMercurialRepo(projectId.ProjectFolder));
 }