public static void GetData(this MovedFromAttribute @this, out bool autoUpdateAPI, out string sourceNamespace, out string sourceAssembly, out string sourceClassName) { autoUpdateAPI = @this.data.autoUdpateAPI; sourceNamespace = @this.data.nameSpace; sourceAssembly = @this.data.assembly; sourceClassName = @this.data.className; }
public static void GetData( this MovedFromAttribute @this, out bool autoUpdateAPI, out string sourceNamespace, out string sourceAssembly, out string sourceClassName) { Initialize(); autoUpdateAPI = false; sourceNamespace = string.Empty; sourceAssembly = string.Empty; sourceClassName = string.Empty; if (s_DataFieldInfo != null && s_AutoUpdateAPIFieldInfo != null && s_NamespaceFieldInfo != null && s_AssemblyFieldInfo != null && s_ClassNameFieldInfo != null) { var data = s_DataFieldInfo.GetValue(@this); autoUpdateAPI = (bool)s_AutoUpdateAPIFieldInfo.GetValue(data); sourceNamespace = (string)s_NamespaceFieldInfo.GetValue(data); sourceAssembly = (string)s_AssemblyFieldInfo.GetValue(data); sourceClassName = (string)s_ClassNameFieldInfo.GetValue(data); } }
private static string GetMovedUIControlTypeName(Type type, MovedFromAttribute attr) { if (type == null) { return(string.Empty); } MovedFromAttributeData data = attr.data; var namespaceName = data.nameSpaceHasChanged ? data.nameSpace : VisualElement.GetOrCreateTypeData(type).typeNamespace; var typeName = data.classHasChanged ? data.className : VisualElement.GetOrCreateTypeData(type).typeName; var fullOldName = namespaceName + "." + typeName; return(fullOldName); }
private static bool NamespaceHasChanged(Type type, string namespaceName) { object[] customAttributes = type.GetCustomAttributes(typeof(MovedFromAttribute), false); bool result; if (customAttributes.Length != 1) { result = false; } else if (string.IsNullOrEmpty(namespaceName)) { result = true; } else { MovedFromAttribute movedFromAttribute = (MovedFromAttribute)customAttributes[0]; result = (movedFromAttribute.Namespace == namespaceName); } return(result); }
internal static bool GetMovedFromAttributeDataForType(Type sourceType, out string assembly, out string nsp, out string klass) { klass = null; nsp = null; assembly = null; object[] customAttributes = sourceType.GetCustomAttributes(typeof(MovedFromAttribute), false); bool flag = customAttributes.Length != 1; bool result; if (flag) { result = false; } else { MovedFromAttribute movedFromAttribute = (MovedFromAttribute)customAttributes[0]; klass = movedFromAttribute.data.className; nsp = movedFromAttribute.data.nameSpace; assembly = movedFromAttribute.data.assembly; result = true; } return(result); }