Jul 21, 2020 01:09 PM
(This post was last modified: Jul 21, 2020 01:09 PM by Nyx.)
I am struggling to make this C# program to check for name availability and to claim it in case it is.
This is the function it checks if a given name is available:
I'm having trouble with the line:
The exception it throws is:
This is the function it checks if a given name is available:
Code
public static Tuple<NameStatus> GetSummonerNameChangeAvailable(HttpRequest Client, TurboRequest account)
{
Tuple<NameStatus> result;
try
{
Console.WriteLine("Getavailable");
Client.UserAgent = "RiotClient/18.0.0 (lol-store)";
Client.AddHeader("Accept", "application/json");
// The following line throws an error
string Response = Client.Get("https://store." + account.ModifiedRegion + ".lol.riotgames.com/storefront/v3/summonerNameChange/verify/" + account.RequestedAlias, null).ToString();
Console.WriteLine(Response);
bool flag = Response.Contains("nameIsAvailableOnServer");
if (flag)
{
bool flag2 = Response.Contains("\"nameIsAvailableOnServer\":false");
if (flag2)
{
result = new Tuple<NameStatus>(NameStatus.NotAvailable);
}
else
{
bool flag3 = Response.Contains("\"nameIsAvailableOnServer\":true");
if (flag3)
{
result = new Tuple<NameStatus>(NameStatus.Available);
}
else
{
result = new Tuple<NameStatus>(NameStatus.Error);
}
}
}
else
{
result = new Tuple<NameStatus>(NameStatus.Error);
}
}
catch(Exception e)
{
Console.WriteLine("Exception was {0}", e);
result = new Tuple<NameStatus>(NameStatus.Error);
}
return result;
}I'm having trouble with the line:
Code
string Response = Client.Get("https://store." + account.ModifiedRegion + ".lol.riotgames.com/storefront/v3/summonerNameChange/verify/" + account.RequestedAlias, null).ToString();The exception it throws is:
Code
Exception thrown: 'Leaf.xNet.HttpException' in Leaf.xNet.dll
Exception was Leaf.xNet.HttpException: It turned out wait for a connection to the HTTP-server 'store.na1.lol.riotgames.com'.
at Leaf.xNet.HttpRequest.CreateTcpConnection(String host, Int32 port)
at Leaf.xNet.HttpRequest.CreateConnection(Uri address)
at Leaf.xNet.HttpRequest.TryCreateConnectionOrUseExisting(Uri address, Uri previousAddress)
at Leaf.xNet.HttpRequest.Request(HttpMethod method, Uri address, HttpContent content)
at Leaf.xNet.HttpRequest.Raw(HttpMethod method, Uri address, HttpContent content)
at Leaf.xNet.HttpRequest.Raw(HttpMethod method, String address, HttpContent content)
at Leaf.xNet.HttpRequest.Get(String address, RequestParams urlParams)
at LeagueTurbo.Core.Instagram.GetSummonerNameChangeAvailable(HttpRequest Client, TurboRequest account)


![[Image: Syr3DlV.png]](https://i.imgur.com/Syr3DlV.png)