コード例 #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> > DecorateCharacterValue(IEnumerable <IValueReference <TValue> > references,
                                                                               IValueFetchOptions options)
        {
            foreach (var reference in references)
            {
                if (reference.DefaultName == "intValue" || reference.DefaultName == "longValue")
                {
                    var extraDetail = SerializedPropertyHelper.GetIntValueAsPrintableChar(reference, options);
                    if (extraDetail != null)
                    {
                        yield return(new ExtraDetailValueReferenceDecorator <TValue>(reference,
                                                                                     ValueServices.RoleFactory, extraDetail));

                        continue;
                    }
                }

                yield return(reference);
            }
        }