diff --git a/TwitchDesktopNotifications/Core/TwitchFetcher.cs b/TwitchDesktopNotifications/Core/TwitchFetcher.cs index 236b3e6..5a91988 100644 --- a/TwitchDesktopNotifications/Core/TwitchFetcher.cs +++ b/TwitchDesktopNotifications/Core/TwitchFetcher.cs @@ -1,6 +1,4 @@ -using ABI.System; -using Microsoft.Extensions.Configuration; -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Net; using System.Text; @@ -14,9 +12,8 @@ namespace TwitchDesktopNotifications.Core internal class TwitchFetcher { private TwitchFetcher() { - var config = new ConfigurationBuilder().AddUserSecrets().Build(); - TwitchClientID = config["TwitchClientID"]; - TwitchClientSecret = config["TwitchClientSecret"]; + TwitchClientID = ""; + TwitchClientSecret = ""; } public static TwitchFetcher instance { get; private set; } diff --git a/TwitchDesktopNotifications/DataStore.cs b/TwitchDesktopNotifications/DataStore.cs index 79c98f1..222b544 100644 --- a/TwitchDesktopNotifications/DataStore.cs +++ b/TwitchDesktopNotifications/DataStore.cs @@ -40,6 +40,10 @@ namespace TwitchDesktopNotifications String FileName = "store.json"; string fileContent = JsonSerializer.Serialize(Store); + + Console.WriteLine("I'm trying to save:"); + Console.WriteLine(fileContent); + Console.WriteLine("to {0}", FilePath + "/" + FileName); Directory.CreateDirectory(FilePath); File.WriteAllText(FilePath + "/" + FileName, fileContent); } diff --git a/TwitchDesktopNotifications/Program.cs b/TwitchDesktopNotifications/Program.cs index ceefc03..0910957 100644 --- a/TwitchDesktopNotifications/Program.cs +++ b/TwitchDesktopNotifications/Program.cs @@ -1,5 +1,6 @@ // See https://aka.ms/new-console-template for more information using System.Drawing; +using System.Reflection.Metadata; using System.Runtime.InteropServices; using System.Text.Json; using System.Windows.Controls; @@ -18,7 +19,6 @@ internal class Program private static NotifyIcon notifyIcon; private static ContextMenuStrip cms; - public static void Ws_CodeRecived(object? sender, EventArgs e) { ws.CodeRecived -= Ws_CodeRecived; @@ -74,36 +74,42 @@ internal class Program private static async Task Main(string[] args) { - var timer = new PeriodicTimer(TimeSpan.FromSeconds(10)); - - notifyIcon = new NotifyIcon(); - notifyIcon.Icon = new Icon("Assets/icon.ico"); - notifyIcon.Text = "Notify"; - - cms = new ContextMenuStrip(); - - cms.Items.Add(new ToolStripMenuItem("Reconnect", null, new EventHandler(Reconnect_Click))); - cms.Items.Add(new ToolStripSeparator()); - cms.Items.Add(new ToolStripMenuItem("Quit", null, new EventHandler(Quit_Click), "Quit")); - - notifyIcon.ContextMenuStrip = cms; - notifyIcon.Visible = true; - - if (DataStore.GetInstance().Store.Authentication == null) + try { - TriggerAuthentication(); - } + var timer = new PeriodicTimer(TimeSpan.FromSeconds(10)); - new Thread(() => - { - while (true) + notifyIcon = new NotifyIcon(); + notifyIcon.Icon = new Icon("Assets/icon.ico"); + notifyIcon.Text = "Twitch Notify"; + + cms = new ContextMenuStrip(); + + cms.Items.Add(new ToolStripMenuItem("Reconnect", null, new EventHandler(Reconnect_Click))); + cms.Items.Add(new ToolStripSeparator()); + cms.Items.Add(new ToolStripMenuItem("Quit", null, new EventHandler(Quit_Click), "Quit")); + + notifyIcon.ContextMenuStrip = cms; + notifyIcon.Visible = true; + + if (DataStore.GetInstance().Store.Authentication == null) { - Thread.Sleep(10000); - TwitchFetcher.GetInstance().GetLiveFollowingUsers(); + TriggerAuthentication(); } - }).Start(); - Application.Run(); + new Thread(() => + { + while (true) + { + Thread.Sleep(10000); + TwitchFetcher.GetInstance().GetLiveFollowingUsers(); + } + }).Start(); + + Application.Run(); + } + catch (Exception e) { + Console.WriteLine(e.ToString()); + } } } \ No newline at end of file diff --git a/TwitchDesktopNotifications/TwitchDesktopNotifications.csproj b/TwitchDesktopNotifications/TwitchDesktopNotifications.csproj index 67760b6..a2bb1f0 100644 --- a/TwitchDesktopNotifications/TwitchDesktopNotifications.csproj +++ b/TwitchDesktopNotifications/TwitchDesktopNotifications.csproj @@ -1,7 +1,7 @@  - WinExe + Exe net6.0-windows10.0.17763.0 enable enable @@ -19,7 +19,6 @@ -