public static Data.Inputs.MethodParamPair GenerateMethodFromString(string input) { Data.Inputs.MethodParamPair output = null; string[] temp = input.Split(';'); string methodName = temp[0].ToLower(); switch (methodName) { case "addgold": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); try { MethodParamResult method = AdjustGold; IntInput parameter = new IntInput(); parameter.Input = int.Parse(temp[1]); //output = new MethodParamPair(method, parameter); } catch { EquestriEngine.ErrorMessage = "Error Creating MethodParamPair"; } break; } case "addexp": { MethodParamResult method = AdjustGold; IntInput parameter = new IntInput(); parameter.Input = int.Parse(temp[1]); //output = new MethodParamPair(method, parameter); break; } case "toggleswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); MethodParamResult method = ToggleSwitch; StringInput parameter = new StringInput(); parameter.Input = temp[1]; //output = new MethodParamPair(method, parameter); break; } case "activateswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); break; } case "deactivateswitch": { if (temp.Length != 2) throw new EngineException("Incorrect number of parameters passed", false); break; } default: throw new EngineException("Method name Not Found", false); } return output; }
public static Data.Inputs.MethodParamPair GenerateMethodFromArgs(string method, string[] param, string[] paths) { MethodParamPair output = null; ExitPathGroup methodPaths = new ExitPathGroup(); for (int i = 0; i < paths.Length; i++) { var temp = paths[i].Split(';'); if (temp.Length != 2) throw new EngineException("Invalid path size",true); int rawResult = int.Parse(temp[i]), nextMethod; MethodResult result = (MethodResult)rawResult; nextMethod = int.Parse(temp[1]); methodPaths[result] = nextMethod; } switch (method.ToLower()) { case "addgold": { break; } case "conditional": { ConditionInput conditionInput = new ConditionInput(); break; } case "addexp": { break; } case "toggleswitch": { break; } case "activateswitch": { break; } case "deactivateswitch": { break; } case "showmessagebox": { string messageBoxInput = ""; for (int i = 0; i < param.Length; i++) { messageBoxInput += param[i] + "\n"; } StringInput methodInput = new StringInput() { Input = messageBoxInput }; output = new MethodParamPair(ShowMessageBox, methodInput, methodPaths); break; } default: throw new EngineException("Method name Not Found", false); } return output; }