SIL.CoreImpl.PalasoWritingSystemManager.Set C# (CSharp) Méthode

Set() public méthode

Creates a writing system using the specified identifier and sets it.
public Set ( string identifier ) : IWritingSystem
identifier string The identifier.
Résultat IWritingSystem
		public IWritingSystem Set(string identifier)
		{
			bool dummy;
			return Set(identifier, out dummy);
		}

Same methods

PalasoWritingSystemManager::Set ( string identifier, bool &foundExisting ) : IWritingSystem
PalasoWritingSystemManager::Set ( IWritingSystem ws ) : void

Usage Example

        public void GetValidLangCodeForNewLang()
        {
            string storePath       = PrepareTempStore("Store");
            string globalStorePath = PrepareTempStore("GlobalStore");

            EnsureDirectoryIsEmpty(storePath);
            EnsureDirectoryIsEmpty(globalStorePath);

            var globalStore = new GlobalFileWritingSystemStore(globalStorePath);
            var wsManager   = new PalasoWritingSystemManager(
                new LocalFileWritingSystemStore(storePath, globalStore), globalStore);

            Assert.AreEqual("qip", wsManager.GetValidLangTagForNewLang("Qipkey"));
            Assert.AreEqual("sn", wsManager.GetValidLangTagForNewLang("Sn"));
            Assert.AreEqual("eba", wsManager.GetValidLangTagForNewLang("\u00CBbashlish"));             // \u00CB == E with diacritic
            Assert.AreEqual("eee", wsManager.GetValidLangTagForNewLang("\u00CB\u00CB\u00CBlish"));
            // \u00CB == E with diacritic
            Assert.AreEqual("aaa", wsManager.GetValidLangTagForNewLang("U"));

            LanguageSubtag subtag = new LanguageSubtag("qip", "Qipkey", true, null);
            IWritingSystem newWs  = wsManager.Create(subtag, null, null, null);

            wsManager.Set(newWs);
            Assert.AreEqual("aaa", wsManager.GetValidLangTagForNewLang("Qipsing"), "code for 'qip' should already be taken");

            subtag = new LanguageSubtag("aaa", "Qipsing", true, null);
            newWs  = wsManager.Create(subtag, null, null, null);
            wsManager.Set(newWs);
            Assert.AreEqual("aab", wsManager.GetValidLangTagForNewLang("Qipwest"),
                            "code for 'qip' should already be taken twice");

            // ENHANCE: Ideally, we would want to test incrementing the middle and first character,
            // but that would require at least 677 (26^2 + 1) writing systems be created.
        }
All Usage Examples Of SIL.CoreImpl.PalasoWritingSystemManager::Set