Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SFS2XItemAttrib[] GetSFS2XItemAttribFromJSON(string input) {
- if (input [0] == '"') {
- input = ReviseJSONResponse (input);
- }
- JSONNode response = JSON.Parse (input);
- JSONNode data = null;
- try {
- data = JSON.Parse (response ["itens"].ToString ());
- } catch (Exception e) {
- Log ("Exception: " + e.ToString());
- Log ("Input: " + input);
- WindowAlert.Show ("Erro na leitura", "Não foi possível ler as informações vindas do banco de dados, isso pode ter ocorrido devido a alguma inconsistência nos dados, por favor, entre em contato o nosso suporte.", delegate {
- SFS2XManager.Instance.SetState(SFS2XManager.STATE_LOGOUT_REQUEST);
- SFS2XManager.Instance.Disconnect();
- });
- return null;
- }
- SFS2XItemAttrib[] acquiredItemsReceived = new SFS2XItemAttrib[data.Count];
- for (int i = 0; i < data.Count; i ++) {
- try {
- acquiredItemsReceived[i] = new SFS2XItemAttrib(int.Parse(data[i]["id"]), int.Parse(data[i]["color"]));
- } catch (Exception e) {
- Log ("Exception: " + e.ToString());
- acquiredItemsReceived[i] = new SFS2XItemAttrib(int.Parse(data[i]["id"]));
- }
- }
- return acquiredItemsReceived;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement