当前位置: 首页>>代码示例>>C#>>正文


C# ILgWritingSystemFactory.GetWsFromStr方法代码示例

本文整理汇总了C#中ILgWritingSystemFactory.GetWsFromStr方法的典型用法代码示例。如果您正苦于以下问题:C# ILgWritingSystemFactory.GetWsFromStr方法的具体用法?C# ILgWritingSystemFactory.GetWsFromStr怎么用?C# ILgWritingSystemFactory.GetWsFromStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILgWritingSystemFactory的用法示例。


在下文中一共展示了ILgWritingSystemFactory.GetWsFromStr方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTestData

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the test data.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			m_servLoc = Cache.ServiceLocator;
			m_wsf = Cache.WritingSystemFactory;
			m_ws_en = m_wsf.GetWsFromStr("en");
			m_ws_fr = m_wsf.GetWsFromStr("fr");

			CreateTestText();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:CopyObjectTests.cs

示例2: Setup

		public void Setup()
		{
			tsf = TsStrFactoryClass.Create();
			wsf = new MockWsf();
			wsEn = wsf.GetWsFromStr("en");
			wsFrn = wsf.GetWsFromStr("fr");
			ITsPropsBldr propBldr = TsPropsBldrClass.Create();
			propBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, wsFrn);
			ttpFrn = propBldr.GetTextProps();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:TextSourceTests.cs

示例3: FixtureSetup

		public override void FixtureSetup()
		{
			base.FixtureSetup();

			m_flidContainingTexts = ScrBookTags.kflidFootnotes;
			m_wsf = Cache.WritingSystemFactory;
			m_wsEng = m_wsf.GetWsFromStr("en");
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:8,代码来源:RootsiteBasicViewTestsBase.cs

示例4: Setup

		public void Setup()
		{
			m_wsf = LgWritingSystemFactoryClass.Create();
			// This is typically run during the build process before InstallLanguage.exe has
			// been built, so we want to disable InstallLanguage for this test.
			m_wsf.BypassInstall = true;

			m_wsEn = m_wsf.get_Engine("en");
			m_wsIdEn = m_wsf.GetWsFromStr("en");
			m_wsEn.set_Name(m_wsIdEn, "English");
			m_wsEn.set_Abbr(m_wsIdEn, "ENG");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:12,代码来源:LanguageDefinitionTest.cs

示例5: FixtureSetup

		public override void FixtureSetup()
		{
			CheckDisposed();
			base.FixtureSetup();

			Debug.Assert(m_fdoCache == null, "m_fdoCache is not null");
			//if (m_fdoCache != null)
			//	m_fdoCache.DisposeWithWSFactoryShutdown();
			m_fdoCache = InDatabaseFdoTestBase.SetupCache();
			ScrReferenceTests.InitializeScrReferenceForTests();

			m_wsf = m_fdoCache.LanguageWritingSystemFactoryAccessor;
			m_wsf.BypassInstall = true;
			m_wsEn = m_wsf.GetWsFromStr("en");

			m_factory = TsStrFactoryClass.Create();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:TeKeyTermsInitTests.cs

示例6: SpanStrToTsString

 public static ITsString SpanStrToTsString(string source, int mainWs, ILgWritingSystemFactory wsf)
 {
     // How to build up an ITsString via an ITsIncStrBldr -
     // 1. Use SetIntPropValues or SetStrPropValues to set a property "to be applied to any subsequent append operations".
     // 2. THEN use Append(string s) to add a string, which will "pick up" the properties set in step 1.
     // See ScrFootnoteFactory.CreateRunFromStringRep() in FdoFactoryAdditions.cs for a good example.
     List<Run> runs = GetSpanRuns(source);
     ITsIncStrBldr builder = TsIncStrBldrClass.Create();
     foreach (Run run in runs)
     {
         // To remove a string property, you set it to null, so we can just use StyleName directly whether or not it's null.
         builder.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, run.StyleName);
         int runWs = (run.Lang == null) ? mainWs : wsf.GetWsFromStr(run.Lang);
         builder.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, runWs);
         // We don't care about Guids in this function, so run.Guid is ignored
         // But we do need to set any other int or string properties that were in the original
         if (run.IntProperties != null)
             foreach (KeyValuePair<int, IntProperty> prop in run.IntProperties)
                 builder.SetIntPropValues(prop.Key, prop.Value.Variation, prop.Value.Value);
         if (run.StringProperties != null)
             foreach (KeyValuePair<int, string> prop in run.StringProperties)
                 builder.SetStrPropValue(prop.Key, prop.Value);
         builder.Append(run.Content);
     }
     return builder.GetString();
 }
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:26,代码来源:ConvertMongoToFdoTsStrings.cs

示例7: CreateRunFromStringRep

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the a text run from a string representation.
		/// </summary>
		/// <param name="wsf">The writing system factory.</param>
		/// <param name="strBldr">The structured string builder.</param>
		/// <param name="textNode">The text node which describes runs to be added to the
		/// paragraph or to the translation for a particular writing system</param>
		/// ------------------------------------------------------------------------------------
		private void CreateRunFromStringRep(ILgWritingSystemFactory wsf, ITsIncStrBldr strBldr,
			XmlNode textNode)
		{
			XmlNode charStyle = textNode.Attributes.GetNamedItem("CS");
			if (charStyle != null)
				strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, charStyle.Value);
			else
				strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);

			XmlNode wsICULocale = textNode.Attributes.GetNamedItem("WS");
			if (wsICULocale != null)
			{
				int ws = wsf.GetWsFromStr(wsICULocale.Value);
				if (ws <= 0)
					throw new ArgumentException("Unknown ICU locale encountered: '" + wsICULocale.Value + "'");
				strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
					(int)FwTextPropVar.ktpvDefault, wsf.GetWsFromStr(wsICULocale.Value));
			}
			else
				throw new ArgumentException("Required attribute WS missing from RUN element.");
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:30,代码来源:FdoFactoryAdditions.cs

