Пример #1
0
        private static IRestResponse RequestFaucetClaim(Faucet faucet, string cfduid, string phpsessid)
        {
            IRestResponse response;

            while (true)
            {
                var client = new RestClient("https://stakecube.net/app/community/functions")
                {
                    Timeout = 10000
                };
                var request = new RestRequest(Method.POST);
                request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
                request.AddHeader("Cookie", $"__cfduid={cfduid}; PHPSESSID={phpsessid}");
                request.AddParameter("ACTION", "CLAIM_FAUCET");
                request.AddParameter("ID", $"{faucet.ID}");
                response = client.Execute(request);
                if (!response.IsSuccessful)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }
            return(response);
        }
Пример #2
0
        private static Faucet NextClaimableFaucet(string cfduid, string phpsessid)
        {
            IRestResponse          response = GetFaucets(cfduid, phpsessid);
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Include
            };
            var dynamic = JsonConvert.DeserializeObject <dynamic>(response.Content, settings);

            foreach (var token in dynamic)
            {
                Faucet faucet = new Faucet();
                ConfigureFaucet(ref faucet, token);

                double balance;
                double amountPerClaim;
                if (decimalSeparator != ".")
                {
                    balance        = Convert.ToDouble(faucet.BALANCE.Replace('.', ','));
                    amountPerClaim = Convert.ToDouble(faucet.AMOUNT_PER_CLAIM.Replace('.', ','));
                }
                else
                {
                    balance        = Convert.ToDouble(faucet.BALANCE);
                    amountPerClaim = Convert.ToDouble(faucet.AMOUNT_PER_CLAIM);
                }

                if (amountPerClaim <= balance && (faucet.DIFF_IN_SEC == null || faucet.DIFF_IN_SEC >= 86400))
                {
                    return(faucet);
                }
            }
            return(null);
        }
Пример #3
0
 private static void ConfigureFaucet(ref Faucet faucetToConfigure, dynamic token)
 {
     foreach (var childToken in token)
     {
         PropertyInfo[] properties = typeof(Faucet).GetProperties();
         foreach (PropertyInfo property in properties)
         {
             if (property.Name.Equals(childToken.Name))
             {
                 property.SetValue(faucetToConfigure, childToken.Value.Value);
                 break;
             }
         }
     }
 }
Пример #4
0
        private static long GetNextClaimTime(string content)
        {
            long highestDiff = long.MinValue;

            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Include
            };
            var dynamic = JsonConvert.DeserializeObject <dynamic>(content, settings);

            foreach (var token in dynamic)
            {
                Faucet faucet = new Faucet();
                ConfigureFaucet(ref faucet, token);

                double balance;
                double amountPerClaim;
                if (decimalSeparator != ".")
                {
                    balance        = Convert.ToDouble(faucet.BALANCE.Replace('.', ','));
                    amountPerClaim = Convert.ToDouble(faucet.AMOUNT_PER_CLAIM.Replace('.', ','));
                }
                else
                {
                    balance        = Convert.ToDouble(faucet.BALANCE);
                    amountPerClaim = Convert.ToDouble(faucet.AMOUNT_PER_CLAIM);
                }

                if (amountPerClaim <= balance && (faucet.DIFF_IN_SEC > highestDiff || faucet.DIFF_IN_SEC == null))
                {
                    if (faucet.DIFF_IN_SEC == null)
                    {
                        highestDiff = 86400;
                    }
                    else
                    {
                        highestDiff = Convert.ToInt64(faucet.DIFF_IN_SEC);
                    }
                }
            }
            return(highestDiff);
        }