Hey everyone I'm trying to make a checker but on bad accounts and banned proxies, there is no source to capture from, only response codes. Can anyone help me figure out how to capture the code and use it? Would greatly appreciate it.
12 July, 2020 - 04:01 PM(This post was last modified: 12 July, 2020 - 05:24 PM by Suspect.)
Reply
Why Don't you just create an Enum for the Response Codes?
Code:
private void Method()
{
try
{
}
catch(Exception ex)
{
if (ex.GetType().IsAssignableFrom(typeof(Leaf.xNet.HttpException)))
{
//var WebException = ex as WebException;
var WebException = ex as Leaf.xNet.HttpException;
var response = (int)WebException.HttpStatusCode;
if (Enum.IsDefined(typeof(CheckUsernameResponse), response))
{
CheckUsernameResponse enumValue = (CheckUsernameResponse)response;
if (enumValue == CheckUsernameResponse.Fail)
{
}
else
{
}
}
}
public enum CheckUsernameResponse
{
Fail = 401,
Ban = 429
};
(12 July, 2020 - 04:01 PM)Suspect Wrote: Show More
Why Don't you just create an Enum for the Response Codes?
Code:
private void Method()
{
try
{
}
catch(Exception ex)
{
if (ex.GetType().IsAssignableFrom(typeof(Leaf.xNet.HttpException)))
{
//var WebException = ex as WebException;
var WebException = ex as Leaf.xNet.HttpException;
var response = (int)WebException.HttpStatusCode;
if (Enum.IsDefined(typeof(CheckUsernameResponse), response))
{
CheckUsernameResponse enumValue = (CheckUsernameResponse)response;
if (enumValue == CheckUsernameResponse.Fail)
{
}
else
{
}
}
}
public enum CheckUsernameResponse
{
Fail = 401,
Ban = 429
};
(12 July, 2020 - 04:01 PM)Suspect Wrote: Show More
Why Don't you just create an Enum for the Response Codes?
Code:
private void Method()
{
try
{
}
catch(Exception ex)
{
if (ex.GetType().IsAssignableFrom(typeof(Leaf.xNet.HttpException)))
{
//var WebException = ex as WebException;
var WebException = ex as Leaf.xNet.HttpException;
var response = (int)WebException.HttpStatusCode;
if (Enum.IsDefined(typeof(CheckUsernameResponse), response))
{
CheckUsernameResponse enumValue = (CheckUsernameResponse)response;
if (enumValue == CheckUsernameResponse.Fail)
{
}
else
{
}
}
}
public enum CheckUsernameResponse
{
Fail = 401,
Ban = 429
};
thanks man that really helps. I appreciate it.
no prob, you dont have to use an Enum its just a good way to keep things organised.