コード例 #1
0
        private short GetTypeId(IBamlType type)
        {
            switch (type.Kind)
            {
            case BamlTypeKind.Declaration:
            {
                short typeId;
                if (!_typeToID.TryGetValue((BamlTypeInfo)type, out typeId))
                {
                    throw new BamlException(SR.BamlLoadError);
                }

                return(typeId);
            }

            case BamlTypeKind.Known:
            {
                short typeId = (short)((BamlKnownType)type).KnownCode;
                return((short)-typeId);
            }

            default:
                throw new NotImplementedException();
            }
        }
コード例 #2
0
        public BamlPropertyValueWithProperty(IBamlProperty property)
        {
            _property = property;

            var declaringProperty = property as BamlPropertyInfo;

            if (declaringProperty != null)
            {
                _name = declaringProperty.Name;
                _type = declaringProperty.Type;
            }
        }
コード例 #3
0
        private static bool IsType(IBamlType bamlType, BamlKnownTypeCode typeCode)
        {
            var bamlKnownType = bamlType as BamlKnownType;

            if (bamlKnownType == null)
            {
                return(false);
            }

            if (bamlKnownType.KnownCode != typeCode)
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
        public static TypeDeclaration Resolve(this IBamlType bamlType, Assembly ownerAssembly, bool throwOnFailure = false)
        {
            var type = bamlType.Resolve(ownerAssembly);

            if (type == null)
            {
                if (throwOnFailure)
                {
                    throw new ResolveReferenceException(string.Format(Net.SR.TypeResolveError, bamlType.ToString()));
                }

                return(null);
            }

            return(type);
        }
コード例 #5
0
        private static bool IsType(IBamlType bamlType, string typeName, bool ignoreNamespace = false)
        {
            var bamlTypeInfo = bamlType as BamlTypeInfo;

            if (bamlTypeInfo == null)
            {
                return(false);
            }

            string name = bamlTypeInfo.Name;

            if (string.IsNullOrEmpty(name))
            {
                return(false);
            }

            if (ignoreNamespace)
            {
                if (!name.EndsWith(typeName))
                {
                    return(false);
                }

                // Check for dot
                if (name.Length > typeName.Length && name[name.Length - typeName.Length - 1] != '.')
                {
                    return(false);
                }
            }
            else
            {
                if (name != typeName)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #6
0
 public BamlExtensionTypeValue(IBamlType value)
 {
     _value = value;
 }
コード例 #7
0
 private TypeDeclaration Resolve(IBamlType bamlType)
 {
     return(bamlType.Resolve(_assembly));
 }
コード例 #8
0
 public BamlNamedElement(IBamlType type, string runtimeName)
 {
     _type        = type;
     _runtimeName = runtimeName;
 }
コード例 #9
0
 public BamlKeyElement(IBamlType type, BamlElementFlags typeFlags, BamlNode valueNode)
 {
     _type      = type;
     _typeFlags = typeFlags;
     _valueNode = valueNode;
 }
コード例 #10
0
 public BamlKeyElement(IBamlType type, BamlElementFlags typeFlags, BamlNode valueNode, bool shared, bool sharedSet)
     : this(type, typeFlags, valueNode)
 {
     _shared    = shared;
     _sharedSet = sharedSet;
 }
コード例 #11
0
 public BamlPropertyWithConverter(string value, IBamlType converterType, IBamlProperty declaringProperty)
 {
     _value             = value;
     _converterType     = converterType;
     _declaringProperty = declaringProperty;
 }
コード例 #12
0
		public BamlTypeSerializerInfo(IBamlType serializerType)
		{
			_serializerType = serializerType;
		}
コード例 #13
0
 public BamlStaticResource(IBamlType type, BamlElementFlags flags)
 {
     _type  = type;
     _flags = flags;
 }
コード例 #14
0
 public BamlElement(IBamlType type, BamlElementFlags flags)
 {
     _type  = type;
     _flags = flags;
 }
コード例 #15
0
 public BamlDefAttributeKeyType(IBamlType value, BamlElementFlags typeFlags, BamlNode valueNode)
 {
     _value     = value;
     _typeFlags = typeFlags;
     _valueNode = valueNode;
 }
コード例 #16
0
 public BamlPropertyInfo(string name, IBamlType type, BamlPropertyUsage usage)
 {
     _name  = name;
     _type  = type;
     _usage = usage;
 }
コード例 #17
0
 public BamlPropertyInfo(string name, IBamlType type)
     : this(name, type, BamlPropertyUsage.Default)
 {
 }
コード例 #18
0
 public BamlTextWithConverter(string value, IBamlType converterType)
 {
     _value         = value;
     _converterType = converterType;
 }
コード例 #19
0
 public BamlConstructorParameterType(IBamlType type)
 {
     _type = type;
 }
コード例 #20
0
 public BamlDefAttributeKeyType(IBamlType value, BamlElementFlags typeFlags, BamlNode valueNode, bool shared, bool sharedSet)
     : this(value, typeFlags, valueNode)
 {
     _shared    = shared;
     _sharedSet = sharedSet;
 }
コード例 #21
0
 public BamlPropertyValueWithProperty(string name, IBamlType type)
 {
     _name = name;
     _type = type;
 }
コード例 #22
0
 public BamlPropertyTypeReference(IBamlType value, IBamlProperty declaringProperty)
 {
     _value             = value;
     _declaringProperty = declaringProperty;
 }
コード例 #23
0
 public BamlElement(IBamlType type)
     : this(type, BamlElementFlags.None)
 {
 }