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(); } }
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)); }
public BamlNamedElement(IBamlType type, string runtimeName) { _type = type; _runtimeName = runtimeName; }
public BamlKeyElement(IBamlType type, BamlElementFlags typeFlags, BamlNode valueNode) { _type = type; _typeFlags = typeFlags; _valueNode = valueNode; }
public BamlKeyElement(IBamlType type, BamlElementFlags typeFlags, BamlNode valueNode, bool shared, bool sharedSet) : this(type, typeFlags, valueNode) { _shared = shared; _sharedSet = sharedSet; }
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; }
public BamlDefAttributeKeyType(IBamlType value, BamlElementFlags typeFlags, BamlNode valueNode) { _value = value; _typeFlags = typeFlags; _valueNode = valueNode; }
public BamlPropertyInfo(string name, IBamlType type, BamlPropertyUsage usage) { _name = name; _type = type; _usage = usage; }
public BamlPropertyInfo(string name, IBamlType type) : this(name, type, BamlPropertyUsage.Default) { }
public BamlTextWithConverter(string value, IBamlType converterType) { _value = value; _converterType = converterType; }
public BamlConstructorParameterType(IBamlType type) { _type = type; }
public BamlDefAttributeKeyType(IBamlType value, BamlElementFlags typeFlags, BamlNode valueNode, bool shared, bool sharedSet) : this(value, typeFlags, valueNode) { _shared = shared; _sharedSet = sharedSet; }
public BamlPropertyValueWithProperty(string name, IBamlType type) { _name = name; _type = type; }
public BamlPropertyTypeReference(IBamlType value, IBamlProperty declaringProperty) { _value = value; _declaringProperty = declaringProperty; }
public BamlElement(IBamlType type) : this(type, BamlElementFlags.None) { }