コード例 #1
0
	    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))));
                }
            }
	    }
コード例 #2
0
        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))));
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Initialise this object from teh data in a JSON object.
        /// </summary>
        /// <param name="data">The JSON object.</param>
        public void init(JSONdn data)
        {
            if (!data.has("id"))
            {
                throw new ApiException("No playback ID in the response");
            }
            if (m_playback_id.Length > 0 && m_playback_id.CompareTo(data.getStringVal("id")) != 0)
            {
                throw new ApiException("Incorrect playback ID in the response");
            }
            m_playback_id = data.getStringVal("id");

            if (!data.has("definition_id"))
            {
                throw new ApiException("No definition hash in the response");
            }
            m_stream_hash = data.getStringVal("definition_id");

            if (!data.has("name"))
            {
                throw new ApiException("No name in the response");
            }
            m_name = data.getStringVal("name");

            if (!data.has("start"))
            {
                throw new ApiException("No start timestamp in the response");
            }
            m_start_date = data.getDateTimeFromLongVal("start");

            if (!data.has("end"))
            {
                throw new ApiException("No end timestamp in the response");
            }
            m_end_date = data.getDateTimeFromLongVal("end");

            if (!data.has("created_at"))
            {
                throw new ApiException("No created at timestamp in the response");
            }
            m_created_at = data.getDateTimeFromLongVal("created_at");

            if (!data.has("status"))
            {
                throw new ApiException("No status in the response");
            }
            m_status = data.getStringVal("status");

            if (!data.has("progress"))
            {
                throw new ApiException("No progress in the response");
            }
            m_progress = data.getIntVal("progress");

            if (!data.has("sources"))
            {
                throw new ApiException("No sources in the response");
            }
            m_sources.Clear();
            foreach (JToken source in data.getJVal("sources"))
            {
                m_sources.Add(source.ToString());
            }

            if (!data.has("sample"))
            {
                throw new ApiException("No sample in the response");
            }
            m_sample = data.getDoubleVal("sample");

        }
コード例 #4
0
        /// <summary>
        /// Initialise this object from teh data in a JSON object.
        /// </summary>
        /// <param name="data">The JSON object.</param>
        public void init(JSONdn data)
        {
            if (!data.has("id"))
            {
                throw new ApiException("No playback ID in the response");
            }
            if (m_playback_id.Length > 0 && m_playback_id.CompareTo(data.getStringVal("id")) != 0)
            {
                throw new ApiException("Incorrect playback ID in the response");
            }
            m_playback_id = data.getStringVal("id");

            if (!data.has("definition_id"))
            {
                throw new ApiException("No definition hash in the response");
            }
            m_stream_hash = data.getStringVal("definition_id");

            if (!data.has("name"))
            {
                throw new ApiException("No name in the response");
            }
            m_name = data.getStringVal("name");

            if (!data.has("start"))
            {
                throw new ApiException("No start timestamp in the response");
            }
            m_start_date = data.getDateTimeFromLongVal("start");

            if (!data.has("end"))
            {
                throw new ApiException("No end timestamp in the response");
            }
            m_end_date = data.getDateTimeFromLongVal("end");

            if (!data.has("created_at"))
            {
                throw new ApiException("No created at timestamp in the response");
            }
            m_created_at = data.getDateTimeFromLongVal("created_at");

            if (!data.has("status"))
            {
                throw new ApiException("No status in the response");
            }
            m_status = data.getStringVal("status");

            if (!data.has("progress"))
            {
                throw new ApiException("No progress in the response");
            }
            m_progress = data.getIntVal("progress");

            if (!data.has("sources"))
            {
                throw new ApiException("No sources in the response");
            }
            m_sources.Clear();
            foreach (JToken source in data.getJVal("sources"))
            {
                m_sources.Add(source.ToString());
            }

            if (!data.has("sample"))
            {
                throw new ApiException("No sample in the response");
            }
            m_sample = data.getDoubleVal("sample");
        }