protected virtual XamlTextSyntax LookupTextSyntax() { // Look for a type converter on the Property. object[] objs = LookupCustomAttributes(typeof(TypeConverterAttribute)); XamlTextSyntax representer; // If there were attributes on the Property then get that // TypeConverter, else look on the Type. if (objs.Length > 0) { TypeConverterAttribute[] tcAttrs = (TypeConverterAttribute[])objs; representer = ClrNamespace.GetOrCreateTextSyntaxFromAttributes(this.SchemaContext, tcAttrs); } else { XamlType xamlType = this.Type; representer = xamlType.TextSyntax; } if (representer == null) { representer = XamlTextSyntax.NoSyntax; } return(representer); }
public void NamespaceProperties() { ClrNamespace dedeNamespace = new ClrNamespace("Dede"); string dedeNamespaceToString = EvaluateAndConvert("str(clr.Dede)") as string; Assert.AreEqual(dedeNamespaceToString, dedeNamespace.ToString()); }
public void GetClrNsByPrefix() { var clrNs = registry.GetClrNamespaceByPrefix("clr"); var expected = new ClrNamespace(type.GetTypeInfo().Assembly, type.Namespace); Assert.AreEqual(expected, clrNs); }
public void UnknownNamespace() { ClrNamespace dedeNamespace = EvaluateAndConvert("clr.Dede") as ClrNamespace; Assert.IsNotNull(dedeNamespace); Assert.AreEqual(dedeNamespace.Name, "Dede"); Assert.AreEqual(dedeNamespace.Parent, null); }
public void KnownNamespace() { ClrNamespace systemNamespace = EvaluateAndConvert("clr.System") as ClrNamespace; Assert.IsNotNull(systemNamespace); Assert.AreEqual(systemNamespace.Name, "System"); Assert.AreEqual(systemNamespace.Parent, null); ClrNamespace systemReflectionNamespace = EvaluateAndConvert("clr.System.Reflection") as ClrNamespace; Assert.IsNotNull(systemReflectionNamespace); Assert.AreEqual(systemReflectionNamespace.Name, "Reflection"); Assert.IsNotNull(systemReflectionNamespace.Parent); Assert.AreEqual(systemReflectionNamespace.Parent.Name, "System"); }
private static PythonObject __call__(PythonObject self, PythonTuple args) { ClrNamespace me = instances[self]; string name = (args[0] as PythonString).ToString(); string fullName = me.ToIdentifier() + "." + name; Type type = AppDomain.CurrentDomain.GetAssemblies() .Select(a => a.GetType(fullName)) .FirstOrDefault(t => t != null); if (type == null) { return(new ClrNamespace(name, me)); } else { return(TypeManager.ToPython(type)); } }
public override int GetHashCode() { return(ClrNamespace.GetHashCode() ^ this.unifiedAssemblyName.GetHashCode()); }
internal string GetXmlNamespace(TypeDeclaration type) { ClrNamespace ns = new ClrNamespace(type.Namespace, type.Assembly); return (string)reverseTable[ns]; }
public void AddNamespaceMapping(string xmlNamespace, string clrNamespace, string assembly) { ClrNamespace ns = new ClrNamespace(clrNamespace, assembly); table[xmlNamespace] = ns; reverseTable[ns] = xmlNamespace; }