@@ -682,50 +682,51 @@ private static IFragment GenerateContentForGroupingNode(object field, List<Confi
682682 }
683683
684684 /// <summary>
685- /// Gets the value of the requested custom field associated with the fieldOwner object
685+ /// Gets the value of the requested field associated with the fieldOwner object
686686 /// </summary>
687- /// <returns>true if the custom field was valid and false otherwise</returns>
688- /// <remarks>propertyValue can be null if the custom field is valid but no value is stored for the owning object</remarks>
687+ /// <returns>true if the field was valid and false otherwise</returns>
688+ /// <remarks>propertyValue can be null if the field is valid but no value is stored for the owning object</remarks>
689689 private static bool GetPropValueForModelField ( object fieldOwner , ConfigurableDictionaryNode config ,
690- LcmCache cache , ISilDataAccess decorator , string customFieldName , ref object propertyValue , string cfOwnerClassName = null )
690+ LcmCache cache , ISilDataAccess decorator , string fieldName , ref object propertyValue , string cfOwnerClassName = null )
691691 {
692- var customFieldOwnerClassName = cfOwnerClassName ;
692+ var fieldOwnerClassName = cfOwnerClassName ;
693+ var specificFieldName = fieldName ;
693694 ICmObject specificObject ;
694695 if ( fieldOwner is ISenseOrEntry senseOrEntry )
695696 {
696- // assign the customFieldOwnerClassName if it was not passed in
697- customFieldOwnerClassName = customFieldOwnerClassName ?? senseOrEntry . Item . ClassName ;
698- specificObject = senseOrEntry . Item ;
697+ senseOrEntry . SpecificItemAndFieldName ( fieldName , out specificObject , out specificFieldName ) ;
699698 }
700699 else if ( fieldOwner is ICmObject owner )
701700 {
702701 specificObject = owner ;
703- // assign the customFieldOwnerClassName if it was not passed in
704- customFieldOwnerClassName = customFieldOwnerClassName ?? specificObject . ClassName ;
705702 senseOrEntry = null ;
706703 }
707704 else
708705 {
709706 // throw an argument exception if the field owner is not a valid type
710707 throw new ArgumentException ( "The field owner is not a valid type" , nameof ( fieldOwner ) ) ;
711708 }
709+
710+ // assign the fieldOwnerClassName if it was not passed in
711+ fieldOwnerClassName = fieldOwnerClassName ?? specificObject . ClassName ;
712+
712713 if ( decorator == null )
713714 decorator = cache . DomainDataByFlid ;
714- int customFieldFlid = GetCustomFieldFlid ( config , cache , customFieldOwnerClassName , customFieldName ) ;
715- if ( customFieldFlid == 0 )
715+ int fieldFlid = GetCustomFieldFlid ( config , cache , fieldOwnerClassName , specificFieldName ) ;
716+ if ( fieldFlid == 0 )
716717 return false ;
717718
718- var customFieldType = cache . MetaDataCacheAccessor . GetFieldType ( customFieldFlid ) ;
719+ var fieldType = cache . MetaDataCacheAccessor . GetFieldType ( fieldFlid ) ;
719720 if ( senseOrEntry != null )
720721 {
721- if ( ! ( ( IFwMetaDataCacheManaged ) cache . MetaDataCacheAccessor ) . GetFields ( senseOrEntry . Item . ClassID ,
722- true , ( int ) CellarPropertyTypeFilter . All ) . Contains ( customFieldFlid ) )
722+ if ( ! ( ( IFwMetaDataCacheManaged ) cache . MetaDataCacheAccessor ) . GetFields ( specificObject . ClassID ,
723+ true , ( int ) CellarPropertyTypeFilter . All ) . Contains ( fieldFlid ) )
723724 {
724725 return false ;
725726 }
726727 }
727728
728- switch ( customFieldType )
729+ switch ( fieldType )
729730 {
730731 case ( int ) CellarPropertyType . ReferenceCollection :
731732 case ( int ) CellarPropertyType . OwningCollection :
@@ -735,11 +736,11 @@ private static bool GetPropValueForModelField(object fieldOwner, ConfigurableDic
735736 {
736737 var sda = decorator ;
737738 // This method returns the hvo of the object pointed to
738- var chvo = sda . get_VecSize ( specificObject . Hvo , customFieldFlid ) ;
739+ var chvo = sda . get_VecSize ( specificObject . Hvo , fieldFlid ) ;
739740 int [ ] contents ;
740741 using ( var arrayPtr = MarshalEx . ArrayToNative < int > ( chvo ) )
741742 {
742- sda . VecProp ( specificObject . Hvo , customFieldFlid , chvo , out chvo , arrayPtr ) ;
743+ sda . VecProp ( specificObject . Hvo , fieldFlid , chvo , out chvo , arrayPtr ) ;
743744 contents = MarshalEx . NativeToArray < int > ( arrayPtr , chvo ) ;
744745 }
745746 // Convert the contents to IEnumerable<T>
@@ -763,36 +764,36 @@ private static bool GetPropValueForModelField(object fieldOwner, ConfigurableDic
763764 case ( int ) CellarPropertyType . OwningAtomic :
764765 {
765766 // This method returns the hvo of the object pointed to
766- propertyValue = decorator . get_ObjectProp ( specificObject . Hvo , customFieldFlid ) ;
767+ propertyValue = decorator . get_ObjectProp ( specificObject . Hvo , fieldFlid ) ;
767768 // if the hvo is invalid set propertyValue to null otherwise get the object
768769 propertyValue = ( int ) propertyValue > 0 ? cache . LangProject . Services . GetObject ( ( int ) propertyValue ) : null ;
769770 break ;
770771 }
771772 case ( int ) CellarPropertyType . GenDate :
772773 {
773- propertyValue = new GenDate ( decorator . get_IntProp ( specificObject . Hvo , customFieldFlid ) ) ;
774+ propertyValue = new GenDate ( decorator . get_IntProp ( specificObject . Hvo , fieldFlid ) ) ;
774775 break ;
775776 }
776777
777778 case ( int ) CellarPropertyType . Time :
778779 {
779- propertyValue = SilTime . ConvertFromSilTime ( decorator . get_TimeProp ( specificObject . Hvo , customFieldFlid ) ) ;
780+ propertyValue = SilTime . ConvertFromSilTime ( decorator . get_TimeProp ( specificObject . Hvo , fieldFlid ) ) ;
780781 break ;
781782 }
782783 case ( int ) CellarPropertyType . MultiUnicode :
783784 case ( int ) CellarPropertyType . MultiString :
784785 {
785- propertyValue = decorator . get_MultiStringProp ( specificObject . Hvo , customFieldFlid ) ;
786+ propertyValue = decorator . get_MultiStringProp ( specificObject . Hvo , fieldFlid ) ;
786787 break ;
787788 }
788789 case ( int ) CellarPropertyType . String :
789790 {
790- propertyValue = decorator . get_StringProp ( specificObject . Hvo , customFieldFlid ) ;
791+ propertyValue = decorator . get_StringProp ( specificObject . Hvo , fieldFlid ) ;
791792 break ;
792793 }
793794 case ( int ) CellarPropertyType . Integer :
794795 {
795- propertyValue = decorator . get_IntProp ( specificObject . Hvo , customFieldFlid ) ;
796+ propertyValue = decorator . get_IntProp ( specificObject . Hvo , fieldFlid ) ;
796797 break ;
797798 }
798799 }
0 commit comments