public Method(string name, MethodBase info) { Name = name; Info = info; var parameters = info.GetParameters(); Parameters = parameters .Select(p => new Parameter(p)) .ToList(); ValueParameters = Parameters .Where(p => p.Type == ParameterType.Value) .ToList(); MondParameterCount = ValueParameters.Count; RequiredMondParameterCount = ValueParameters.Count(p => !p.IsOptional); HasParams = Parameters.Any(p => p.Type == ParameterType.Params); if (info is MethodInfo methodInfo) { ReturnConversion = MondFunctionBinder.MakeReturnConversion(methodInfo.ReturnType); } }
public ParameterGroup(Economy.Economy eco) { this.id = eco.Player.ID; this.values = new List <ValueParameters>(eco.Values.Count); foreach (var value in eco.Values) { this.values.Add(ValueParameters.FromEconomy(eco, value)); } }
async Task <IInstanceNode> BuildNode(ScriptLanguage?language, NodeData node, Guid?nodeid = null) { nodeid ??= Guid.NewGuid(); IInstanceNode instance; switch (node.Type) { case NodeType.Start: instance = new StartNode(nodeid.Value, node.Name, node.Parameters.Deserialize <StartParameters>(), compiler); break; case NodeType.Expression: ExecuteExpressionParameters parameters = node.Parameters.Deserialize <ExecuteExpressionParameters>(); instance = new ExpressionNode(nodeid.Value, node.Name, await compiler.CompileCodeAsync(parameters.Code, parameters.Language)); break; case NodeType.Script: instance = new ScriptNode(nodeid.Value, node.Name, node.Parameters.Deserialize <CallWorkableParameters>(), compiler, language); break; case NodeType.Workflow: instance = new WorkflowInstanceNode(nodeid.Value, node.Name, node.Parameters.Deserialize <CallWorkableParameters>(), compiler, language); break; case NodeType.BinaryOperation: BinaryOpParameters binparameters = node.Parameters.Deserialize <BinaryOpParameters>(); instance = new BinaryNode(nodeid.Value, node.Name, binparameters, compiler); break; case NodeType.Value: ValueParameters valueparameters = node.Parameters.Deserialize <ValueParameters>(); instance = new ValueNode(nodeid.Value, node.Name, valueparameters.Value, compiler); break; case NodeType.Suspend: instance = new SuspendNode(nodeid.Value, node.Name, node.Parameters.Deserialize <SuspendParameters>()); break; case NodeType.Call: instance = new CallNode(nodeid.Value, node.Name, node.Parameters.Deserialize <CallParameters>(), compiler); break; case NodeType.Iterator: instance = new IteratorNode(nodeid.Value, node.Name, node.Parameters.Deserialize <IteratorParameters>(), compiler); break; case NodeType.Log: instance = new LogNode(nodeid.Value, node.Name, compiler, node.Parameters.Deserialize <LogParameters>()); break; default: instance = new InstanceNode(nodeid.Value, node.Name); break; } if (!string.IsNullOrEmpty(node.Variable)) { instance = new AssignStateNode(instance, node.Variable, node.VariableOperation, compiler); } return(instance); }