Beispiel #1
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");
        }
Beispiel #2
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");
        }
Beispiel #3
0
 /// <summary>
 /// Add a target to this item.
 /// </summary>
 /// <param name="target">The name of the target.</param>
 /// <param name="dpuItem">The DPU details for the target.</param>
 public void addTarget(string target, DpuItem dpuItem)
 {
     m_targets.Add(target, dpuItem);
 }
Beispiel #4
0
 /// <summary>
 /// Add a target to this item.
 /// </summary>
 /// <param name="target">The name of the target.</param>
 /// <param name="dpuItem">The DPU details for the target.</param>
 public void addTarget(string target, DpuItem dpuItem)
 {
     m_targets.Add(target, dpuItem);
 }