Updated to fix some bugs
This commit is contained in:
@@ -13,13 +13,10 @@ Want to contribute? Great!
|
||||
|
||||
Project is built using Visual Studios 2022, must have Windows 10.0.17763 SDK installed
|
||||
|
||||
You need to create Application to obtain a ID and Secret on [Twitch Developer Console](https://dev.twitch.tv/console) once you have them
|
||||
Open the project in Visual Studio 2022 go to the Developer Powershell and then run the following commands, remembering to replace the `{You Twitch Applciations Client ID}` and `{You Twitch Applciations Client Secret}` with the appropriate information from your [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
You need to create Application to obtain a ID and Secret on [Twitch Developer Console](https://dev.twitch.tv/console) replace lines 15 and 16 in TwitchFetcher.cs
|
||||
```pwsh
|
||||
cd TwitchDesktopNotifications
|
||||
dotnet user-secrets init
|
||||
dotnet user-secret set TwitchClientID {You Twitch Applciation's Client ID}
|
||||
dotnet user-secret set TwitchClientSecret {You Twitch Applciation's Client Secret}
|
||||
TwitchClientID = "";
|
||||
TwitchClientSecret = "";
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -47,6 +47,10 @@ namespace TwitchDesktopNotifications.Core
|
||||
|
||||
private T MakeRequest<T>(string endpoint)
|
||||
{
|
||||
if (DataStore.GetInstance().Store == null)
|
||||
{
|
||||
throw new Exception("Not Authenticated");
|
||||
}
|
||||
|
||||
if (DataStore.GetInstance().Store.Authentication.ExpiresAsDate <= DateTime.UtcNow)
|
||||
{
|
||||
@@ -76,7 +80,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
DataStore.GetInstance().Save();
|
||||
}catch(System.Exception ex)
|
||||
{
|
||||
Environment.Exit(1);
|
||||
MessageBox.Show("Twitch Connection not authenticated you need to Reconnect it.", "Twitch Notify");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +91,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
return MakeRequest<User>("helix/users?id=" + user_id).Data[0];
|
||||
}catch(System.Exception ex)
|
||||
{
|
||||
Environment.Exit(1);
|
||||
MessageBox.Show("Twitch Connection not authenticated you need to Reconnect it.", "Twitch Notify");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -127,7 +131,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
currentlyLive = following.Data;
|
||||
}catch(System.Exception ex)
|
||||
{
|
||||
Environment.Exit(1);
|
||||
MessageBox.Show("Twitch Connection not authenticated you need to Reconnect it.", "Twitch Notify");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,14 +60,9 @@ internal class Program
|
||||
TwitchFetcher.GetInstance().BeginConnection();
|
||||
if (DataStore.GetInstance().Store.Authentication == null)
|
||||
{
|
||||
var timerForCrash = new PeriodicTimer(TimeSpan.FromSeconds(10));
|
||||
await timerForCrash.WaitForNextTickAsync();
|
||||
if (isConnecting)
|
||||
{
|
||||
MessageBox.Show("Twitch Connection not authenticated Exiting for saftey.", "Twitch Notify");
|
||||
notifyIcon.Visible = false;
|
||||
notifyIcon.Dispose();
|
||||
Environment.Exit(1);
|
||||
MessageBox.Show("Twitch Connection not authenticated you need to Reconnect it.", "Twitch Notify");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +96,10 @@ internal class Program
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10000);
|
||||
TwitchFetcher.GetInstance().GetLiveFollowingUsers();
|
||||
if (DataStore.GetInstance().Store != null)
|
||||
{
|
||||
TwitchFetcher.GetInstance().GetLiveFollowingUsers();
|
||||
}
|
||||
}
|
||||
}).Start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user