示例#1
0
        public String queryhst(String device, DateTime start, DateTime stop, String param, UInt32 ElementsPerPage)
        {
            Int64 startEpoch, stopEpoch;

            startEpoch = RestAPI.ToEpoch(start);
            stopEpoch  = RestAPI.ToEpoch(stop);
            return(this.queryhst(device, startEpoch, stopEpoch, param, ElementsPerPage));
        }
示例#2
0
        public String queryhst(String device, DateTime start, DateTime stop, String param)
        {
            Int64 startEpoch, stopEpoch;

            startEpoch = RestAPI.ToEpoch(start);
            stopEpoch  = RestAPI.ToEpoch(stop);
            return(this.queryhst(device, startEpoch, stopEpoch, param));
        }
示例#3
0
        public static String GetHtmlAnswer(String Question)
        {
            bool al = RestAPI.SetAllowUnsafeHeaderParsing20();

            System.Net.WebResponse resp;
            String result = String.Empty;

            try
            {
                System.Net.HttpWebRequest myReq = (System.Net.HttpWebRequest)(System.Net.WebRequest.Create(Question));
                myReq.Timeout = 3000;

                myReq.Accept = "\r\n";

                resp = myReq.GetResponse();
                //myReq.
            }

            catch (System.Net.WebException e)
            {
                return(String.Empty);
            }
            System.IO.Stream       ReceiveStream = resp.GetResponseStream();
            System.Text.Encoding   encode        = System.Text.Encoding.GetEncoding("utf-8");
            System.IO.StreamReader readStream    = new System.IO.StreamReader(ReceiveStream, encode);

            char[] read = new char[256];
            int    count;

            try
            {
                count = readStream.Read(read, 0, 256);
            }
            catch (System.Net.WebException)
            {
                return(String.Empty);
            }

            while (count > 0)
            {
                // Dump the 256 characters on a string and display the string onto the console.
                String str = new String(read, 0, count);
                result += str;
                count   = readStream.Read(read, 0, 256);
            }
            return(result);
        }