3 Commits

Author SHA1 Message Date
9365aa16cd Добавлено временное копирование updater.exe
All checks were successful
CI / build-test (push) Successful in 37s
Release / pack-and-publish (release) Successful in 39s
2025-12-08 17:01:40 +03:00
36331e8664 Исправлена подпись
All checks were successful
CI / build-test (push) Successful in 35s
Release / pack-and-publish (release) Successful in 29s
2025-12-07 08:47:06 +03:00
d0e57d8d7b Добавлено обновление
All checks were successful
CI / build-test (push) Successful in 31s
2025-11-27 11:19:34 +03:00
4 changed files with 77 additions and 35 deletions

View File

@@ -1,10 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable>
<Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>ReleaseUpdater.Common</PackageId>
<Version>1.0.0</Version>
<Authors>FrigaT</Authors>
<Company>FrigaT</Company>
<Product>ReleaseUpdater</Product>
<Description>Система обновления приложений через github/gitea системы контроля версий.</Description>
<Copyright>Copyright © 2025 FrigaT</Copyright>
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,9 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable>
<Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>ReleaseUpdater</PackageId>
<Version>1.0.0</Version>
<Authors>FrigaT</Authors>
<Company>FrigaT</Company>
<Product>ReleaseUpdater</Product>
<Description>Система обновления приложений через github/gitea системы контроля версий.</Description>
<Copyright>Copyright © 2025 FrigaT</Copyright>
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -11,17 +23,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ReleaseUpdater.Common\ReleaseUpdater.Common.csproj" <ProjectReference Include="..\ReleaseUpdater.Common\ReleaseUpdater.Common.csproj" />
PrivateAssets="none"
IncludeAssets="all"
/>
</ItemGroup> </ItemGroup>
<Target Name="CopyProjectReferencesToPackage" AfterTargets="Pack">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)ReleaseUpdater.Common.dll"
TargetPath="lib\net8.0\ReleaseUpdater.Common.dll" />
</ItemGroup>
</Target>
</Project> </Project>

View File

@@ -72,7 +72,7 @@ public static class ReleaseUpdaterFacade
/// Обновление через внешний Updater.exe. /// Обновление через внешний Updater.exe.
/// </summary> /// </summary>
public static async Task UpdateWithExternalAsync( public static async Task UpdateWithExternalAsync(
string apiUrl, string? token, string installPath, string appExe, string versionOrLatest = "latest", string? updaterExePath = null, bool exitCurrentApp = false) string apiUrl, string? token, string installPath, string appExe, string versionOrLatest = "latest", string? updaterExePath = null, bool exitCurrentApp = false, string? tempUpdaterDirectory = null)
{ {
try try
{ {
@@ -83,13 +83,31 @@ public static class ReleaseUpdaterFacade
var asset = release.Assets.FirstOrDefault(a => a.Name.EndsWith(".zip")) var asset = release.Assets.FirstOrDefault(a => a.Name.EndsWith(".zip"))
?? throw new Exception("No zip asset found"); ?? throw new Exception("No zip asset found");
string tempNumber = $"{Guid.NewGuid():N}";
var tempUpdaterName = $"updater_{tempNumber}.exe";
if (updaterExePath == null) updaterExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updater.exe");
if (string.IsNullOrWhiteSpace(tempUpdaterDirectory))
{
tempUpdaterDirectory = Path.GetDirectoryName(updaterExePath);
tempUpdaterDirectory = Path.Combine(tempUpdaterDirectory!, "tempUpdater");
}
if (!Directory.Exists(tempUpdaterDirectory))
{
Directory.CreateDirectory(tempUpdaterDirectory);
}
var tempUpdaterPath = Path.Combine(tempUpdaterDirectory, tempUpdaterName!);
var downloader = new HttpAssetDownloader(); var downloader = new HttpAssetDownloader();
var zipPath = await downloader.DownloadAssetAsync(asset.DownloadUrl, token); var zipPath = await downloader.DownloadAssetAsync(asset.DownloadUrl, token, Path.Combine(tempUpdaterDirectory, $"updater_{tempNumber}.zip"));
BeforeInstall?.Invoke(); BeforeInstall?.Invoke();
File.Copy(updaterExePath, tempUpdaterPath);
if (updaterExePath == null) updaterExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updater.exe");
if (installPath.EndsWith("\\")) if (installPath.EndsWith("\\"))
{ {
@@ -113,7 +131,7 @@ public static class ReleaseUpdaterFacade
var process = Process.Start(new ProcessStartInfo var process = Process.Start(new ProcessStartInfo
{ {
FileName = updaterExePath, FileName = tempUpdaterPath,
Arguments = args, Arguments = args,
UseShellExecute = true, UseShellExecute = true,
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory

View File

@@ -1,18 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.0.0</Version>
<Authors>FrigaT</Authors>
<Company>FrigaT</Company>
<Product>ReleaseUpdater</Product>
<Description>Запускатор обновления</Description>
<Copyright>Copyright © 2025 FrigaT</Copyright>
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ArgumentsToolkit" Version="0.0.3" /> <PackageReference Include="ArgumentsToolkit" Version="0.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ReleaseUpdater.Common\ReleaseUpdater.Common.csproj" /> <ProjectReference Include="..\ReleaseUpdater.Common\ReleaseUpdater.Common.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>