Fix ID check and fix game quit crash

This commit is contained in:
Norbi Peti 2020-04-28 20:17:31 +02:00
parent 7f0acaeabf
commit 4d2a4b20d0
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -53,7 +53,7 @@ namespace GCDC
{
if (!tokenOrChannel.Contains("-"))
{
if (!int.TryParse(tokenOrChannel, out _))
if (!long.TryParse(tokenOrChannel, out _))
{
Log.Error("Bad format for channel ID.");
return;
@ -67,11 +67,11 @@ namespace GCDC
}
else
{
_token = tokenOrChannel;
try
{
if (JObject.Parse(WebUtils.Request("users/get?token=" + tokenOrChannel))["response"].Value<string>() == "OK")
{
_token = tokenOrChannel;
var jo = new JObject {["token"] = tokenOrChannel};
File.WriteAllText("gcdc.json", jo.ToString());
Start();
@ -136,6 +136,10 @@ namespace GCDC
{
// ignored
}
catch (ThreadInterruptedException)
{
break;
}
}
}) {Name = "DC Receiver Thread"};
_rect.Start();