mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-04 22:07:40 +00:00
Add Updater.exe that can update to latest release and debug
This commit is contained in:
parent
275ce48509
commit
2259e17b21
18 changed files with 623 additions and 59 deletions
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autoupdater.NET.Official" Version="1.7.6" />
|
||||
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.1" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Security.Principal;
|
||||
using System.Security.AccessControl;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AutoUpdaterDotNET;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace CommonHelpers
|
||||
{
|
||||
|
|
@ -125,7 +121,7 @@ namespace CommonHelpers
|
|||
}
|
||||
}
|
||||
|
||||
public static void RunOnce(String title, String mutexName, int runOnceTimeout = 1000)
|
||||
public static void RunOnce(String? title, String mutexName, int runOnceTimeout = 1000)
|
||||
{
|
||||
runOnceMutex = TryCreateOrOpenExistingMutex(mutexName);
|
||||
|
||||
|
|
@ -135,9 +131,58 @@ namespace CommonHelpers
|
|||
}
|
||||
}
|
||||
|
||||
public static void Fatal(String title, String message)
|
||||
public static String MachineID
|
||||
{
|
||||
MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\SteamDeckTools"))
|
||||
{
|
||||
var machineID = registryKey?.GetValue("MachineID") as string;
|
||||
if (machineID is not null)
|
||||
return machineID;
|
||||
|
||||
machineID = Guid.NewGuid().ToString();
|
||||
registryKey?.SetValue("MachineID", machineID);
|
||||
return machineID;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "exception";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Version? ApplicationVersion
|
||||
{
|
||||
get => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
}
|
||||
|
||||
public static String ProductVersion
|
||||
{
|
||||
get => Application.ProductVersion;
|
||||
}
|
||||
|
||||
public static void RunUpdater(string Title, bool user = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = "Updater.exe",
|
||||
ArgumentList = { user ? "-user" : "-first" },
|
||||
UseShellExecute = false
|
||||
});
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void Fatal(String? title, String message)
|
||||
{
|
||||
if (title is not null)
|
||||
MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue