protected JsonResult Result(object result, RETURN_TYPE type, string errorMessage) { return(Json(new ReturnModel() { result = result, message = errorMessage, type = type })); }
/// <summary> /// 增加属性节点 /// </summary> /// <param name="key">属性</param> /// <param name="handler">处理函数为null时将用默认FormatPropertyValue函数,否则用附加的函数处理</param> /// <returns></returns> private void AddKeyFunction(string propName, RETURN_TYPE returnType = RETURN_TYPE.Int, PropEventHanlder handler = null, int precision = 0) { PropNode node = new PropNode(); node.key = propName; node.returnType = returnType; node.handler = handler; node.precision = precision; m_nodeList.Add(propName, node); }
static void Main(string[] args) { Console.WriteLine("TYPE RETURN, a game by Studiosi"); Console.WriteLine("You are a desperate programmer, trying to exit a function desperately... TYPE RETURN!"); Console.WriteLine("(Note: Your keyboard might be broken)"); Console.WriteLine("Press enter to continue..."); Console.ReadLine(); Console.Clear(); // Changing the mapping of the characters ReturnChecker rc = new ReturnChecker(); rc.generateEncoding(); int fails = MAX_FAILS; while (fails > 0) { Console.WriteLine(String.Format("Iterations left: {0}", fails)); Console.Write("> "); string inStr = Console.ReadLine(); inStr = inStr.ToUpper(); string translatedStr = rc.translateString(inStr); RETURN_TYPE ret = rc.checkString(translatedStr); if (ret == RETURN_TYPE.SUCCESS) { Console.WriteLine("Exiting! Success!"); break; } else if (ret == RETURN_TYPE.ERROR_LENGTH) { Console.WriteLine("SYNTAX ERROR: Command exceeded maximum length"); fails--; } else if (ret == RETURN_TYPE.ERROR) { Console.WriteLine("Executing command... " + translatedStr); Console.WriteLine("SYNTAX ERROR"); fails--; } } if (fails == 0) { Console.WriteLine("You did not succeed... now the whole world is destroyed."); } Console.ReadLine(); }