Compare commits
No commits in common. "5acb29df2aa9f586b8b00e5c60dfacec1a8cb671" and "1b0acdc26209f26c0a8697eb1dca971ea58cd2b6" have entirely different histories.
5acb29df2a
...
1b0acdc262
@ -5,8 +5,8 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AssemblyVersion>1.5.8</AssemblyVersion>
|
<AssemblyVersion>1.5.6</AssemblyVersion>
|
||||||
<FileVersion>1.5.8</FileVersion>
|
<FileVersion>1.5.6</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -19,7 +19,6 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="Spectre.Console" Version="0.44.0" />
|
<PackageReference Include="Spectre.Console" Version="0.44.0" />
|
||||||
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.1.23" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -37,9 +36,4 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Resources\7z.dll" />
|
|
||||||
<EmbeddedResource Include="Resources\7z.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using Spectre.Console;
|
|
||||||
|
|
||||||
namespace EftPatchHelper.Helpers;
|
|
||||||
|
|
||||||
public class FileHelper
|
|
||||||
{
|
|
||||||
public bool StreamAssemblyResourceOut(string resourceName, string outputFilePath)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
|
||||||
|
|
||||||
FileInfo outputFile = new FileInfo(outputFilePath);
|
|
||||||
|
|
||||||
if (outputFile.Exists)
|
|
||||||
{
|
|
||||||
outputFile.Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!outputFile.Directory.Exists)
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(outputFile.Directory.FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
var resName = assembly.GetManifestResourceNames().First(x => x.EndsWith(resourceName));
|
|
||||||
|
|
||||||
using (FileStream fs = File.Create(outputFilePath))
|
|
||||||
using (Stream s = assembly.GetManifestResourceStream(resName))
|
|
||||||
{
|
|
||||||
s.CopyTo(fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputFile.Refresh();
|
|
||||||
return outputFile.Exists;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
AnsiConsole.WriteException(ex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
using SevenZip;
|
|
||||||
using Spectre.Console;
|
|
||||||
|
|
||||||
namespace EftPatchHelper.Helpers;
|
|
||||||
|
|
||||||
public class ZipHelper
|
|
||||||
{
|
|
||||||
public string DllPath = Path.Join(Environment.CurrentDirectory, "7z.dll");
|
|
||||||
public bool Compress(DirectoryInfo folder, FileInfo outputArchive,
|
|
||||||
IProgress<double> progress)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var outputStream = outputArchive.OpenWrite();
|
|
||||||
|
|
||||||
SevenZipBase.SetLibraryPath(DllPath);
|
|
||||||
|
|
||||||
var compressor = new SevenZipCompressor()
|
|
||||||
{
|
|
||||||
CompressionLevel = CompressionLevel.Normal,
|
|
||||||
CompressionMethod = CompressionMethod.Lzma2,
|
|
||||||
ArchiveFormat = OutArchiveFormat.SevenZip
|
|
||||||
};
|
|
||||||
|
|
||||||
compressor.Compressing += (_, args) => { progress.Report(args.PercentDone); };
|
|
||||||
|
|
||||||
compressor.CompressDirectory(folder.FullName, outputStream);
|
|
||||||
|
|
||||||
outputArchive.Refresh();
|
|
||||||
|
|
||||||
if (!outputArchive.Exists)
|
|
||||||
{
|
|
||||||
AnsiConsole.MarkupLine("output archive not found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
AnsiConsole.WriteException(ex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
namespace EftPatchHelper.Interfaces;
|
|
||||||
|
|
||||||
public interface ICompressPatcherTasks : ITaskable
|
|
||||||
{
|
|
||||||
}
|
|
@ -30,7 +30,7 @@ namespace EftPatchHelper.Model
|
|||||||
_folderId = folderId;
|
_folderId = folderId;
|
||||||
UploadFileInfo = file;
|
UploadFileInfo = file;
|
||||||
ServiceName = "GoFile";
|
ServiceName = "GoFile";
|
||||||
DisplayName = $"{ServiceName} Upload";
|
DisplayName = $"{ServiceName} Upload: {UploadFileInfo.Name}";
|
||||||
HubEntryText = $"Download from {ServiceName}";
|
HubEntryText = $"Download from {ServiceName}";
|
||||||
AddHubEntry = true;
|
AddHubEntry = true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ namespace EftPatchHelper.Model
|
|||||||
_email = email;
|
_email = email;
|
||||||
_password = password;
|
_password = password;
|
||||||
ServiceName = "Mega";
|
ServiceName = "Mega";
|
||||||
DisplayName = $"{ServiceName} Upload";
|
DisplayName = $"{ServiceName} Upload: {UploadFileInfo.Name}";
|
||||||
HubEntryText = $"Download from {ServiceName}";
|
HubEntryText = $"Download from {ServiceName}";
|
||||||
AddHubEntry = true;
|
AddHubEntry = true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class SftpUpload : IFileUpload
|
|||||||
};
|
};
|
||||||
|
|
||||||
ServiceName = _sftpInfo.Hostname;
|
ServiceName = _sftpInfo.Hostname;
|
||||||
DisplayName = $"{ServiceName} Upload";
|
DisplayName = $"{ServiceName} Upload: {UploadFileInfo.Name}";
|
||||||
HubEntryText = $"Download from {ServiceName}";
|
HubEntryText = $"Download from {ServiceName}";
|
||||||
AddHubEntry = false;
|
AddHubEntry = false;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ namespace EftPatchHelper
|
|||||||
ITaskable _fileProcessingTasks;
|
ITaskable _fileProcessingTasks;
|
||||||
ITaskable _patchGenTasks;
|
ITaskable _patchGenTasks;
|
||||||
ITaskable _patchTestingTasks;
|
ITaskable _patchTestingTasks;
|
||||||
private ITaskable _compressPatcherTasks;
|
|
||||||
ITaskable _createReleaseTasks;
|
ITaskable _createReleaseTasks;
|
||||||
ITaskable _uploadTasks;
|
ITaskable _uploadTasks;
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ namespace EftPatchHelper
|
|||||||
IFileProcessingTasks fileProcessingTasks,
|
IFileProcessingTasks fileProcessingTasks,
|
||||||
IPatchGenTasks patchGenTasks,
|
IPatchGenTasks patchGenTasks,
|
||||||
IPatchTestingTasks patchTestingTasks,
|
IPatchTestingTasks patchTestingTasks,
|
||||||
ICompressPatcherTasks compressPatcherTasks,
|
|
||||||
IUploadTasks uploadTasks,
|
IUploadTasks uploadTasks,
|
||||||
IReleaseCreator createReleaseTasks
|
IReleaseCreator createReleaseTasks
|
||||||
)
|
)
|
||||||
@ -57,7 +55,6 @@ namespace EftPatchHelper
|
|||||||
_fileProcessingTasks = fileProcessingTasks;
|
_fileProcessingTasks = fileProcessingTasks;
|
||||||
_patchGenTasks = patchGenTasks;
|
_patchGenTasks = patchGenTasks;
|
||||||
_patchTestingTasks = patchTestingTasks;
|
_patchTestingTasks = patchTestingTasks;
|
||||||
_compressPatcherTasks = compressPatcherTasks;
|
|
||||||
_createReleaseTasks = createReleaseTasks;
|
_createReleaseTasks = createReleaseTasks;
|
||||||
_uploadTasks = uploadTasks;
|
_uploadTasks = uploadTasks;
|
||||||
}
|
}
|
||||||
@ -70,7 +67,6 @@ namespace EftPatchHelper
|
|||||||
_fileProcessingTasks.Run();
|
_fileProcessingTasks.Run();
|
||||||
_patchGenTasks.Run();
|
_patchGenTasks.Run();
|
||||||
_patchTestingTasks.Run();
|
_patchTestingTasks.Run();
|
||||||
_compressPatcherTasks.Run();
|
|
||||||
_uploadTasks.Run();
|
_uploadTasks.Run();
|
||||||
_createReleaseTasks.Run();
|
_createReleaseTasks.Run();
|
||||||
}
|
}
|
||||||
@ -88,9 +84,6 @@ namespace EftPatchHelper
|
|||||||
return settings;
|
return settings;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<FileHelper>();
|
|
||||||
services.AddSingleton<ZipHelper>();
|
|
||||||
|
|
||||||
services.AddScoped<EftClientSelector>();
|
services.AddScoped<EftClientSelector>();
|
||||||
|
|
||||||
services.AddTransient<ISettingsTask, StartupSettingsTask>();
|
services.AddTransient<ISettingsTask, StartupSettingsTask>();
|
||||||
@ -99,7 +92,6 @@ namespace EftPatchHelper
|
|||||||
services.AddTransient<IFileProcessingTasks, FileProcessingTasks>();
|
services.AddTransient<IFileProcessingTasks, FileProcessingTasks>();
|
||||||
services.AddTransient<IPatchGenTasks, PatchGenTasks>();
|
services.AddTransient<IPatchGenTasks, PatchGenTasks>();
|
||||||
services.AddTransient<IPatchTestingTasks, PatchTestingTasks>();
|
services.AddTransient<IPatchTestingTasks, PatchTestingTasks>();
|
||||||
services.AddTransient<ICompressPatcherTasks, CompressPatcherTasks>();
|
|
||||||
services.AddTransient<IReleaseCreator, CreateReleaseTasks>();
|
services.AddTransient<IReleaseCreator, CreateReleaseTasks>();
|
||||||
services.AddTransient<IUploadTasks, UploadTasks>();
|
services.AddTransient<IUploadTasks, UploadTasks>();
|
||||||
services.AddTransient<Program>();
|
services.AddTransient<Program>();
|
||||||
|
Binary file not shown.
@ -1,63 +0,0 @@
|
|||||||
using EftPatchHelper.Extensions;
|
|
||||||
using EftPatchHelper.Helpers;
|
|
||||||
using EftPatchHelper.Interfaces;
|
|
||||||
using EftPatchHelper.Model;
|
|
||||||
using Spectre.Console;
|
|
||||||
|
|
||||||
namespace EftPatchHelper.Tasks;
|
|
||||||
|
|
||||||
public class CompressPatcherTasks : ICompressPatcherTasks
|
|
||||||
{
|
|
||||||
private Options _options;
|
|
||||||
private FileHelper _fileHelper;
|
|
||||||
private ZipHelper _zipHelper;
|
|
||||||
|
|
||||||
public CompressPatcherTasks(Options options, FileHelper fileHelper, ZipHelper zipHelper)
|
|
||||||
{
|
|
||||||
_options = options;
|
|
||||||
_fileHelper = fileHelper;
|
|
||||||
_zipHelper = zipHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CompressPatcher()
|
|
||||||
{
|
|
||||||
return AnsiConsole.Progress()
|
|
||||||
.Columns(new ProgressColumn[]
|
|
||||||
{
|
|
||||||
new TaskDescriptionColumn(),
|
|
||||||
new ProgressBarColumn(),
|
|
||||||
new PercentageColumn(),
|
|
||||||
new ElapsedTimeColumn(),
|
|
||||||
new SpinnerColumn(Spinner.Known.Dots2)
|
|
||||||
})
|
|
||||||
.Start(ctx =>
|
|
||||||
{
|
|
||||||
|
|
||||||
var compressionTask = ctx.AddTask("Compressing Patcher");
|
|
||||||
compressionTask.MaxValue = 100;
|
|
||||||
|
|
||||||
if (!_fileHelper.StreamAssemblyResourceOut("7z.dll", _zipHelper.DllPath))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var patchFolder = new DirectoryInfo(_options.OutputPatchPath);
|
|
||||||
|
|
||||||
var patchArchiveFile = new FileInfo(_options.OutputPatchPath + ".7z");
|
|
||||||
|
|
||||||
if (!patchFolder.Exists)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var progress = new Progress<double>(p => { compressionTask.Increment(p - compressionTask.Percentage);});
|
|
||||||
|
|
||||||
return _zipHelper.Compress(patchFolder, patchArchiveFile, progress);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
CompressPatcher().ValidateOrExit();
|
|
||||||
}
|
|
||||||
}
|
|
@ -48,7 +48,7 @@ namespace EftPatchHelper.Tasks
|
|||||||
$"OutputFolderName::{patcherOutputName}",
|
$"OutputFolderName::{patcherOutputName}",
|
||||||
$"SourceFolderPath::{_options.SourceClient.PrepPath}",
|
$"SourceFolderPath::{_options.SourceClient.PrepPath}",
|
||||||
$"TargetFolderPath::{_options.TargetClient.PrepPath}",
|
$"TargetFolderPath::{_options.TargetClient.PrepPath}",
|
||||||
$"AutoZip::false",
|
$"AutoZip::{_settings.AutoZip}",
|
||||||
$"AutoClose::{_settings.AutoClose}"
|
$"AutoClose::{_settings.AutoClose}"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -45,7 +45,7 @@ namespace EftPatchHelper.Tasks
|
|||||||
{
|
{
|
||||||
var gofile = new GoFileUpload(patcherFile, _settings.GoFileApiKey, _settings.GoFileFolderId);
|
var gofile = new GoFileUpload(patcherFile, _settings.GoFileApiKey, _settings.GoFileFolderId);
|
||||||
_fileUploads.Add(gofile);
|
_fileUploads.Add(gofile);
|
||||||
AnsiConsole.WriteLine("Added GoFile");
|
AnsiConsole.WriteLine("Added MEGA");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_settings.SftpUploads.Count > 0 && _options.UploadToSftpSites)
|
if (_settings.SftpUploads.Count > 0 && _options.UploadToSftpSites)
|
||||||
@ -134,8 +134,6 @@ namespace EftPatchHelper.Tasks
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnsiConsole.MarkupLine($"[blue]Starting {_fileUploads[0].UploadFileInfo.Name} uploads ...[/]");
|
|
||||||
|
|
||||||
var succeeded = await AnsiConsole.Progress().Columns(
|
var succeeded = await AnsiConsole.Progress().Columns(
|
||||||
new TaskDescriptionColumn() { Alignment = Justify.Left},
|
new TaskDescriptionColumn() { Alignment = Justify.Left},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user