Exemple #1
0
        public static int AccountNum()
        {
            HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(CreateCommand(accountNumCommand, new List <string> {
            })));

            webReq.Method        = "GET";
            webReq.ContentType   = "application/x-www-form-urlencoded";
            webReq.Timeout       = 600000;
            webReq.ContentLength = 0;
            HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
            StreamReader    sr       = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            string          ret      = sr.ReadToEnd();

            sr.Close();
            response.Close();
            ReturnedResult deserializedResult = JsonConvert.DeserializeObject <ReturnedResult>(ret);

            return(int.Parse(deserializedResult.result));
        }
Exemple #2
0
        public static bool SpreadMoneyStep(int startPos, int migrateCount)
        {
            if (startPos < 0 || migrateCount <= 0)
            {
                return(false);
            }
            HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(CreateCommand(spreadMoneyCommand, new List <string> {
                Neo, startPos.ToString(), migrateCount.ToString(), spreadAmountPerAccount.ToString()
            })));

            webReq.Method        = "GET";
            webReq.ContentType   = "application/x-www-form-urlencoded";
            webReq.Timeout       = 600000;
            webReq.ContentLength = 0;
            HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
            StreamReader    sr       = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            string          ret      = sr.ReadToEnd();

            sr.Close();
            response.Close();
            ReturnedResult deserializedResult = JsonConvert.DeserializeObject <ReturnedResult>(ret);

            if (deserializedResult == null || deserializedResult.result == null)
            {
                Console.WriteLine(ret);
                return(false);
            }
            if (deserializedResult.result.Equals("Success"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }