예제 #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;
            }
        }
        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);
        }
        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);
        }
        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);
        }
 public BamlExtensionTypeValue(IBamlType value)
 {
     _value = value;
 }
 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;
 }
		public BamlTypeSerializerInfo(IBamlType serializerType)
		{
			_serializerType = serializerType;
		}
 public BamlStaticResource(IBamlType type, BamlElementFlags flags)
 {
     _type  = type;
     _flags = flags;
 }
 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)
 {
 }
 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;
 }
 public BamlElement(IBamlType type)
     : this(type, BamlElementFlags.None)
 {
 }