public typeDescriptor(Type t, string typeName, bool compile = true) { jxshell.dotnet4.methodDescriptor methodDescriptor; typeDescriptor.loadEvaluator(); if (typeDescriptor.language == null) { typeDescriptor.language = (csharplanguage)jxshell.language.defaultLanguage.create(); } this.typeString = typeName; MethodInfo[] methods = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); for (int i = 0; i < (int)methods.Length; i++) { MethodInfo methodInfo = methods[i]; if (!methodInfo.Name.StartsWith("get_") && !methodInfo.Name.StartsWith("set_")) { jxshell.dotnet4.methodDescriptor value = null; if (methodInfo.IsGenericMethod) { string text = string.Concat("generic_", methodInfo.Name); if (!this.instanceMethods.TryGetValue(text, out value)) { value = new jxshell.dotnet4.methodDescriptor() { isGenericMethod = true }; this.instanceMethods[text] = value; this.methods.Add(value); value.methodOrder = this.methods.Count - 1; value.name = text; } } else if (!this.instanceMethods.TryGetValue(methodInfo.Name, out value)) { value = new jxshell.dotnet4.methodDescriptor(); this.instanceMethods[methodInfo.Name] = value; this.methods.Add(value); value.methodOrder = this.methods.Count - 1; value.name = methodInfo.Name; } value.baseMethods.Add(methodInfo); value.maxParameterCount = Math.Max(value.maxParameterCount, (int)methodInfo.GetParameters().Length); if (methodInfo.IsGenericMethod) { value.genericParameterCount = Math.Max(value.genericParameterCount, (int)methodInfo.GetGenericArguments().Length); } } } PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int j = 0; j < (int)properties.Length; j++) { PropertyInfo propertyInfo = properties[j]; propertyDescriptor value2 = null; if (!this.instanceProperties.TryGetValue(propertyInfo.Name, out value2)) { value2 = new propertyDescriptor(); this.instanceProperties[propertyInfo.Name] = value2; this.properties.Add(value2); value2.propertyOrder = this.properties.Count - 1; value2.name = propertyInfo.Name; } value2.properties.Add(propertyInfo); value2.maxParameterCount = Math.Max(value2.maxParameterCount, (int)propertyInfo.GetIndexParameters().Length); } FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); for (int k = 0; k < (int)fields.Length; k++) { FieldInfo fieldInfo = fields[k]; fieldDescriptor value3 = null; if (!this.instanceFields.TryGetValue(fieldInfo.Name, out value3)) { value3 = new fieldDescriptor(); this.instanceFields[fieldInfo.Name] = value3; this.fields.Add(value3); value3.fieldOrder = this.fields.Count - 1; value3.name = fieldInfo.Name; } value3.fieldInfo = fieldInfo; } ConstructorInfo[] constructors = t.GetConstructors(); for (int l = 0; l < (int)constructors.Length; l++) { ConstructorInfo constructorInfo = constructors[l]; if (this.constructor != null) { methodDescriptor = this.constructor; } else { jxshell.dotnet4.methodDescriptor _methodDescriptor = new jxshell.dotnet4.methodDescriptor(); jxshell.dotnet4.methodDescriptor _methodDescriptor1 = _methodDescriptor; this.constructor = _methodDescriptor; methodDescriptor = _methodDescriptor1; this.methods.Add(methodDescriptor); methodDescriptor.name = "construct"; methodDescriptor.methodOrder = this.methods.Count - 1; } methodDescriptor.baseMethods.Add(constructorInfo); methodDescriptor.maxParameterCount = Math.Max(methodDescriptor.maxParameterCount, (int)constructorInfo.GetParameters().Length); } MethodInfo[] methodInfoArray = t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); for (int m = 0; m < (int)methodInfoArray.Length; m++) { MethodInfo methodInfo2 = methodInfoArray[m]; if (!methodInfo2.Name.StartsWith("get_") && !methodInfo2.Name.StartsWith("set_")) { jxshell.dotnet4.methodDescriptor value4 = null; if (methodInfo2.IsGenericMethod) { string text2 = string.Concat("generic_", methodInfo2.Name); if (!this.instanceMethods.TryGetValue(text2, out value4)) { value4 = new jxshell.dotnet4.methodDescriptor(); this.staticMethods[text2] = value4; value4.isGenericMethod = true; this.methods.Add(value4); value4.methodOrder = this.methods.Count - 1; value4.name = text2; } } else if (!this.staticMethods.TryGetValue(methodInfo2.Name, out value4)) { value4 = new jxshell.dotnet4.methodDescriptor(); this.staticMethods[methodInfo2.Name] = value4; this.methods.Add(value4); value4.name = methodInfo2.Name; value4.methodOrder = this.methods.Count - 1; } value4.baseMethods.Add(methodInfo2); value4.maxParameterCount = Math.Max(value4.maxParameterCount, (int)methodInfo2.GetParameters().Length); if (methodInfo2.IsGenericMethod) { value4.genericParameterCount = Math.Max(value4.genericParameterCount, (int)methodInfo2.GetGenericArguments().Length); } } } PropertyInfo[] propertyInfoArray = t.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int n = 0; n < (int)propertyInfoArray.Length; n++) { PropertyInfo propertyInfo2 = propertyInfoArray[n]; propertyDescriptor value5 = null; if (!this.staticProperties.TryGetValue(propertyInfo2.Name, out value5)) { value5 = new propertyDescriptor(); this.staticProperties[propertyInfo2.Name] = value5; this.properties.Add(value5); value5.propertyOrder = this.properties.Count - 1; value5.name = propertyInfo2.Name; } value5.properties.Add(propertyInfo2); value5.maxParameterCount = Math.Max(value5.maxParameterCount, (int)propertyInfo2.GetIndexParameters().Length); } FieldInfo[] fieldInfoArray = t.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); for (int o = 0; o < (int)fieldInfoArray.Length; o++) { FieldInfo fieldInfo2 = fieldInfoArray[o]; fieldDescriptor value6 = null; if (!this.instanceFields.TryGetValue(fieldInfo2.Name, out value6)) { value6 = new fieldDescriptor(); this.staticFields[fieldInfo2.Name] = value6; this.fields.Add(value6); value6.fieldOrder = this.fields.Count - 1; value6.name = fieldInfo2.Name; } value6.fieldInfo = fieldInfo2; } this.type = t; typeDescriptor.loadedTypes[t] = this; if (compile && typeDescriptor.gencompile) { this.compile(); } }
public typeDescriptor(Type t, string typeName, bool compile = true) { typeDescriptor.loadEvaluator(); if (typeDescriptor.language == null) { typeDescriptor.language = (csharplanguage)jxshell.language.defaultLanguage.create(); } this.typeString = typeName; MethodInfo[] array = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); MethodInfo[] array2 = array; for (int i = 0; i < array2.Length; i++) { MethodInfo methodInfo = array2[i]; if (!methodInfo.Name.StartsWith("get_") && !methodInfo.Name.StartsWith("set_")) { methodDescriptor methodDescriptor = null; if (methodInfo.IsGenericMethod) { string text = "generic_" + methodInfo.Name; if (!this.instanceMethods.TryGetValue(text, out methodDescriptor)) { methodDescriptor = new methodDescriptor(); methodDescriptor.isGenericMethod = true; this.instanceMethods[text] = methodDescriptor; this.methods.Add(methodDescriptor); methodDescriptor.methodOrder = this.methods.Count - 1; methodDescriptor.name = text; } } else if (!this.instanceMethods.TryGetValue(methodInfo.Name, out methodDescriptor)) { methodDescriptor = new methodDescriptor(); this.instanceMethods[methodInfo.Name] = methodDescriptor; this.methods.Add(methodDescriptor); methodDescriptor.methodOrder = this.methods.Count - 1; methodDescriptor.name = methodInfo.Name; } methodDescriptor.baseMethods.Add(methodInfo); methodDescriptor.maxParameterCount = Math.Max(methodDescriptor.maxParameterCount, methodInfo.GetParameters().Length); if (methodInfo.IsGenericMethod) { methodDescriptor.genericParameterCount = Math.Max(methodDescriptor.genericParameterCount, methodInfo.GetGenericArguments().Length); } } } PropertyInfo[] array3 = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); PropertyInfo[] array4 = array3; for (int j = 0; j < array4.Length; j++) { PropertyInfo propertyInfo = array4[j]; propertyDescriptor propertyDescriptor = null; if (!this.instanceProperties.TryGetValue(propertyInfo.Name, out propertyDescriptor)) { propertyDescriptor = new propertyDescriptor(); this.instanceProperties[propertyInfo.Name] = propertyDescriptor; this.properties.Add(propertyDescriptor); propertyDescriptor.propertyOrder = this.properties.Count - 1; propertyDescriptor.name = propertyInfo.Name; } propertyDescriptor.properties.Add(propertyInfo); propertyDescriptor.maxParameterCount = Math.Max(propertyDescriptor.maxParameterCount, propertyInfo.GetIndexParameters().Length); } FieldInfo[] array5 = t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); FieldInfo[] array6 = array5; for (int k = 0; k < array6.Length; k++) { FieldInfo fieldInfo = array6[k]; fieldDescriptor fieldDescriptor = null; if (!this.instanceFields.TryGetValue(fieldInfo.Name, out fieldDescriptor)) { fieldDescriptor = new fieldDescriptor(); this.instanceFields[fieldInfo.Name] = fieldDescriptor; this.fields.Add(fieldDescriptor); fieldDescriptor.fieldOrder = this.fields.Count - 1; fieldDescriptor.name = fieldInfo.Name; } fieldDescriptor.fieldInfo = fieldInfo; } ConstructorInfo[] constructors = t.GetConstructors(); ConstructorInfo[] array7 = constructors; for (int l = 0; l < array7.Length; l++) { ConstructorInfo constructorInfo = array7[l]; methodDescriptor methodDescriptor2; if (this.constructor == null) { methodDescriptor2 = new methodDescriptor(); this.constructor = methodDescriptor2; this.methods.Add(methodDescriptor2); methodDescriptor2.name = "construct"; methodDescriptor2.methodOrder = this.methods.Count - 1; } else { methodDescriptor2 = this.constructor; } methodDescriptor2.baseMethods.Add(constructorInfo); methodDescriptor2.maxParameterCount = Math.Max(methodDescriptor2.maxParameterCount, constructorInfo.GetParameters().Length); } array = t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); MethodInfo[] array8 = array; for (int m = 0; m < array8.Length; m++) { MethodInfo methodInfo2 = array8[m]; if (!methodInfo2.Name.StartsWith("get_") && !methodInfo2.Name.StartsWith("set_")) { methodDescriptor methodDescriptor3 = null; if (methodInfo2.IsGenericMethod) { string text2 = "generic_" + methodInfo2.Name; if (!this.instanceMethods.TryGetValue(text2, out methodDescriptor3)) { methodDescriptor3 = new methodDescriptor(); this.staticMethods[text2] = methodDescriptor3; methodDescriptor3.isGenericMethod = true; this.methods.Add(methodDescriptor3); methodDescriptor3.methodOrder = this.methods.Count - 1; methodDescriptor3.name = text2; } } else if (!this.staticMethods.TryGetValue(methodInfo2.Name, out methodDescriptor3)) { methodDescriptor3 = new methodDescriptor(); this.staticMethods[methodInfo2.Name] = methodDescriptor3; this.methods.Add(methodDescriptor3); methodDescriptor3.name = methodInfo2.Name; methodDescriptor3.methodOrder = this.methods.Count - 1; } methodDescriptor3.baseMethods.Add(methodInfo2); methodDescriptor3.maxParameterCount = Math.Max(methodDescriptor3.maxParameterCount, methodInfo2.GetParameters().Length); if (methodInfo2.IsGenericMethod) { methodDescriptor3.genericParameterCount = Math.Max(methodDescriptor3.genericParameterCount, methodInfo2.GetGenericArguments().Length); } } } array3 = t.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); PropertyInfo[] array9 = array3; for (int n = 0; n < array9.Length; n++) { PropertyInfo propertyInfo2 = array9[n]; propertyDescriptor propertyDescriptor2 = null; if (!this.staticProperties.TryGetValue(propertyInfo2.Name, out propertyDescriptor2)) { propertyDescriptor2 = new propertyDescriptor(); this.staticProperties[propertyInfo2.Name] = propertyDescriptor2; this.properties.Add(propertyDescriptor2); propertyDescriptor2.propertyOrder = this.properties.Count - 1; propertyDescriptor2.name = propertyInfo2.Name; } propertyDescriptor2.properties.Add(propertyInfo2); propertyDescriptor2.maxParameterCount = Math.Max(propertyDescriptor2.maxParameterCount, propertyInfo2.GetIndexParameters().Length); } array5 = t.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); FieldInfo[] array10 = array5; for (int num = 0; num < array10.Length; num++) { FieldInfo fieldInfo2 = array10[num]; fieldDescriptor fieldDescriptor2 = null; if (!this.instanceFields.TryGetValue(fieldInfo2.Name, out fieldDescriptor2)) { fieldDescriptor2 = new fieldDescriptor(); this.staticFields[fieldInfo2.Name] = fieldDescriptor2; this.fields.Add(fieldDescriptor2); fieldDescriptor2.fieldOrder = this.fields.Count - 1; fieldDescriptor2.name = fieldInfo2.Name; } fieldDescriptor2.fieldInfo = fieldInfo2; } this.type = t; typeDescriptor.loadedTypes[t] = this; if (compile && typeDescriptor.gencompile) { this.compile(); } }
public typeDescriptor(Type t, string typeName, bool compile = true) { methodDescriptor count; typeDescriptor.loadEvaluator(); if (typeDescriptor.language == null) { typeDescriptor.language = (csharplanguage)jxshell.language.defaultLanguage.create(); } this.typeString = typeName; MethodInfo[] methods = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); for (int i = 0; i < (int)methods.Length; i++) { MethodInfo methodInfo = methods[i]; if ((methodInfo.Name.StartsWith("get_") ? false : !methodInfo.Name.StartsWith("set_"))) { methodDescriptor _methodDescriptor = null; if (methodInfo.IsGenericMethod) { string str = string.Concat("generic_", methodInfo.Name); if (!this.instanceMethods.TryGetValue(str, out _methodDescriptor)) { _methodDescriptor = new methodDescriptor() { isGenericMethod = true }; this.instanceMethods[str] = _methodDescriptor; this.methods.Add(_methodDescriptor); _methodDescriptor.methodOrder = this.methods.Count - 1; _methodDescriptor.name = str; } } else if (!this.instanceMethods.TryGetValue(methodInfo.Name, out _methodDescriptor)) { _methodDescriptor = new methodDescriptor(); this.instanceMethods[methodInfo.Name] = _methodDescriptor; this.methods.Add(_methodDescriptor); _methodDescriptor.methodOrder = this.methods.Count - 1; _methodDescriptor.name = methodInfo.Name; } _methodDescriptor.baseMethods.Add(methodInfo); _methodDescriptor.maxParameterCount = Math.Max(_methodDescriptor.maxParameterCount, (int)methodInfo.GetParameters().Length); if (methodInfo.IsGenericMethod) { _methodDescriptor.genericParameterCount = Math.Max(_methodDescriptor.genericParameterCount, (int)methodInfo.GetGenericArguments().Length); } } } PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int j = 0; j < (int)properties.Length; j++) { PropertyInfo propertyInfo = properties[j]; propertyDescriptor _propertyDescriptor = null; if (!this.instanceProperties.TryGetValue(propertyInfo.Name, out _propertyDescriptor)) { _propertyDescriptor = new propertyDescriptor(); this.instanceProperties[propertyInfo.Name] = _propertyDescriptor; this.properties.Add(_propertyDescriptor); _propertyDescriptor.propertyOrder = this.properties.Count - 1; _propertyDescriptor.name = propertyInfo.Name; } _propertyDescriptor.properties.Add(propertyInfo); _propertyDescriptor.maxParameterCount = Math.Max(_propertyDescriptor.maxParameterCount, (int)propertyInfo.GetIndexParameters().Length); } FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); for (int k = 0; k < (int)fields.Length; k++) { FieldInfo fieldInfo = fields[k]; fieldDescriptor _fieldDescriptor = null; if (!this.instanceFields.TryGetValue(fieldInfo.Name, out _fieldDescriptor)) { _fieldDescriptor = new fieldDescriptor(); this.instanceFields[fieldInfo.Name] = _fieldDescriptor; this.fields.Add(_fieldDescriptor); _fieldDescriptor.fieldOrder = this.fields.Count - 1; _fieldDescriptor.name = fieldInfo.Name; } _fieldDescriptor.fieldInfo = fieldInfo; } ConstructorInfo[] constructors = t.GetConstructors(); for (int l = 0; l < (int)constructors.Length; l++) { ConstructorInfo constructorInfo = constructors[l]; if (this.constructor == null) { methodDescriptor _methodDescriptor1 = new methodDescriptor(); methodDescriptor _methodDescriptor2 = _methodDescriptor1; this.constructor = _methodDescriptor1; count = _methodDescriptor2; this.methods.Add(count); count.name = "construct"; count.methodOrder = this.methods.Count - 1; } else { count = this.constructor; } count.baseMethods.Add(constructorInfo); count.maxParameterCount = Math.Max(count.maxParameterCount, (int)constructorInfo.GetParameters().Length); } MethodInfo[] methodInfoArray = t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod); for (int m = 0; m < (int)methodInfoArray.Length; m++) { MethodInfo methodInfo1 = methodInfoArray[m]; if ((methodInfo1.Name.StartsWith("get_") ? false : !methodInfo1.Name.StartsWith("set_"))) { methodDescriptor name = null; if (methodInfo1.IsGenericMethod) { string str1 = string.Concat("generic_", methodInfo1.Name); if (!this.instanceMethods.TryGetValue(str1, out name)) { name = new methodDescriptor(); this.staticMethods[str1] = name; name.isGenericMethod = true; this.methods.Add(name); name.methodOrder = this.methods.Count - 1; name.name = str1; } } else if (!this.staticMethods.TryGetValue(methodInfo1.Name, out name)) { name = new methodDescriptor(); this.staticMethods[methodInfo1.Name] = name; this.methods.Add(name); name.name = methodInfo1.Name; name.methodOrder = this.methods.Count - 1; } name.baseMethods.Add(methodInfo1); name.maxParameterCount = Math.Max(name.maxParameterCount, (int)methodInfo1.GetParameters().Length); if (methodInfo1.IsGenericMethod) { name.genericParameterCount = Math.Max(name.genericParameterCount, (int)methodInfo1.GetGenericArguments().Length); } } } PropertyInfo[] propertyInfoArray = t.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int n = 0; n < (int)propertyInfoArray.Length; n++) { PropertyInfo propertyInfo1 = propertyInfoArray[n]; propertyDescriptor _propertyDescriptor1 = null; if (!this.staticProperties.TryGetValue(propertyInfo1.Name, out _propertyDescriptor1)) { _propertyDescriptor1 = new propertyDescriptor(); this.staticProperties[propertyInfo1.Name] = _propertyDescriptor1; this.properties.Add(_propertyDescriptor1); _propertyDescriptor1.propertyOrder = this.properties.Count - 1; _propertyDescriptor1.name = propertyInfo1.Name; } _propertyDescriptor1.properties.Add(propertyInfo1); _propertyDescriptor1.maxParameterCount = Math.Max(_propertyDescriptor1.maxParameterCount, (int)propertyInfo1.GetIndexParameters().Length); } FieldInfo[] fieldInfoArray = t.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetField | BindingFlags.SetField); for (int o = 0; o < (int)fieldInfoArray.Length; o++) { FieldInfo fieldInfo1 = fieldInfoArray[o]; fieldDescriptor _fieldDescriptor1 = null; if (!this.instanceFields.TryGetValue(fieldInfo1.Name, out _fieldDescriptor1)) { _fieldDescriptor1 = new fieldDescriptor(); this.staticFields[fieldInfo1.Name] = _fieldDescriptor1; this.fields.Add(_fieldDescriptor1); _fieldDescriptor1.fieldOrder = this.fields.Count - 1; _fieldDescriptor1.name = fieldInfo1.Name; } _fieldDescriptor1.fieldInfo = fieldInfo1; } this.type = t; typeDescriptor.loadedTypes[t] = this; if ((!compile ? false : typeDescriptor.gencompile)) { this.compile(); } }