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


C# DocProject.FindQuantitySet方法代码示例

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


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

示例1: FormatField

        private static string FormatField(DocProject docProject, string content /*deprecate*/, string fieldname, string fieldtype/*deprecate*/, string fieldvalue/*deprecate*/)
        {
            DocDefinition docDef = docProject.GetDefinition(fieldname);

            // hyperlink to enumerators
            if (docDef is DocEnumeration)
            {
                // hyperlink to enumeration definition

                // replace it with hyperlink
                DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef);
                string relative = @"../../";
                string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm";
                string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";

                return format;// content.Replace(fieldname, format);
            }
            else if (docDef is DocEntity || docDef is DocType)//fieldvalue != null && fieldvalue.StartsWith("Ifc") && docProject.GetDefinition(fieldvalue) != null)
            {
                // replace it with hyperlink
                DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef);
                string relative = @"../../";
                string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm";
                string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";

                return format;// content.Replace(fieldname, format);
            }
            else //if (docDef == null)
            {
                // hyperlink to property set definition
                DocSchema docSchema = null;
                DocObject docObj = docProject.FindPropertySet(fieldvalue, out docSchema);
                if (docObj is DocPropertySet)
                {
                    string relative = @"../../";
                    string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/pset/" + docObj.Name.ToLower() + ".htm"; // case-sensitive on linux -- need to make schema all lowercase
                    string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";
                    return format;// content.Replace(fieldname, format);
                }
                else
                {
                    docObj = docProject.FindPropertyEnumeration(fieldvalue, out docSchema);
                    if(docObj is DocPropertyEnumeration)
                    {
                        string relative = @"../../";
                        string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/pset/" + docObj.Name.ToLower() + ".htm"; // case-sensitive on linux -- need to make schema all lowercase
                        string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";
                        return format;// content.Replace(fieldname, format);
                    }
                    else
                    {
                        docObj = docProject.FindQuantitySet(fieldvalue, out docSchema);
                        if (docObj is DocQuantitySet)
                        {
                            string relative = @"../../";
                            string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/qset/" + docObj.Name.ToLower() + ".htm"; // case-sentive on linux -- need to make schema all lowercase
                            string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";
                            return format;// content.Replace(fieldname, format);
                        }

                    }
                }

                if (docObj == null)
                {
                    // simple replace -- hyperlink may markup value later
                    return fieldvalue;// content.Replace(fieldname, fieldvalue);
                }
            }
            /*
            else
            {
                // simple replace -- hyperlink may markup value later
                return content.Replace(fieldname, fieldvalue);
            }*/

            return content;
        }
开发者ID:BuildingSMART,项目名称:IfcDoc,代码行数:78,代码来源:DocumentationISO.cs


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