コード例 #1
0
        private IValuePresentation GetValuePresentation(IObjectValueRole <TValue> serializedPropertyRole,
                                                        SerializedPropertyKind propertyType,
                                                        IPresentationOptions options,
                                                        out string extraDetail)
        {
            extraDetail = null;

            var valueProperty  = GetValueFieldName(propertyType);
            var valueReference = valueProperty == null ? null : serializedPropertyRole.GetInstancePropertyReference(valueProperty);

            if (propertyType == SerializedPropertyKind.Enum)
            {
                extraDetail = SerializedPropertyHelper.GetEnumValueIndexAsEnumName(serializedPropertyRole, valueReference, options);
            }
            else if (propertyType == SerializedPropertyKind.Character)
            {
                extraDetail = SerializedPropertyHelper.GetIntValueAsPrintableChar(valueReference, options);
            }
            else if (propertyType == SerializedPropertyKind.Integer)
            {
                var type = serializedPropertyRole.GetInstancePropertyReference("type")?.AsStringSafe(options)
                           ?.GetString();
                if (type == "char")
                {
                    extraDetail = SerializedPropertyHelper.GetIntValueAsPrintableChar(valueReference, options);
                }
            }

            return(valueReference?.ToValue(ValueServices)?.GetValuePresentation(options));
        }
コード例 #2
0
        private IEnumerable <IValueReference <TValue> > DecorateEnumValue(IObjectValueRole <TValue> serializedProperty,
                                                                          IEnumerable <IValueReference <TValue> > references,
                                                                          IPresentationOptions options)
        {
            foreach (var reference in references)
            {
                if (reference.DefaultName == "enumValueIndex")
                {
                    var extraDetail =
                        SerializedPropertyHelper.GetEnumValueIndexAsEnumName(serializedProperty, reference, options);
                    if (extraDetail != null)
                    {
                        yield return(new ExtraDetailValueReferenceDecorator <TValue>(reference,
                                                                                     ValueServices.RoleFactory, extraDetail));

                        continue;
                    }
                }

                yield return(reference);
            }
        }