Exemple #1
0
    protected override void DataParser(JSONObject jsonObject)
    {
        int        code    = API_Helper.GetCode(jsonObject);
        string     message = API_Helper.GetMessage(jsonObject);
        JSONObject result  = null;

        if (API_Code.CodeIsNoContentUpdated(code))
        {
            var localSaveJson = new JSONObject(localSaveJsonString);
            result = API_Helper.GetResult(localSaveJson);
        }
        else if (jsonObject.HasField("result"))
        {
            result = API_Helper.GetResult(jsonObject);

            if (API_Code.CodeIsNormalSuccess(code))
            {
                var fileStream = File.CreateText(filePath);
                fileStream.Write(jsonObject.Print());
                fileStream.Close();
            }
        }

        OnRequestDataSuccess(code, message, result);
    }
Exemple #2
0
    protected void CheckCode(JSONObject data)
    {
        int code = API_Helper.GetCode(data);

        if (!API_Code.CodeIsNormalSuccess(code))
        {
            string errorMessage = API_Helper.GetMessage(data);
            error = new ErrorServerRequest(code, errorMessage);
        }
    }