public void loadManyTypes(string types) { string[] array = types.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); StringBuilder stringBuilder = new StringBuilder(); typeDescriptor.addUsingsStatements(stringBuilder); Dictionary <Type, type_1> dictionary = new Dictionary <Type, type_1>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string typeName = array2[i]; Type typeOrGenericType = this.getTypeOrGenericType(typeName); typeDescriptor typeDescriptor = new typeDescriptor(typeOrGenericType, typeName, false); if (!typeDescriptor.isCompiled()) { string staticClass = ""; string instanceClass = ""; typeDescriptor.precompile(stringBuilder, ref staticClass, ref instanceClass); dictionary[typeOrGenericType] = new type_1 { td = typeDescriptor, staticClass = staticClass, instanceClass = instanceClass, t = typeOrGenericType }; } } stringBuilder.AppendLine("class program{public static void main(){}}"); csharplanguage csharplanguage = (csharplanguage)language.defaultLanguage.create(); if (dictionary.Count > 0) { csharplanguage.runScript(stringBuilder.ToString(), typeDescriptor.generateInMemory); } foreach (KeyValuePair <Type, type_1> current in dictionary) { type_1 value = current.Value; Type type = csharplanguage.getCompiledAssembly().GetType("jxshell.dotnet4." + value.staticClass); ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(Type), typeof(typeDescriptor) }); value.td.setCompiledWrapper((wrapperStatic)constructor.Invoke(new object[] { value.t, value.td })); } }
public static wrapperStatic loadFromType(Type t) { wrapperStatic wrapperStatic; if (!wrapperStatic.wrappersStatic.TryGetValue(t, out wrapperStatic)) { typeDescriptor typeDescriptor = typeDescriptor.loadFromType(t); wrapperStatic = typeDescriptor.compile(); wrapperStatic.wrappersStatic[t] = wrapperStatic; } return(wrapperStatic); }
public static typeDescriptor loadFromType(Type t, string typeName, bool compile = true) { typeDescriptor typeDescriptor; typeDescriptor result; if (!typeDescriptor.loadedTypes.TryGetValue(t, out typeDescriptor)) { result = new typeDescriptor(t, typeName, compile); } else { result = typeDescriptor; } return(result); }
public static typeDescriptor loadFromType(Type t) { typeDescriptor typeDescriptor; typeDescriptor result; if (!typeDescriptor.loadedTypes.TryGetValue(t, out typeDescriptor)) { result = new typeDescriptor(t); } else { result = typeDescriptor; } return(result); }
public wrapper getObjectAsType(object o, object xt) { Type type; if (xt is wrapper) { wrapper wrapper = (wrapper)xt; type = (Type)wrapper.wrappedObject; } else { type = this.getTypeOrGenericType(xt.ToString()); } object o2 = Convert.ChangeType(o, type); typeDescriptor td = typeDescriptor.loadFromType(type); return(wrapper.createWrapper(o2, td)); }
public VFPHelper vfpHelper(typeDescriptor typeD) { return(new VFPHelper(typeD)); }
public delegateWrapper(object o, typeDescriptor td) : base(o, td) { }
public wrapperStatic(Type t, typeDescriptor td) { this.wrappedObject = t; this.wrappedType = t; this.typeD = td; }
public delegateWrapperStatic(Type t, typeDescriptor td) : base(t, td) { }
public VFPHelper(typeDescriptor typeD) { this.typeD = typeD; }
public static wrapper createWrapper(object o, typeDescriptor td) { return(td.compile().getWrapper(o)); }
public wrapper(object o, typeDescriptor td) { this.wrappedObject = o; this.wrappedType = o.GetType(); this.typeD = td; }
public static wrapper createWrapper(object o) { typeDescriptor typeDescriptor = typeDescriptor.loadFromType(o.GetType()); return(typeDescriptor.compile().getWrapper(o)); }
public enumWrapper(object o, typeDescriptor td) : base(o, td) { }