//操作符函数无法通过继承metatable实现 static void GenBaseOpFunction(List <_MethodBase> list) { Type baseType = type.BaseType; while (baseType != null) { if (allTypes.IndexOf(baseType) >= 0) { MethodInfo[] methods = baseType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase); for (int i = 0; i < methods.Length; i++) { MetaOp baseOp = GetOp(methods[i].Name); if (baseOp != MetaOp.None && (op & baseOp) == 0) { if (baseOp != MetaOp.ToStr) { list.Add(new _MethodBase(methods[i])); } op |= baseOp; } } } baseType = baseType.BaseType; } }
public static void Clear() { className = null; type = null; baseType = null; isStaticClass = false; usingList.Clear(); op = MetaOp.None; sb = new StringBuilder(); fields = null; props = null; methods.Clear(); allProps.Clear(); propList.Clear(); eventList.Clear(); ctorList.Clear(); ctorExtList.Clear(); ambig = ObjAmbig.NetObj; wrapClassName = ""; libClassName = ""; extendName = ""; eventSet.Clear(); extendType = null; nameCounter.Clear(); events = null; getItems.Clear(); setItems.Clear(); }
public static void Clear() { className = null; type = null; baseType = null; isStaticClass = false; op = MetaOp.None; sb = new StringBuilder(); fields = null; wrapClassName = ""; //getItems.Clear(); //setItems.Clear(); }
private void ApplyEntryToInput(Entry entry) { MetaInput inputToUpdate = GetInputToUpdate(); inputToUpdate.OpPart = BasicMetaTypes.GetMetaOperatorPartOf(entry.FunctionType); inputToUpdate.Name = entry.Name; inputToUpdate.DefaultValue = entry.DefaultValue; inputToUpdate.Relevance = entry.Relevance; inputToUpdate.IsMultiInput = entry.IsMultiInput; if (entry.FunctionType == FunctionType.Float) { ApplyFloatEntriesToInput(entry); } MetaOp.UpdateInput(inputToUpdate); }
public void Do() { var inputDefinition = CreateMetaInput(); if (_applyProperties) { inputDefinition.IsMultiInput = _isMultiInput; inputDefinition.Relevance = _relevance; inputDefinition.Description = _description; inputDefinition.Min = _min; inputDefinition.Max = _max; inputDefinition.Scale = _scale; inputDefinition.ScaleType = _scaleType; inputDefinition.EnumValues = new List <MetaInput.EnumEntry>(_enumValues); } MetaOp.AddInput(inputDefinition); }
static bool IsNeedOp(string name) { if (name == "op_Addition") { op |= MetaOp.Add; } else if (name == "op_Subtraction") { op |= MetaOp.Sub; } else if (name == "op_Equality") { op |= MetaOp.Eq; } else if (name == "op_Multiply") { op |= MetaOp.Mul; } else if (name == "op_Division") { op |= MetaOp.Div; } else if (name == "op_UnaryNegation") { op |= MetaOp.Neg; } else if (name == "ToString" && !isStaticClass) { op |= MetaOp.ToStr; } else { return(false); } return(true); }
static bool IsNeedOp(string name) { if (name == "op_Addition") { op |= MetaOp.Add; } else if (name == "op_Subtraction") { op |= MetaOp.Sub; } else if (name == "op_Equality") { op |= MetaOp.Eq; } else if (name == "op_Multiply") { op |= MetaOp.Mul; } else if (name == "op_Division") { op |= MetaOp.Div; } else if (name == "op_UnaryNegation") { op |= MetaOp.Neg; } else if (name == "ToString" && !isStaticClass) { op |= MetaOp.ToStr; } else { return false; } return true; }
//操作符函数无法通过继承metatable实现 static void GenBaseOpFunction(List<MethodInfo> list) { Type baseType = type.BaseType; while (baseType != null) { if (allTypes.IndexOf(baseType) >= 0) { MethodInfo[] methods = baseType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase); for (int i = 0; i < methods.Length; i++) { MetaOp baseOp = GetOp(methods[i].Name); if (baseOp != MetaOp.None && (op & baseOp) == 0) { if (baseOp != MetaOp.ToStr) { list.Add(methods[i]); } op |= baseOp; } } } baseType = baseType.BaseType; } }
public static void Clear() { className = null; type = null; isStaticClass = false; baseClassName = null; usingList.Clear(); op = MetaOp.None; sb = new StringBuilder(); methods = null; fields = null; props = null; propList.Clear(); ambig = ObjAmbig.NetObj; wrapClassName = ""; libClassName = ""; }
public void Undo() { MetaOp.RemoveInput(_newInputID); }