예제 #1
0
    public void Processjson(string jsonString)
    {
        tags.text = "RFID Tägit:" + "\n" + "\n";
        JsonData  jsonvale = JsonMapper.ToObject(jsonString);
        parseJSON parsejson;

        parsejson          = new parseJSON();
        parsejson.Name     = jsonvale["Name"].ToString();
        parsejson.Time     = jsonvale["Expiry"].ToString();
        parsejson.readTags = new ArrayList();
        for (int i = 0; i < jsonvale["rfidDataToString"].Count; i++)
        {
            parsejson.readTags.Add(jsonvale["rfidDataToString"][i].ToString());
        }
        foreach (string tagi in parsejson.readTags)
        {
            Debug.Log(tagi.ToString());
            tags.text = tags.text + tagi.ToString() + "\n";
        }
        if (parsejson.readTags.Count > 0)
        {
            currentTag = parsejson.readTags[0].ToString();
        }
        Debug.Log(parsejson.Name);
        Debug.Log(parsejson.Time);
        StartCoroutine(GetRfidValues(url, method));
    }
예제 #2
0
    private void Processjson(string jsonString)
    {
        current_data = new List <Data>();
        JsonData  jsonvale = JsonMapper.ToObject(jsonString);
        parseJSON parsejson;

        parsejson = new parseJSON();
//		current_data = new Data[5];
//		parsejson.title = jsonvale["title"].ToString();
//		parsejson.id = jsonvale["ID"].ToString();

        parsejson.id        = new ArrayList();
        parsejson.timestamp = new ArrayList();
        parsejson.label     = new ArrayList();
        parsejson.value     = new ArrayList();
        parsejson.note      = new ArrayList();

//		Debug.Log (jsonvale.Count);
//		Debug.Log (jsonvale[0]["id"].ToString());
        for (int i = 0; i < 5; i++)
        {
            parsejson.id.Add(jsonvale[i]["id"].ToString());
//			parsejson.timestamp.Add(jsonvale[i]["timestamp"].ToString());
            parsejson.label.Add(jsonvale[i]["label"].ToString());
            //parsejson.value.Add(jsonvale[i]["value"].ToString());
            parsejson.note.Add(jsonvale[i]["note"].ToString());
        }

        for (int i = 0; i < 5; i++)
        {
            current_data.Add(new Data((string)parsejson.id [i], (string)parsejson.label [i], (string)parsejson.note [i]));
        }
    }
    // these method will be called when user hit language button
    void LanguageChoice(string Json, String LanguagePressed)
    {
        #region  set used Variables values to zero
        urlList_Counter       = 0;
        slider.value          = 0;
        AfterPercentage_Value = 0;
        downloaded            = 0;
        Percentage.text       = "0 ";
        string url = null;
        size = 0.0f;
        float sizePerFile = 0;
        #endregion

        // JsonData Object That holds Json String To process it
        jsonvale  = JsonMapper.ToObject(Json);
        parsejson = new parseJSON();
        // set of voice over links on the server
        parsejson.url = new List <string> ();
        //index from 1 to end of list used in renaming generated sound files on storage
        parsejson.index = new List <int> ();
        // size percentage of each file depend on the complete size of all sound-clips ex: 4.45 MB(size of clip)/25 Mb then ratio equal > 0.17
        parsejson.FileSizeRatio = new List <float> ();
        // size of each sound-clip that will be downloaded
        parsejson.FileSize = new List <float> ();

        //if Language Directory Doesn't exist create it depend on language button pressed
        if (!File.Exists(Application.dataPath + "/Resources/" + "Languages/" + LanguagePressed + "/"))
        {
            System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/" + "Languages/" + LanguagePressed + "/");
        }

        // fill Data Class'lists with extracted data from Json String
        for (int i = 1; i < jsonvale["data"]["languages"][LanguagePressed].Count; i++)
        {
            url = Domain + jsonvale["data"]["languages"][LanguagePressed][i]["url"].ToString();
            //url = jsonvale["data"]["languages"][LanguagePressed][i]["url"].ToString ();
            size       += float.Parse(jsonvale["data"]["languages"][LanguagePressed][i]["size"].ToString());
            sizePerFile = float.Parse(jsonvale["data"]["languages"][LanguagePressed][i]["size"].ToString());
            parsejson.url.Add(url);
            parsejson.index.Add(i);
            parsejson.FileSize.Add(sizePerFile);
        }
        // fill list of file size ratio depend on division of (size per file / final size of all files )
        for (int i = 0; i < parsejson.FileSize.Count; i++)
        {
            parsejson.FileSizeRatio.Add(parsejson.FileSize[i] / size);
        }
        // show progressbar when begin the download
        slider0.SetActive(true);
        StartCoroutine(Download_VoiceOverClips(LanguagePressed, parsejson.url[0], parsejson.index[0]));
    }
