public static EModel CreateModelFromObject(object value, Type type) { EModel model = CreateModelFromBuilder(EClone.GetCloneBuilder(value, type), type); model.Value = value; return(model); }
public ComplexType LField(string fieldName) { FieldInfo info = Struction.Fields[fieldName]; Type type = info.FieldType; //静态字段 if (info.IsStatic) { if (type.IsValueType && !type.IsPrimitive) { il.REmit(OpCodes.Ldsflda, info); } else { il.REmit(OpCodes.Ldsfld, info); } } else { //加载地址 This(); if (type.IsValueType && !type.IsPrimitive) { il.REmit(OpCodes.Ldflda, info); } else { il.REmit(OpCodes.Ldfld, info); } } //如果单独加载了bool类型的值 il.BoolInStack(type); return EModel.CreateModelFromAction(null, type); }
public EModel Dup() { ILGenerator il = ThreadCache.GetIL(); il.Dup(); return(EModel.CreateModelFromAction(null, _typeHandler)); }
public static EModel CreateDynamicClass(string classKey, int parameterIndex) { EModel instance = null; if (ClassCache.DynamicClassDict.ContainsKey(classKey)) { Type type = ClassCache.DynamicClassDict[classKey]; instance = new EModel(parameterIndex, type); } return(instance); }
public static EModel CreateDynamicClass(string classKey, LocalBuilder builder) { EModel instance = null; if (ClassCache.DynamicClassDict.ContainsKey(classKey)) { Type type = ClassCache.DynamicClassDict[classKey]; instance = new EModel(builder, type); } return(instance); }
//操作动态类 public static EModel CreateDynamicClass(string classKey) { EModel model = null; if (ClassCache.DynamicClassDict.ContainsKey(classKey)) { Type type = ClassCache.DynamicClassDict[classKey]; model = new EModel(type); } return(model); }
public ComplexType EMethod(string methodName, Action<ILGenerator> actionLoadValue) { MethodInfo info = Struction.Methods[methodName]; if (info.IsStatic) { actionLoadValue(il); il.REmit(OpCodes.Call, info); } else { This(); actionLoadValue(il); il.REmit(OpCodes.Callvirt, info); } il.BoolInStack(info.ReturnType); return EModel.CreateModelFromAction(null, Struction.TypeHandler); }
public static EMethod Load(EModel value) { EMethod instance; if (value.DelayAction != null) { instance = value.CompareType; value.DelayAction(); } else { instance = value.TypeHandler; value.This(); } return(instance); }
public ComplexType LPropertyValue(string propertyName) { PropertyInfo info = Struction.Properties[propertyName]; Type type = info.PropertyType; MethodInfo method = info.GetGetMethod(true); //静态属性 if (method.IsStatic) { il.REmit(OpCodes.Call, method); } else { This(); il.REmit(OpCodes.Callvirt, method); } il.BoolInStack(type); return EModel.CreateModelFromAction(null, type); }
public ComplexType LFieldValue(string fieldName) { FieldInfo info = Struction.Fields[fieldName]; Type type = info.FieldType; //静态字段 if (info.IsStatic) { il.REmit(OpCodes.Ldsfld, info); } else { This(); il.REmit(OpCodes.Ldfld, info); } //如果单独加载了bool类型的值 if (type == typeof(bool)) { ThreadCache.SetJudgeCode(OpCodes.Brfalse_S); } return EModel.CreateModelFromAction(null, type); }
public static EModel CreateModelFromAction(Action action, Type type) { EModel model = new EModel(type, action); return(model); }
public static EModel CreateModelFromBuilder(LocalBuilder builder, Type type) { EModel model = new EModel(builder, type); return(model); }
public static EModel CreateModelFromParameter(int parametersIndex, Type type) { EModel model = new EModel(parametersIndex, type); return(model); }