Esempio n. 1
0
        public Hashtable parseResult(NameValueCollection res)
        {
            Hashtable reqData = new Hashtable();

            reqData["secretKey"]  = this.apiKey;
            reqData["apiVersion"] = this.Version.ToString();


            JSONAPI reqHandler = new JSONAPI(this.apiKey, this.Version);

            Hashtable result = new Hashtable();

            switch ((string)res["cmd"])
            {
            default:
                throw new Exception(string.Format("{0} is not a valid cmd.", res["cmd"]));

            case "me:playerInfo":
                result = reqHandler.Me.getPlayerInfo(Me);
                break;

            case "me:gameStats":
                result = reqHandler.Me.getGameStats(Me);
                break;

            case "me:items":
                result = reqHandler.Me.getItems(Me);
                break;

            case "me:allStats":
                result = reqHandler.Me.getAllStats(Me);
                break;

            case "chat:send":
                LuaAPI.SendChatMessage(
                    LuaAPI.cs(res["msg"]),
                    LuaAPI.cs(res["chatType"]),
                    LuaAPI.cs(res["language"]),
                    LuaAPI.cs(res["channel"])
                    );
                break;

            case "game:getScreenshots":
                result = reqHandler.Game.getScreenshots(getScreenshotDir());
                break;

            case "game:takeScreenshot":
                result = reqHandler.Game.takeScreenshot(getScreenshotDir());
                break;

            case "bot:start":
                result = reqHandler.Bot.start();
                break;

            case "chat:logs":
                result = reqHandler.Chat.logs(chatLogs, res["EventName"]);
                break;

            case "bot:isRunning":
                result = reqHandler.Bot.isRunning();
                break;

            case "bot:stop":
                result = reqHandler.Bot.stop();
                break;
            }
            reqData["result"] = result;


            return(reqData);
        }