Ejemplo n.º 1
0
 internal override void SetSite(DocumentCompositeNode parent, IProperty propertyKey, int childIndex)
 {
     base.SetSite(parent, propertyKey, childIndex);
     if (parent != null)
     {
         DocumentPrimitiveNode.UnsitedValue unsitedValue = this.value as DocumentPrimitiveNode.UnsitedValue;
         if (unsitedValue == null)
         {
             return;
         }
         TypeConverter typeConverter = this.ValueConverter;
         if (typeConverter == null)
         {
             if (DocumentPrimitiveNode.objectTypeConverter == null)
             {
                 DocumentPrimitiveNode.objectTypeConverter = this.PlatformMetadata.GetTypeConverter((MemberInfo)typeof(object));
             }
             typeConverter = DocumentPrimitiveNode.objectTypeConverter;
         }
         this.value = (IDocumentNodeValue) new DocumentNodeStringValue(typeConverter.ConvertToInvariantString(unsitedValue.Value));
     }
     else
     {
         this.valueConverterProvider = (IMember)null;
     }
 }
Ejemplo n.º 2
0
        public static object GetValueAsObject(DocumentNode node)
        {
            DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode;

            if (documentPrimitiveNode == null)
            {
                return((object)null);
            }
            DocumentPrimitiveNode.UnsitedValue unsitedValue = documentPrimitiveNode.Value as DocumentPrimitiveNode.UnsitedValue;
            if (unsitedValue == null)
            {
                return((object)null);
            }
            return(unsitedValue.Value);
        }
Ejemplo n.º 3
0
        public static string GetValueAsString(DocumentNode node)
        {
            DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode;

            if (documentPrimitiveNode != null && documentPrimitiveNode.TypeResolver.PlatformMetadata.KnownTypes.String.IsAssignableFrom((ITypeId)documentPrimitiveNode.Type))
            {
                DocumentNodeStringValue documentNodeStringValue = documentPrimitiveNode.value as DocumentNodeStringValue;
                if (documentNodeStringValue != null)
                {
                    return(documentNodeStringValue.Value);
                }
                DocumentPrimitiveNode.UnsitedValue unsitedValue = documentPrimitiveNode.value as DocumentPrimitiveNode.UnsitedValue;
                if (unsitedValue != null)
                {
                    return((string)unsitedValue.Value);
                }
            }
            return((string)null);
        }