hoTools.Find.FindAndReplaceItem.findCount C# (CSharp) Method

findCount() public method

public findCount ( Regex regExPattern, FieldType fieldType ) : int
regExPattern System.Text.RegularExpressions.Regex
fieldType FieldType
return int
        public int findCount(Regex regExPattern, FieldType fieldType)
        {
            int count = 0;
            if ( (fieldType & FieldType.Name) >0 )  count = count + findCountForType(regExPattern, _Name);
            if ( (fieldType & FieldType.Description) > 0)  count = count + findCountForType(regExPattern, _Description);
            if ((fieldType & FieldType.Stereotype) > 0) count = count + findCountForType(regExPattern, _Stereotype);
            return count;
        }
        #endregion 

Usage Example

        /// <summary>
        /// Find the count of found searches in item:
        /// - add item to l_items
        /// - update item to l_items if item is already available
        ///
        /// </summary>
        /// <param name="object_type"></param>
        /// <param name="GUID"></param>
        public int FindStringInItem(EA.ObjectType object_type, string GUID)
        {
            int count = 0;
            FindAndReplaceItem frItem = null;


            frItem = FindAndReplaceItem.Factory(_rep, object_type, GUID);
            count  = frItem.findCount(_regExPattern, _searchFieldTypes);
            if (count > 0)
            {
                frItem.CountChanges = count;
                this.l_items.Add(frItem);
            }

            return(count);
        }