updated system to be less resource hungry

This commit is contained in:
Martin Barker
2023-11-07 18:55:22 +00:00
parent 66ffeb4fb8
commit 25110f29bc
4 changed files with 12 additions and 25 deletions

View File

@@ -549,8 +549,7 @@ end;
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{7774CEEE-6785-48B9-BA35-6B842F947A21} AppId={{7774CEEE-6785-48B9-BA35-6B842F947A21}
AppName=Twitchy AppName=Twitchy
AppVersion=0.4.1 AppVersion=0.5
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={autopf}\Twitchy DefaultDirName={autopf}\Twitchy
DisableProgramGroupPage=yes DisableProgramGroupPage=yes
LicenseFile=.\TwitchDesktopNotifications\Lisence.rtf LicenseFile=.\TwitchDesktopNotifications\Lisence.rtf

View File

@@ -5,11 +5,12 @@ using System.Reflection.Metadata;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text.Json; using System.Text.Json;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Media; using System.Windows.Media;
using System.Threading;
using TwitchDesktopNotifications; using TwitchDesktopNotifications;
using TwitchDesktopNotifications.Core; using TwitchDesktopNotifications.Core;
using TwitchDesktopNotifications.JsonStructure; using TwitchDesktopNotifications.JsonStructure;
using Windows.UI.Core.Preview;
internal class Program internal class Program
{ {
@@ -19,7 +20,7 @@ internal class Program
private static NotifyIcon notifyIcon; private static NotifyIcon notifyIcon;
private static ContextMenuStrip cms; private static ContextMenuStrip cms;
private static ManageIgnores manageIgnores; private static ManageIgnores? manageIgnores;
public static void Ws_CodeRecived(object? sender, EventArgs e) public static void Ws_CodeRecived(object? sender, EventArgs e)
{ {
@@ -83,14 +84,11 @@ internal class Program
} }
} }
} }
[STAThread] [STAThread]
private static void Main(string[] args) private static void Main(string[] args)
{ {
try try
{ {
var timer = new PeriodicTimer(TimeSpan.FromSeconds(10));
notifyIcon = new NotifyIcon(); notifyIcon = new NotifyIcon();
notifyIcon.Icon = new Icon("Assets/icon.ico"); notifyIcon.Icon = new Icon("Assets/icon.ico");
notifyIcon.Text = "Twitch Notify"; notifyIcon.Text = "Twitch Notify";
@@ -114,19 +112,14 @@ internal class Program
TriggerAuthentication(); TriggerAuthentication();
} }
Thread thread = new Thread(() => var autoEvent = new AutoResetEvent(false);
{ var timer = new System.Threading.Timer((Object? stateInfo) => {
while (true) if (DataStore.GetInstance().Store != null)
{ {
Thread.Sleep(10000); TwitchFetcher.GetInstance().GetLiveFollowingUsers();
if (DataStore.GetInstance().Store != null)
{
TwitchFetcher.GetInstance().GetLiveFollowingUsers();
}
} }
}); }, autoEvent, 1000, 500);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
Application.Run(); Application.Run();

View File

@@ -72,14 +72,9 @@ $appArgs = 'sign',
$appArgs = $appArgs + $files; $appArgs = $appArgs + $files;
#run the signtool #run the signtool
#signtool $appArgs; signtool $appArgs;
# once files are signed package into zip # once files are signed package into zip
Get-ChildItem './' | where { $_.Name -notin 'sign.ps1'} | Compress-Archive -DestinationPath 'Twitchy.zip' -Update Get-ChildItem './' | where { $_.Name -notin 'sign.ps1'} | Compress-Archive -DestinationPath 'Twitchy.zip' -Update
$setupArgs =
'/pu+',
'/DSourceDir=TwitchDesktopNotifications\bin\x64\ReleaseSign\net6.0-windows10.0.17763.0\',
'../../../../../setup.iss';
iscc $setupArgs
Exit $LASTEXITCODE Exit $LASTEXITCODE

View File

@@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Twitchy" #define MyAppName "Twitchy"
#define MyAppVersion "0.4.2" #define MyAppVersion "0.5"
#define MyAppExeName "Twitchy.exe" #define MyAppExeName "Twitchy.exe"
#ifndef MyAppTargetFramework #ifndef MyAppTargetFramework