예제 #1
0
        internal override object ApiSerializeImpl(bool withClean = false)
        {
            object ret = new System.Collections.Generic.Dictionary <string, object> {
            };

            if (withClean || this.N_status)
            {
                Util.SetByPath(ret, "Status", this.M_status);
            }
            if (withClean || this.N_beforeStatus)
            {
                Util.SetByPath(ret, "BeforeStatus", this.M_beforeStatus);
            }
            if (withClean || this.N_statusChangedAt)
            {
                Util.SetByPath(ret, "StatusChangedAt", this.M_statusChangedAt == null ? ((string)(null)) : Util.Date2str(this.M_statusChangedAt));
            }
            if (withClean || this.N_isoImage)
            {
                Util.SetByPath(ret, "CDROM", withClean ? (this.M_isoImage == null ? ((IsoImage)(null)) : this.M_isoImage.ApiSerialize(withClean)) : (this.M_isoImage == null ? new System.Collections.Generic.Dictionary <string, object> {
                    { "ID", "0" }
                } : this.M_isoImage.ApiSerializeID()));
            }
            return(ret);
        }
예제 #2
0
        public Activity _Fetch(System.DateTime?startDate = null, System.DateTime?endDate = null)
        {
            object query = new System.Collections.Generic.Dictionary <string, object> {
            };

            if (startDate != null)
            {
                (query as System.Collections.Generic.Dictionary <string, object>)["Start"] = Util.Date2str(startDate);
            }
            if (endDate != null)
            {
                (query as System.Collections.Generic.Dictionary <string, object>)["End"] = Util.Date2str(endDate);
            }
            string path = this._ApiPathPrefix() + "/" + Util.UrlEncode(this._SourceId) + this._ApiPathSuffix();
            object data = this._Client.Request("GET", path);

            if (data == null)
            {
                return(null);
            }
            data = (data as System.Collections.Generic.Dictionary <string, object>)["Data"];
            if (data == null)
            {
                return(null);
            }
            System.Collections.Generic.List <string> dates = Util.DictionaryKeys(data);
            dates = Util.SortArray(dates);
            for (int __it1 = 0; __it1 < (dates as System.Collections.IList).Count; __it1++)
            {
                var date = dates[__it1];
                this._AddSample(date, (data as System.Collections.Generic.Dictionary <string, object>)[date]);
            }
            return(this);
        }