예제 #4
0
    private void ProcessBooks(string jsonString)
    {
        JsonData jsonvale = JsonMapper.ToObject(jsonString);

        parsejson = new parseJSON();


        {
            s = jsonvale[0]["file_3d"].ToString();

            //OBJ.objPath = s;
            Debug.Log(s);
        }
    }
예제 #5
0
    private void Processjson(string jsonString)
    {
        JsonData  jsonvale = JsonMapper.ToObject(jsonString);
        parseJSON parsejson;

        parsejson           = new parseJSON();
        parsejson.name      = jsonvale["name"].ToString();
        parsejson.salePrice = jsonvale["salePrice"].ToString();
        parsejson.sku       = jsonvale["sku"].ToString();

        if (parsejson.salePrice != prices[parsejson.sku])
        {
            //print("Update Price: " + parsejson.sku + ". Old price - " + prices[parsejson.sku] + ", new price - " + parsejson.salePrice);
            updates.Add(parsejson.sku, parsejson.salePrice);
            updatedSkus.text = "SKU's updated: " + updates.Count.ToString();
            accuracy.text    = "Accuracy: " + (((float)(keys.Count - updates.Count) / (float)keys.Count) * 100).ToString("F0") + "%";
        }
    }
예제 #6
0
    public void Read(string path)
    {
        parseJSON parsejson = new parseJSON();


        TextAsset targetFile = Resources.Load <TextAsset>(path);

        parsejson = JsonUtility.FromJson <parseJSON>(targetFile.text);
        //Debug.Log(parsejson.x);
        if (parsejson.x.Length > 0)
        {
            vectors = new Vector3[parsejson.x.Length];
            for (int i = 0; i < parsejson.x.Length; i++)
            {
                vectors[i] = new Vector3(parsejson.x[i], parsejson.y[i], parsejson.z[i]);
            }
        }
    }
예제 #7
0
    private void Processjson(string jsonString)
    {
        JsonData  jsonvale = JsonMapper.ToObject(jsonString);
        parseJSON parsejson;

        parsejson = new parseJSON();


        parsejson.width  = (int)jsonvale["layers"][0]["width"];
        parsejson.height = (int)jsonvale["layers"][0]["height"];



        for (int i = 0; i < jsonvale["layers"][0]["data"].Count; i++)
        {
            parsejson.mapList.Add((int)jsonvale ["layers"] [0] ["data"] [i] - 1);
        }

        DrawMap(parsejson.mapList, parsejson.width, parsejson.height);
    }
    private void Processjson(string jsonString)
    {
        JsonData  jsonvale = JsonMapper.ToObject(jsonString);
        parseJSON parsejson;

        parsejson = new parseJSON();


        //Data is the JSON OBJECT Which Have The Key Username
        //0 is the index of json object

        parsejson.username     = jsonvale ["data"][0]["username"].ToString();
        parsejson.company_name = jsonvale ["data"][0]["company_name"].ToString();
        parsejson.email        = jsonvale ["data"][0]["email"].ToString();
        parsejson.phone        = jsonvale ["data"][0]["phone"].ToString();
        parsejson.status       = jsonvale ["data"][0]["status"].ToString();
        //-----//----//

        TXT_1.text = parsejson.username;
        Txt_2.text = parsejson.company_name;
    }
    private void Processjson(string jsonString)
    {
        JsonData jsonvale = JsonMapper.ToObject(jsonString);

        parsejson = new parseJSON();

        parsejson.but_code   = new ArrayList();
        parsejson.but_active = new ArrayList();
        parsejson.but_total  = new ArrayList();
        parsejson.but_death  = new ArrayList();

        for (int i = 0; i < jsonvale["statewise"].Count; i++)
        {
            parsejson.but_code.Add(jsonvale["statewise"][i]["statecode"].ToString());
            parsejson.but_active.Add(jsonvale["statewise"][i]["active"].ToString());
            parsejson.but_total.Add(jsonvale["statewise"][i]["confirmed"].ToString());
            parsejson.but_death.Add(jsonvale["statewise"][i]["deaths"].ToString());
        }

        ColorChangeDueToCaese();
    }
예제 #10
0
    IEnumerator Start()
    {
        parsejson = new parseJSON();
        Refresh_btn.SetActive(false);
        Title.gameObject.SetActive(false);
        for (int i = 0; i < Choice.Length; i++)
        {
            Choice[i].transform.parent.gameObject.SetActive(false);
        }
        string url = "https://private-5b1d8-sampleapi187.apiary-mock.com/questions";
        WWW    www = new WWW(url);

        yield return(www);

        if (www.error == null)
        {
            Processjson(www.data);
        }
        else
        {
            Debug.Log("ERROR: " + www.error);
        }
    }