4 Commits

Author SHA1 Message Date
4cd7e74923 Minor change to test upgrade
All checks were successful
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 52s
2026-01-27 21:25:59 -05:00
d65c556656 Try stopping service task before upgrade/uninstall
All checks were successful
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 54s
2026-01-27 21:20:35 -05:00
fe3941d8bd Fix update source
All checks were successful
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 54s
2026-01-27 20:40:39 -05:00
89d750fbe6 Add some logging and handle update error
All checks were successful
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 54s
2026-01-27 20:30:48 -05:00
4 changed files with 41 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
using LibreHardwareMonitor.Hardware; using LibreHardwareMonitor.Hardware;
using Serilog;
namespace HardwareMonitorStatusWindow.Service; namespace HardwareMonitorStatusWindow.Service;
@@ -12,6 +13,8 @@ public class HardwareMonitorService : IHardwareMonitorService
static HardwareMonitorService() static HardwareMonitorService()
{ {
Log.Information("Creating computer");
Computer = new Computer Computer = new Computer
{ {
IsCpuEnabled = true, IsCpuEnabled = true,
@@ -25,6 +28,8 @@ public class HardwareMonitorService : IHardwareMonitorService
IsPsuEnabled = true IsPsuEnabled = true
}; };
Log.Information("Opening computer");
Computer.Open(); Computer.Open();
HardwareUpdateVisitor = new HardwareUpdateVisitor(); HardwareUpdateVisitor = new HardwareUpdateVisitor();
@@ -32,8 +37,12 @@ public class HardwareMonitorService : IHardwareMonitorService
public IEnumerable<Hardware> GetHardware() public IEnumerable<Hardware> GetHardware()
{ {
Log.Information("Updating computer");
Computer.Accept(HardwareUpdateVisitor); Computer.Accept(HardwareUpdateVisitor);
Log.Information("Creating hardware entries");
var hardwareEntries = Computer.Hardware.Select(Hardware.Create); var hardwareEntries = Computer.Hardware.Select(Hardware.Create);
return hardwareEntries; return hardwareEntries;

View File

@@ -1,4 +1,6 @@
using Serilog; using HardwareMonitorStatusWindow.Service;
using Microsoft.Win32.TaskScheduler;
using Serilog;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Velopack; using Velopack;
@@ -17,7 +19,30 @@ internal class Program
Log.Information("Start"); Log.Information("Start");
VelopackApp.Build().SetLogger(new SerilogVelopackLogger()).Run(); var stopServiceHook = new VelopackHook(_ =>
{
try
{
using var taskService = new TaskService();
Log.Information("Checking for task name: {name}", HardwareMonitorService.ScheduledTaskName);
var existingTask = taskService.FindTask(HardwareMonitorService.ScheduledTaskName);
Log.Information("Task: {existingTask}", existingTask);
Log.Information("Stopping task");
existingTask?.Stop();
}
catch (Exception exception)
{
// Ignored
Log.Error(exception, "");
}
});
VelopackApp.Build().OnBeforeUpdateFastCallback(stopServiceHook).OnBeforeUninstallFastCallback(stopServiceHook).SetLogger(new SerilogVelopackLogger()).Run();
var app = new App(); var app = new App();
app.InitializeComponent(); app.InitializeComponent();

View File

@@ -9,9 +9,9 @@ namespace HardwareMonitorStatusWindow.StatusWindow;
internal static class UpdateCheck internal static class UpdateCheck
{ {
private static UpdateManager _updateManager; private static UpdateManager? _updateManager;
public static UpdateManager UpdateManager => _updateManager ??= new UpdateManager(new GithubSource("https://gitea.kaczorzoo.net/ckaczor/HardwareMonitorStatusWindow", null, false)); public static UpdateManager UpdateManager => _updateManager ??= new UpdateManager(new GiteaSource("https://gitea.kaczorzoo.net/ckaczor/HardwareMonitorStatusWindow", null, false));
public static string LocalVersion => (UpdateManager.CurrentVersion ?? new SemanticVersion(0, 0, 0)).ToString(); public static string LocalVersion => (UpdateManager.CurrentVersion ?? new SemanticVersion(0, 0, 0)).ToString();

View File

@@ -120,6 +120,8 @@ internal class WindowSource : IWindowSource, IDisposable
catch (Exception e) catch (Exception e)
{ {
Log.Error(e, nameof(UpdateApp)); Log.Error(e, nameof(UpdateApp));
return false;
} }
return true; return true;
@@ -150,7 +152,7 @@ internal class WindowSource : IWindowSource, IDisposable
Data.Load(); Data.Load();
} }
private void Save() private static void Save()
{ {
Data.Save(); Data.Save();
} }