示例8: InitializeWritingSystems

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the object with the proper writing system factory, which also initializes
		/// some standard writing system ids.
		/// </summary>
		/// <param name="wsf">the writing system factory</param>
		/// <returns>nothing</returns>
		/// ------------------------------------------------------------------------------------
		public virtual void InitializeWritingSystems(ILgWritingSystemFactory wsf)
		{
			m_wsEnglish = wsf.GetWsFromStr("en");
			m_wsSpanish = wsf.GetWsFromStr("es");
			// Rebuild the namesets with the new writing system ids.
			InitNameSets();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:MultilingScrBooks.cs

示例9: GetWsFromStr

		/// <summary>
		/// Translate the ICU locale string into the writing system id for the given
		/// writing system factory, adding it to the factory as needed.
		/// </summary>
		/// <param name="icuLocale"></param>
		/// <param name="wsf"></param>
		/// <returns></returns>
		static public int GetWsFromStr(string icuLocale, ILgWritingSystemFactory wsf)
		{
			int ws = wsf.GetWsFromStr(icuLocale);
			if (ws == 0)
			{
				// This adds the icuLocale as a new writing system to the factory.
				IWritingSystem lws = wsf.get_Engine(icuLocale);
				ws = lws.WritingSystem;
				lws = null;
			}
			return ws;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:XmlHelperClasses.cs

示例10: Restore

		/// <summary>
		///
		/// </summary>
		/// <param name="data"></param>
		/// <param name="wsf"></param>
		/// <param name="proj"></param>
		/// <param name="defVern">Typically you want to pass in LgWritingSystemTags.kwsVernInParagraph</param>
		/// <param name="defAnalysis"></param>
		/// <returns></returns>
		public static InterlinLineChoices Restore(string data, ILgWritingSystemFactory wsf, ILangProject proj, int defVern, int defAnalysis)
		{
			Debug.Assert(defVern != 0);
			Debug.Assert(defAnalysis != 0);

			InterlinLineChoices result;
			string[] parts = data.Split(',');

			switch(parts[0])
			{
				case "InterlinLineChoices":
					result = new InterlinLineChoices(proj, defVern, defAnalysis);
					break;
				case "EditableInterlinLineChoices":
					result = new EditableInterlinLineChoices(proj, defVern, defAnalysis);
					break;
				default:
					throw new Exception("Unrecognised type of InterlinLineChoices: " + parts[0]);
			}
			for (int i = 1; i < parts.Length; i++)
			{
				string[] flidAndWs = parts[i].Split('%');
				if (flidAndWs.Length != 2)
					throw new Exception("Unrecognized InterlinLineSpec: " + parts[i]);
				int flid = Int32.Parse(flidAndWs[0]);
				int ws = wsf.GetWsFromStr(flidAndWs[1]);
				result.Add(flid, ws);
			}
			return result;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:39,代码来源:InterlinLineChoices.cs

示例11: Initialize

		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_wsf = Cache.LanguageWritingSystemFactoryAccessor;
			m_wsEng = m_wsf.GetWsFromStr("en");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:RootsiteBasicViewTestsBase.cs

示例12: Setup

		public void Setup()
		{
			// Create the following:
			// - part and layout inventories
			// - metadata cache
			// - DataAccess cache
			// - collection of columns to display.

			// We want a MetaDataCache that knows about
			// - LexEntry.Senses, Msas, CitationForm, Bibliography, Etymology
			// - LexSense.SemanticDomains, SenseType, Status, gloss
			// - CmPossibility Name, abbr
			// - MoMorphSynAnalysis
			// - MoStemMsa
			// - MoDerivationalMsa
			m_mdc = FwMetaDataCacheClass.Create();
			string m_sTestPath = Path.Combine(DirectoryFinder.FwSourceDirectory,
				@"Common\Controls\XmlViews\XmlViewsTests\SampleCm.xml");
			m_mdc.InitXml(m_sTestPath, true);

			// We want ISilDataAccess with:
			// - LexEntry (1) with no senses and one MSA (2)
			// - LexEntry (4) with one sense (5) and no MSA
			// - LexEntry (6) with three senses (7, 8, 9) and two MSAs (10, 11)
			// - sense(5) with no semantic domains
			// - senses with one SD (7->30, 8->31)
			// - sense with three SDs, one the same as the first (9->30, 31, 32)
			// - MoStemMsa (2, 11)
			// - MoDerivationalMsa (10)
			m_cda = VwCacheDaClass.Create();
			m_sda = m_cda as ISilDataAccess;
			m_wsf = LgWritingSystemFactoryClass.Create();
			m_sda.WritingSystemFactory = m_wsf;
			SimpleDataParser parser = new SimpleDataParser(m_mdc, m_cda);

			parser.Parse(Path.Combine(DirectoryFinder.FwSourceDirectory,
				@"Common\Controls\XmlViews\XmlViewsTests\SampleData.xml"));
			int wsEn = m_wsf.GetWsFromStr("en");
			// These are mainly to check out the parser.
			Assert.AreEqual(3, m_sda.get_ObjectProp(2, 23011), "part of speech of an MoStemMsa");
			Assert.AreEqual(2, m_sda.get_VecItem(1, 2009, 0), "owned msa");
			Assert.AreEqual("noun", m_sda.get_MultiStringAlt(3, 7003, wsEn).Text, "got ms property");
			Assert.AreEqual(9, m_sda.get_VecItem(6, 2010, 2), "3rd sense");
			Assert.AreEqual(31, m_sda.get_VecItem(9, 21016, 1), "2nd semantic domain");

			// Columns includes
			// - CitationForm (string inside span)
			// - Bibliography (string not in span)
			// - Sense glosses (string in para in seq, nested in column element)
			// - Semantic domains (pair of strings in para in seq in seq, using layout refs)
			// - MSAs (simplified, but polymorphic with one having <choice> and one <obj> to CmPossibility
			XmlDocument docColumns = new XmlDocument();
			docColumns.Load(Path.Combine(DirectoryFinder.FwSourceDirectory,
				@"Common\Controls\XmlViews\XmlViewsTests\TestColumns.xml"));
			m_columnList = docColumns.DocumentElement.ChildNodes;

			// Parts just has what those columns need.
			string partDirectory = Path.Combine(DirectoryFinder.FwSourceDirectory,
				@"Common\Controls\XmlViews\XmlViewsTests");
			Dictionary<string, string[]> keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["layout"] = new string[] {"class", "type", "name" };
			keyAttrs["group"] = new string[] {"label"};
			keyAttrs["part"] = new string[] {"ref"};


			// Currently there are no specialized layout files that match.
			m_layoutInventory = new Inventory(new string[] {partDirectory},
				"*Layouts.xml", "/LayoutInventory/*", keyAttrs);

			keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["part"] = new string[] {"id"};

			m_partInventory = new Inventory(new string[] {partDirectory},
				"TestParts.xml", "/PartInventory/bin/*", keyAttrs);
			if (m_layouts != null)
				m_layouts.Dispose();
			m_layouts = new LayoutCache(m_mdc, m_layoutInventory, m_partInventory);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:78,代码来源:TestManyOneBrowse.cs

示例13: EnsureRealWs

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets (or makes) the writing system. If there isn't already one with this locale id,
		/// we assume there is an XML language definition we can load.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public IWritingSystem EnsureRealWs(ILgWritingSystemFactory wsf)
		{
			if (wsf.GetWsFromStr(m_icuLocale) == 0)
			{
				// Need to create a new writing system from the XML file.
				LanguageDefinitionFactory ldf =
					new LanguageDefinitionFactory(wsf, m_icuLocale);
				string pathname = DirectoryFinder.LanguagesDirectory + "\\" + m_icuLocale + ".xml";
				ldf.Deserialize(pathname);
				ldf.LanguageDefinition.SaveWritingSystem(m_icuLocale);
			}
			return wsf.get_EngineOrNull(wsf.GetWsFromStr(m_icuLocale));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:CmObject.cs


注:本文中的ILgWritingSystemFactory.GetWsFromStr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。