Compare commits
No commits in common. "ecdef3dcecfb64a61eb5d8c5a59905e1f0c8cc03" and "75194f31a53179e5384ab982ff14e857b70fd915" have entirely different histories.
ecdef3dcec
...
75194f31a5
@ -4,8 +4,8 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AssemblyVersion>2.12.0</AssemblyVersion>
|
<AssemblyVersion>2.11.0</AssemblyVersion>
|
||||||
<FileVersion>2.12.0</FileVersion>
|
<FileVersion>2.11.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AssemblyVersion>2.12.0</AssemblyVersion>
|
<AssemblyVersion>2.11.0</AssemblyVersion>
|
||||||
<FileVersion>2.12.0</FileVersion>
|
<FileVersion>2.11.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Resources\7z.dll" />
|
<EmbeddedResource Include="Resources\7za.exe" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||||
|
BIN
Patcher/PatchGenerator/Resources/7za.exe
Normal file
BIN
Patcher/PatchGenerator/Resources/7za.exe
Normal file
Binary file not shown.
Binary file not shown.
@ -16,7 +16,6 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using PatcherUtils.Model;
|
|
||||||
|
|
||||||
namespace PatchGenerator.ViewModels
|
namespace PatchGenerator.ViewModels
|
||||||
{
|
{
|
||||||
@ -141,19 +140,12 @@ namespace PatchGenerator.ViewModels
|
|||||||
|
|
||||||
System.Threading.Thread.Sleep(2000);
|
System.Threading.Thread.Sleep(2000);
|
||||||
|
|
||||||
PatchItemCollection.Add(new PatchItem("Zipping patcher ..."));
|
PatchItemCollection.Add(new PatchItem("Kicking off 7zip ..."));
|
||||||
|
|
||||||
ProgressMessage = "Zipping patcher";
|
LazyOperations.StartZipProcess(generationInfo.PatchName.FromCwd(), $"{generationInfo.PatchName}.zip".FromCwd());
|
||||||
|
|
||||||
IndeterminateProgress = false;
|
IndeterminateProgress = false;
|
||||||
|
|
||||||
var progress = new Progress<int>(p =>
|
|
||||||
{
|
|
||||||
PatchPercent = p;
|
|
||||||
});
|
|
||||||
|
|
||||||
LazyOperations.CompressDirectory(generationInfo.PatchName.FromCwd(), $"{generationInfo.PatchName}.7z".FromCwd(), progress);
|
|
||||||
|
|
||||||
PatchItemCollection.Add(new PatchItem("Done"));
|
PatchItemCollection.Add(new PatchItem("Done"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using PatcherUtils.Model;
|
||||||
using PatcherUtils.Model;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Aki.Common.Utils;
|
|
||||||
using SevenZip;
|
|
||||||
|
|
||||||
namespace PatcherUtils
|
namespace PatcherUtils
|
||||||
{
|
{
|
||||||
@ -20,12 +18,12 @@ namespace PatcherUtils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string PatchFolder = "Aki_Patches";
|
public static string PatchFolder = "Aki_Patches";
|
||||||
|
|
||||||
private static string SevenZDll = "7z.dll";
|
private static string SevenZExe = "7za.exe";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The path to the 7za.exe file in the <see cref="TempDir"/>
|
/// The path to the 7za.exe file in the <see cref="TempDir"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string SevenZDllPath = $"{TempDir}\\{SevenZDll}";
|
public static string SevenZExePath = $"{TempDir}\\{SevenZExe}";
|
||||||
|
|
||||||
private static string PatcherClient = "PatchClient.exe";
|
private static string PatcherClient = "PatchClient.exe";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,9 +79,9 @@ namespace PatcherUtils
|
|||||||
{
|
{
|
||||||
switch (resource)
|
switch (resource)
|
||||||
{
|
{
|
||||||
case string a when a.EndsWith(SevenZDll):
|
case string a when a.EndsWith(SevenZExe):
|
||||||
{
|
{
|
||||||
StreamResourceOut(assembly, resource, SevenZDllPath);
|
StreamResourceOut(assembly, resource, SevenZExePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case string a when a.EndsWith(PatcherClient):
|
case string a when a.EndsWith(PatcherClient):
|
||||||
@ -100,34 +98,17 @@ namespace PatcherUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CompressDirectory(string SourceDirectoryPath, string DestinationFilePath, IProgress<int> progress)
|
public static void StartZipProcess(string SourcePath, string DestinationPath)
|
||||||
{
|
{
|
||||||
var outputFile = new FileInfo(DestinationFilePath);
|
ProcessStartInfo procInfo = new ProcessStartInfo()
|
||||||
|
|
||||||
SevenZipBase.SetLibraryPath(SevenZDllPath);
|
|
||||||
var compressor = new SevenZipCompressor()
|
|
||||||
{
|
{
|
||||||
ArchiveFormat = OutArchiveFormat.SevenZip,
|
FileName = SevenZExePath,
|
||||||
CompressionMethod = CompressionMethod.Lzma2,
|
Arguments = $"a -mm=LZMA {DestinationPath} {SourcePath}"
|
||||||
CompressionLevel = CompressionLevel.Normal
|
|
||||||
};
|
};
|
||||||
|
|
||||||
compressor.Compressing += (_, args) =>
|
Process.Start(procInfo);
|
||||||
{
|
|
||||||
progress.Report(args.PercentDone);
|
|
||||||
};
|
|
||||||
|
|
||||||
using var outputStream = outputFile.OpenWrite();
|
PatchLogger.LogInfo($"Zip process started");
|
||||||
|
|
||||||
compressor.CompressDirectory(SourceDirectoryPath, outputStream);
|
|
||||||
|
|
||||||
outputFile.Refresh();
|
|
||||||
|
|
||||||
// failed to compress data
|
|
||||||
if (!outputFile.Exists || outputFile.Length == 0)
|
|
||||||
{
|
|
||||||
Logger.LogError("Failed to compress patcher");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Resources\7z.dll" />
|
|
||||||
<EmbeddedResource Include="Resources\xdelta3.exe" />
|
<EmbeddedResource Include="Resources\xdelta3.exe" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@ -21,8 +20,4 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.1.23" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user