IfcDoc.FormEdit.FormatRule C# (CSharp) Method

FormatRule() private method

private FormatRule ( DocModelRule rule, string key ) : string
rule DocModelRule
key string
return string
        private string FormatRule(DocModelRule rule, string key)
        {
            string comp = null;

            if (rule.Identification == null || !rule.Identification.Equals(key))
            {
                // recurse
                foreach (DocModelRule sub in rule.Rules)
                {
                    comp = FormatRule(sub, key);
                    if (comp != null)
                    {
                        break;
                    }
                }

                if (comp == null)
                    return null;
            }

            // generate rule if found
            if (rule is DocModelRuleAttribute)
            {
                return "." + rule.Name + comp;
            }
            else if (rule is DocModelRuleEntity)
            {
                return @"\" + rule.Name + comp;
            }

            return null;
        }
FormEdit