private FdoLexicon GetFdoLexicon(string scrTextName, string projectId, string langId) { lock (m_syncRoot) { if (m_lexiconCache.Contains(scrTextName)) { FdoLexicon lexicon = m_lexiconCache[scrTextName]; m_lexiconCache.Remove(scrTextName); if (lexicon.ProjectId == projectId) { m_lexiconCache.Insert(0, lexicon); return(lexicon); } DisposeFdoCacheIfUnused(lexicon.Cache); } FdoCache fdoCache; if (TryGetFdoCache(projectId, langId, out fdoCache) != LexicalProjectValidationResult.Success) { throw new ArgumentException("The specified project is invalid."); } if (m_lexiconCache.Count == CacheSize) { FdoLexicon lexicon = m_lexiconCache[CacheSize - 1]; m_lexiconCache.RemoveAt(CacheSize - 1); DisposeFdoCacheIfUnused(lexicon.Cache); } var newLexicon = new FdoLexicon(scrTextName, projectId, fdoCache, fdoCache.ServiceLocator.WritingSystemManager.GetWsFromStr(langId), m_activationContext); m_lexiconCache.Insert(0, newLexicon); return(newLexicon); } }
public void SetUp() { // Force initialization in ILRepacked SIL.WritingSystems assembly, // even if a referenced SIl.WritingSystems assembly somewhere down // the dependency chain, that we won't be using, was initialized. if (!Sldr.IsInitialized) { Sldr.Initialize(); } FwRegistryHelper.Initialize(); m_threadHelper = new ThreadHelper(); var ui = new DummyLcmUI(m_threadHelper); var projectId = new ParatextLexiconPluginProjectId(BackendProviderType.kMemoryOnly, "Test.fwdata"); m_cache = LcmCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", ui, ParatextLexiconPluginDirectoryFinder.LcmDirectories, new LcmSettings()); NonUndoableUnitOfWorkHelper.Do(m_cache.ActionHandlerAccessor, () => { m_cache.ServiceLocator.WritingSystems.AddToCurrentAnalysisWritingSystems(m_cache.ServiceLocator.WritingSystemManager.Get("fr")); m_cache.ServiceLocator.WritingSystems.AddToCurrentVernacularWritingSystems(m_cache.ServiceLocator.WritingSystemManager.Get("en")); m_cache.LangProject.MorphologicalDataOA.ParserParameters = "<ParserParameters><XAmple><MaxNulls>1</MaxNulls><MaxPrefixes>5</MaxPrefixes><MaxInfixes>1</MaxInfixes><MaxSuffixes>5</MaxSuffixes><MaxInterfixes>0</MaxInterfixes><MaxAnalysesToReturn>10</MaxAnalysesToReturn></XAmple><ActiveParser>XAmple</ActiveParser></ParserParameters>"; }); m_lexicon = new FdoLexicon("Test", "FieldWorks:Test", m_cache, m_cache.DefaultVernWs); }
public void SetUp() { Icu.InitIcuDataDir(); m_activationContext = new ActivationContextHelper("FwParatextLexiconPlugin.dll.manifest"); using (m_activationContext.Activate()) { m_threadHelper = new ThreadHelper(); var ui = new DummyFdoUI(m_threadHelper); var projectId = new ParatextLexiconPluginProjectID(FDOBackendProviderType.kMemoryOnly, "Test.fwdata"); m_cache = FdoCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", ui, ParatextLexiconPluginDirectoryFinder.FdoDirectories, new FdoSettings()); NonUndoableUnitOfWorkHelper.Do(m_cache.ActionHandlerAccessor, () => { m_cache.ServiceLocator.WritingSystems.AddToCurrentAnalysisWritingSystems(m_cache.ServiceLocator.WritingSystemManager.Get("fr")); m_cache.ServiceLocator.WritingSystems.AddToCurrentVernacularWritingSystems(m_cache.ServiceLocator.WritingSystemManager.Get("en")); m_cache.LangProject.MorphologicalDataOA.ParserParameters = "<ParserParameters><XAmple><MaxNulls>1</MaxNulls><MaxPrefixes>5</MaxPrefixes><MaxInfixes>1</MaxInfixes><MaxSuffixes>5</MaxSuffixes><MaxInterfixes>0</MaxInterfixes><MaxAnalysesToReturn>10</MaxAnalysesToReturn></XAmple><ActiveParser>XAmple</ActiveParser></ParserParameters>"; }); } m_lexicon = new FdoLexicon("Test", "FieldWorks:Test", m_cache, m_cache.DefaultVernWs, m_activationContext); }
public LexSenseLexiconSense(FdoLexicon lexicon, LexemeKey lexemeKey, ILexSense lexSense) { m_lexicon = lexicon; m_lexemeKey = lexemeKey; m_lexSense = lexSense; }
public FdoLexEntryLexeme(FdoLexicon lexicon, LexemeKey key) { m_lexicon = lexicon; m_key = key; }
public FdoWordformLexeme(FdoLexicon lexicon, LexemeKey key) { m_lexicon = lexicon; m_key = key; }
public WfiGlossLexiconSense(FdoLexicon lexicon, LexemeKey lexemeKey, IWfiGloss gloss) { m_lexicon = lexicon; m_lexemeKey = lexemeKey; m_gloss = gloss; }
public LexEntryComparer(FdoLexicon lexicon) { m_lexicon = lexicon; }