Improve updater to switch to setup.exe

This commit is contained in:
Kamil Trzciński 2022-12-19 10:25:56 +01:00
parent 72564c3145
commit 939894be41
2 changed files with 21 additions and 6 deletions

View file

@ -3,15 +3,11 @@ https://creativecommons.org/licenses/by-nc/4.0/
By running this project you agree to the following licenses and policies:
This project might connect to remote server and share the following information unless it is disabled
by creation of the `DisableCheckForUpdates.txt` in the root folder of the project:
This project might connect to remote server and share the following information unless it is disabled by creation of the `DisableCheckForUpdates.txt` in the root folder of the project:
- During updates checking it might share version, type of installation and installation time of the application
- Exceptions raised by the application might be logged using sentry.io: this includes OS version, exception message,
application version, stack trace and loaded libraries
- Exceptions raised by the application might be logged using Sentry.io: this includes OS version, exception message, application version, stack trace and loaded libraries
This project requires the following dependencies:
- Microsoft Visual C++ Redistributable - https://aka.ms/vs/17/release/vc_redist.x64.exe
- .NET Desktop Runtime 6.0 - https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.11-windows-x64-installer
- Rivatuner Statistics Server - https://www.guru3d.com/files-details/rtss-rivatuner-statistics-server-download.html

View file

@ -2,6 +2,8 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
using AutoUpdaterDotNET;
using CommonHelpers;
using ExternalHelpers;
@ -89,6 +91,7 @@ namespace Updater
AutoUpdater.UpdateFormSize = new Size(800, 300);
AutoUpdater.ShowSkipButton = true;
AutoUpdater.Synchronous = true;
AutoUpdater.ParseUpdateInfoEvent += ParseUpdateInfoEvent;
if (!IsUsingInstaller)
{
@ -137,6 +140,19 @@ namespace Updater
AutoUpdater.Start(updateURL);
}
private static UpdateInfoEventArgs? UpdateInfo { get; set; }
private static void ParseUpdateInfoEvent(ParseUpdateInfoEventArgs args)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(UpdateInfoEventArgs));
XmlTextReader xmlTextReader = new XmlTextReader(new StringReader(args.RemoteData)) { XmlResolver = null };
UpdateInfo = xmlSerializer.Deserialize(xmlTextReader) as UpdateInfoEventArgs;
if (UpdateInfo is not null)
{
args.UpdateInfo = UpdateInfo;
}
}
private static bool TrackProcess(String processFilterName, List<string>? usedTools = null)
{
if (FindProcesses(processFilterName).Any())
@ -150,6 +166,9 @@ namespace Updater
private static void KillApps()
{
if (UpdateInfo?.InstallerArgs?.StartsWith("/nokill") == true)
return;
ExitProcess("FanControl");
ExitProcess("PowerControl");
ExitProcess("PerformanceOverlay");