Add auto update to linux and macos
This commit is contained in:
parent
952eee6d32
commit
dc7c03661d
26 changed files with 631 additions and 99 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -35,8 +36,31 @@ namespace WindowsConfigApp
|
|||
|
||||
public void DeleteFolderIcon(string directory)
|
||||
=> new DirectoryInfo(directory)?.DeleteIcon();
|
||||
public bool CanUpdate => true;
|
||||
public void InstallUpdate(string updateBundle)
|
||||
{
|
||||
var thisExe = Environment.ProcessPath;
|
||||
var thisDir = Path.GetDirectoryName(thisExe);
|
||||
var zipExtractor = Path.Combine(Path.GetTempPath(), "ZipExtractor.exe");
|
||||
|
||||
public void CopyTextToClipboard(string text)
|
||||
=> Clipboard.SetText(text);
|
||||
File.Copy("ZipExtractor.exe", zipExtractor, overwrite: true);
|
||||
|
||||
RunAsRoot(zipExtractor, $"--input \"{updateBundle}\" --output \"{thisDir}\" --executable \"{thisExe}\"");
|
||||
}
|
||||
|
||||
public Process RunAsRoot(string exe, string args)
|
||||
{
|
||||
var psi = new ProcessStartInfo()
|
||||
{
|
||||
FileName = exe,
|
||||
UseShellExecute = true,
|
||||
Verb = "runas",
|
||||
WindowStyle = ProcessWindowStyle.Normal,
|
||||
CreateNoWindow = true,
|
||||
Arguments = args
|
||||
};
|
||||
|
||||
return Process.Start(psi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,10 @@
|
|||
<ProjectReference Include="..\..\AppScaffolding\AppScaffolding.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ZipExtractor.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
BIN
Source/LoadByOS/WindowsConfigApp/ZipExtractor.exe
Normal file
BIN
Source/LoadByOS/WindowsConfigApp/ZipExtractor.exe
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue