internal Resource _Save()
        {
            object r     = this.ApiSerialize();
            object query = this._Query;

            this._Query = new System.Collections.Generic.Dictionary <string, object> {
            };
            System.Collections.Generic.List <string> keys = Util.DictionaryKeys(query);
            for (int __it1 = 0; __it1 < (keys as System.Collections.IList).Count; __it1++)
            {
                var    k = keys[__it1];
                object v = (query as System.Collections.Generic.Dictionary <string, object>)[k];
                (r as System.Collections.Generic.Dictionary <string, object>)[k] = v;
            }
            string method = this.IsNew ? "POST" : "PUT";
            string path   = this._ApiPath();

            if (!this.IsNew)
            {
                path += "/" + Util.UrlEncode(this._Id());
            }
            object q = new System.Collections.Generic.Dictionary <string, object> {
            };

            (q as System.Collections.Generic.Dictionary <string, object>)[this._RootKey()] = r;
            this._OnBeforeSave(q);
            object result = this._Client.Request(method, path, q);

            this.ApiDeserialize(result, true);
            return(this);
        }
        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);
        }
Beispiel #3
0
        /// <summary>このルータ+スイッチに接続中のインタフェースに割り当てられているIPアドレスを収集します。
        /// </summary>
        public System.Collections.Generic.List <string> CollectUsedIpv4Addresses()
        {
            object found = this._UsedIpv4AddressHash();

            return(Util.SortArray(Util.DictionaryKeys(found)));
        }