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


C# FdoCache.GetFlid方法代码示例

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


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

示例1: SetupDependencies

		/// <summary>
		/// Setup DependencyPaths property
		/// </summary>
		/// <param name="configuration"></param>
		/// <param name="cache"></param>
		protected void SetupDependencies(XmlNode configuration, FdoCache cache)
		{
			if (DependencyPaths.Count > 0)
				return;	// already setup.
			string dependsStr = XmlUtils.GetOptionalAttributeValue(configuration, "depends");
			if (dependsStr == null || cache == null)
				return;
			string[] depends = dependsStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
			foreach (string fieldPath in depends)
			{
				string[] fieldtree = fieldPath.Split(new char[] { '.' });
				List<int> tags = new List<int>(fieldtree.Length);
				string srcClassName = this.ClassName;
				foreach (string field in fieldtree)
				{
					int tag = cache.GetFlid(0, srcClassName, field);
					Debug.Assert(tag > 0, String.Format("Invalid dependency field {0} in field path {1}.", field, fieldPath));
					if (tag <= 0)
						break;
					tags.Add(tag);
					if (tags.Count < fieldtree.Length)
					{
						string nextFieldName = fieldtree[tags.Count];
						// make dst class the source class of next field
						uint clsidDst = 0;
						if (field == "OwnerHVO")
						{
							// handle the special case where we need the owning class
							// this is only possible if srcClassName is has a unique owner.
							// find the first class that owns the given 'classId' and the given fieldName.
							clsidDst = GetClassOwningClassAndFieldName(cache, srcClassName, nextFieldName);
						}
						else
						{
							ClassAndPropInfo cpi = cache.GetClassAndPropInfo((uint)tag);
							if (ClassHasField(cache, cache.GetClassName(cpi.signatureClsid), nextFieldName))
							{
								clsidDst = cpi.signatureClsid;
							}
							else if (cpi.isAbstract)
							{
								// find a subclasses that could refer to the nextFieldName.
								clsidDst = GetSubclassOwningNextField(cache, tag, nextFieldName);
							}
						}
						srcClassName = cache.GetClassName(clsidDst);
					}
				}
				m_fieldPaths.Add(tags);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:56,代码来源:BaseVirtualHandler.cs

示例2: GetFlidFromClassDotName

		private static int GetFlidFromClassDotName(FdoCache cache, string descriptor)
		{
			string[] parts = descriptor.Trim().Split('.');
			if (parts.Length != 2)
				throw new ConfigurationException("atomicFlatListItem field must be class.field");
			int flid = cache.GetFlid(0, parts[0], parts[1]);
			if (flid == 0)
				throw new ConfigurationException("Don't recognize atomicFlatListItem field " + descriptor);
			return flid;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:10,代码来源:BulkEditBar.cs

示例3: WsId

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Use to try to reload the ws from the configuration node. Default writing systems such as "vernacular" or "analysis"
		/// may change after initialization. (cf. LT-4882).
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="hvo">the object we want to find the ws for magic writing systems (e.g. for best analysis)</param>
		/// <param name="defaultWsId">ws we will use if we can't find one.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual int WsId(FdoCache cache, int hvo, int defaultWsId)
		{
			int ws = 0;
			if (m_configuration != null && cache != null)
			{
				if (hvo != 0)
				{
					int flid = cache.GetFlid(hvo, ClassName, FieldName);
					ws = LangProject.GetWritingSystem(m_configuration, cache, null, hvo, flid, defaultWsId);
				}
				else
				{
					ws = LangProject.GetWritingSystem(m_configuration, cache, null, 0);
				}
			}
			if (ws == 0)
				ws = defaultWsId;
			return ws;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:BaseVirtualHandler.cs

示例4: ClassHasField

		private static bool ClassHasField(FdoCache cache, string className, string fieldName)
		{
			return cache.GetFlid(0, className, fieldName) > 0;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:4,代码来源:BaseVirtualHandler.cs

示例5: GetFlid

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is a simplified version of XmlVc.GetFlid.
		/// It does not look for a flid attr, nor try to cache the result.
		/// It looks for a "field" property, and optionally a "class" one, and uses them
		/// (or the class of hvo, if "class" is missing) to figure the flid.
		/// Virtual properties are assumed already created.
		/// </summary>
		/// <param name="fdoCache">The fdo cache.</param>
		/// <param name="frag">The frag.</param>
		/// <param name="hvo">The hvo.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		static int GetFlid(FdoCache fdoCache, XmlNode frag, int hvo)
		{
			string stClassName = XmlUtils.GetOptionalAttributeValue(frag,"class");
			string stFieldName = XmlUtils.GetManditoryAttributeValue(frag,"field");
			return fdoCache.GetFlid(hvo, stClassName, stFieldName);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:XmlViewsUtils.cs


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