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


C# DocProject.FindPropertySet方法代码示例

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


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

示例1: FormatField

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

            // 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 content.Replace(fieldname, format);
            }
            else if (docDef is DocEntity)//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 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 content.Replace(fieldname, format);
                }
                else 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 content.Replace(fieldname, format);
                }

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

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


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