public HistoricDataAvailability(JSONdn json)
        {
            m_start = json.getDateTimeFromLongVal("start");
            m_end   = json.getDateTimeFromLongVal("end");

            if (json.has("sources"))
            {
                foreach (string key in json.getKeys("sources"))
                {
                    m_sources.Add(key, new HistoricDataAvailabilitySource(new JSONdn(json.getJVal("sources." + key))));
                }
            }
        }
	    public HistoricDataAvailability(JSONdn json)
        {
		    m_start = json.getDateTimeFromLongVal("start");
            m_end = json.getDateTimeFromLongVal("end");
		    
            if (json.has("sources"))
            {
                foreach (string key in json.getKeys("sources"))
                {
			        m_sources.Add(key, new HistoricDataAvailabilitySource(new JSONdn(json.getJVal("sources." + key))));
                }
            }
	    }
	    public HistoricDataAvailabilitySource(JSONdn json)
        {
		    m_status = json.getIntVal("status");

            foreach (JToken version in json.getJVal("versions"))
	        {
		        m_versions.Add(Convert.ToInt32(version.ToString()));
	        }
            
            foreach (string key in json.getKeys("augmentations"))
            {
			    m_augmentations.Add(key, json.getIntVal("augmentations." + key));
		    }
	    }
예제 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="data">The JSON API response.</param>
        public Dpu(JSONdn data)
        {
            m_dpu = new Dictionary <string, DpuItem>();

            foreach (string key in data.getKeys("detail"))
            {
                DpuItem item = new DpuItem(data.getIntVal("detail." + key + ".count"), data.getDoubleVal("detail." + key + ".dpu"));

                if (data.has("detail." + key + ".targets"))
                {
                    JToken t = data.getJVal("detail." + key + ".targets");
                    foreach (string targetkey in data.getKeys("detail." + key + ".targets"))
                    {
                        JSONdn t2 = new JSONdn(t[targetkey]);
                        item.addTarget(targetkey, new DpuItem(t2.getIntVal("count"), t2.getDoubleVal("dpu")));
                    }
                }

                m_dpu.Add(key, item);
            }

            m_total = data.getDoubleVal("dpu");
        }
예제 #5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="data">The JSON API response.</param>
        public Dpu(JSONdn data)
        {
            m_dpu = new Dictionary<string, DpuItem>();

            foreach (string key in data.getKeys("detail"))
            {
                DpuItem item = new DpuItem(data.getIntVal("detail." + key + ".count"), data.getDoubleVal("detail." + key + ".dpu"));

                if (data.has("detail." + key + ".targets"))
                {
                    JToken t = data.getJVal("detail." + key + ".targets");
                    foreach (string targetkey in data.getKeys("detail." + key + ".targets"))
                    {
                        JSONdn t2 = new JSONdn(t[targetkey]);
                        item.addTarget(targetkey, new DpuItem(t2.getIntVal("count"), t2.getDoubleVal("dpu")));
                    }
                }

                m_dpu.Add(key, item);
            }

            m_total = data.getDoubleVal("dpu");
        }
        public HistoricDataAvailabilitySource(JSONdn json)
        {
            m_status = json.getIntVal("status");

            foreach (JToken version in json.getJVal("versions"))
            {
                m_versions.Add(Convert.ToInt32(version.ToString()));
            }

            foreach (string key in json.getKeys("augmentations"))
            {
                m_augmentations.Add(key, json.getIntVal("augmentations." + key));
            }
        }
 /// <summary>
 /// Recursive method to parse a tree in JSON into the flat
 /// dot-notation parameters used by the API.
 /// </summary>
 /// <param name="json">The JSON object.</param>
 /// <param name="key_prefix">The current key prefix.</param>
 protected void setOutputParams(JSONdn json, string key_prefix)
 {
     foreach (string key in json.getKeys())
     {
         string full_key = (key_prefix.Length == 0 ? "" : key_prefix + ".") + key;
         if (json.hasChildren(key))
         {
             setOutputParams(new JSONdn(json.getJVal(key)), full_key);
         }
         else
         {
             set(full_key, json.getStringVal(key));
         }
     }
 }
예제 #8
0
 /// <summary>
 /// Get an array of the stream hashes for which there is usage data.
 /// </summary>
 /// <returns>An array of stream hashes.</returns>
 public string[] getStreamHashes()
 {
     return(m_data.getKeys("streams"));
 }