bump
This commit is contained in:
parent
aceb8cf4e3
commit
a0d715cb44
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 420 KiB |
@ -2,22 +2,32 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Installer.Aki.Helper;
|
||||
using SPT_AKI_Installer.Aki.Helper;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Installer.Aki.Core
|
||||
namespace SPT_AKI_Installer.Aki.Core
|
||||
{
|
||||
//TODO:
|
||||
// delete patcher zip and aki zip
|
||||
// progress for copyDirectory
|
||||
// move Game/patcher/aki check methods out of core
|
||||
// add figlet for SPT-AKI INSTALLER
|
||||
// locales, language selection
|
||||
|
||||
public static class SPTinstaller
|
||||
{
|
||||
public static string targetPath = Environment.CurrentDirectory;
|
||||
private static string patchRef;
|
||||
private static string akiRef;
|
||||
private static DirectoryInfo dir;
|
||||
private static string gamePath;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string gamePath = GameHelper.DetectOriginalGamePath();
|
||||
#if DEBUG
|
||||
targetPath = @"D:\install";
|
||||
#endif
|
||||
GameCheck(out gamePath);
|
||||
|
||||
if (PatcherCheck(gamePath, out patchRef))
|
||||
{
|
||||
@ -48,14 +58,16 @@ namespace Installer.Aki.Core
|
||||
Console.ReadKey();
|
||||
|
||||
// copies and pastes EFT to AKI installer test folder
|
||||
FileHelper.CopyDirectory(gamePath, Environment.CurrentDirectory, true);
|
||||
#if !DEBUG
|
||||
FileHelper.CopyDirectory(gamePath, targetPath, true);
|
||||
LogHelper.User("GAME HAS BEEN COPIED, PRESS ENTER TO EXTRACT PATCHER!");
|
||||
Console.ReadKey();
|
||||
#endif
|
||||
|
||||
// extracts patcher and moves out inner folders
|
||||
ZipHelper.Decompress(patchRef, Environment.CurrentDirectory);
|
||||
ZipHelper.Decompress(patchRef, targetPath);
|
||||
FileHelper.FindFolder(patchRef, out dir);
|
||||
FileHelper.CopyDirectory(dir.FullName, Environment.CurrentDirectory, true);
|
||||
FileHelper.CopyDirectory(dir.FullName, targetPath, true);
|
||||
if (dir.Exists)
|
||||
{
|
||||
dir.Delete(true);
|
||||
@ -68,9 +80,9 @@ namespace Installer.Aki.Core
|
||||
}
|
||||
|
||||
// starts patcher and checks for user input to exit patcher and proceed
|
||||
LogHelper.User("PATCHER HAS BEEN EXTRACTED, STARTING PATCHER!");
|
||||
ProcessHelper patcherProcess = new ProcessHelper();
|
||||
patcherProcess.StartProcess(Path.Join(Environment.CurrentDirectory + "/patcher.exe"), Environment.CurrentDirectory);
|
||||
LogHelper.Info("PATCHER HAS BEEN EXTRACTED, STARTING PATCHER!");
|
||||
ProcessHelper patcherProcess = new();
|
||||
patcherProcess.StartProcess(Path.Join(targetPath + "/patcher.exe"), targetPath);
|
||||
LogHelper.User("PATCHER HAS BEEN STARTED, TYPE YES ONCE THE PATCHER IS COMPLETE!");
|
||||
var complete = Console.ReadLine();
|
||||
|
||||
@ -87,20 +99,44 @@ namespace Installer.Aki.Core
|
||||
{
|
||||
patcherProcess.EndProcess();
|
||||
Thread.Sleep(1000);
|
||||
FileHelper.DeleteFile("file", Environment.CurrentDirectory + "/patcher.exe");
|
||||
ZipHelper.Decompress(akiRef, Environment.CurrentDirectory);
|
||||
FileHelper.DeleteFile("file", targetPath + "/patcher.exe");
|
||||
ZipHelper.Decompress(akiRef, targetPath);
|
||||
LogHelper.Info("AKI HAS BEEN EXTRACTED, RUN THE SERVER AND WAIT TILL YOU SEE HAPPY SERVER THEN LAUNCHER AND ENJOY!");
|
||||
LogHelper.User("PRESS ENTER TO CLOSE THE APP");
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checks the game is installed, out = game directory
|
||||
/// </summary>
|
||||
/// <param name="gamePath"></param>
|
||||
private static void GameCheck(out string gamePath)
|
||||
{
|
||||
string Path = GameHelper.DetectOriginalGamePath();
|
||||
|
||||
if (Path == null)
|
||||
{
|
||||
LogHelper.Error("EFT IS NOT INSTALLED!");
|
||||
LogHelper.Error("Press enter to close the app");
|
||||
Console.ReadKey();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
gamePath = Path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checks for patcher zip path, out = patcher path
|
||||
/// </summary>
|
||||
/// <param name="gamePath"></param>
|
||||
/// <param name="patchRef"></param>
|
||||
/// <returns>bool</returns>
|
||||
private static bool PatcherCheck(string gamePath, out string patchRef)
|
||||
{
|
||||
FileVersionInfo version = FileVersionInfo.GetVersionInfo(Path.Join(gamePath + "/EscapeFromTarkov.exe"));
|
||||
string versionCheck = StringHelper.Splitter(version.ProductVersion, '-', '.', 2);
|
||||
LogHelper.Info($"GAME VERSION IS: {version.ProductVersion}");
|
||||
string patcherRef = FileHelper.FindFile(Environment.CurrentDirectory, versionCheck);
|
||||
string patcherRef = FileHelper.FindFile(targetPath, versionCheck);
|
||||
|
||||
if (patcherRef != null)
|
||||
{
|
||||
@ -111,9 +147,14 @@ namespace Installer.Aki.Core
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checks for aki zip path, out = aki path
|
||||
/// </summary>
|
||||
/// <param name="akiRef"></param>
|
||||
/// <returns>bool</returns>
|
||||
private static bool AkiCheck(out string akiRef)
|
||||
{
|
||||
string aki = FileHelper.FindFile(Environment.CurrentDirectory, "2.3.1");
|
||||
string aki = FileHelper.FindFile(targetPath, "2.3.1");
|
||||
|
||||
if (aki != null)
|
||||
{
|
||||
|
@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using SPT_AKI_Installer.Aki.Core;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public static class FileHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// CopyDirectory will use old path and copy to new path and
|
||||
/// CopyDirectory will use old path and copy to new path and
|
||||
/// asks if inner files/folders should be included
|
||||
/// </summary>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
@ -23,7 +24,6 @@ namespace Installer.Aki.Helper
|
||||
|
||||
foreach (FileInfo file in dir.GetFiles())
|
||||
{
|
||||
Console.WriteLine(file.FullName);
|
||||
string targetFilePath = Path.Combine(newDir, file.Name);
|
||||
file.CopyTo(targetFilePath, true);
|
||||
}
|
||||
@ -39,7 +39,7 @@ namespace Installer.Aki.Helper
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DeleteFiles will use a type to look for, the path
|
||||
/// DeleteFiles will use a type to look for, the path
|
||||
/// and if all inner files/folders should be included
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -88,7 +88,7 @@ namespace Installer.Aki.Helper
|
||||
{
|
||||
var patchInfo = new FileInfo(patchRef);
|
||||
var patchName = patchInfo.Name.Replace(patchInfo.Extension, "");
|
||||
var path = new DirectoryInfo(Path.Join(Environment.CurrentDirectory, patchName));
|
||||
var path = new DirectoryInfo(Path.Join(SPTinstaller.targetPath, patchName));
|
||||
if (path.Exists)
|
||||
{
|
||||
dir = path;
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public static class GameHelper
|
||||
{
|
||||
|
@ -1,19 +1,22 @@
|
||||
using System;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public static class LogHelper
|
||||
{
|
||||
private static void Log(string tag, string message, string foreground, string background = "black")
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[{foreground} on {background}][[{tag}]]: {message.EscapeMarkup()}[/]");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Outputs a string to console starting with [USER] with
|
||||
/// a Green background and Black foreground
|
||||
/// </summary>
|
||||
public static void User(string text)
|
||||
{
|
||||
Console.BackgroundColor = ConsoleColor.Green;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
Console.WriteLine($"[USER]: {text}");
|
||||
Console.ResetColor();
|
||||
Log("USER", text, "green");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -22,10 +25,7 @@ namespace Installer.Aki.Helper
|
||||
/// </summary>
|
||||
public static void Warning(string text)
|
||||
{
|
||||
Console.BackgroundColor = ConsoleColor.Yellow;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
Console.WriteLine($"[WARNING]: {text}");
|
||||
Console.ResetColor();
|
||||
Log("WARNING", text, "yellow");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -34,10 +34,7 @@ namespace Installer.Aki.Helper
|
||||
/// </summary>
|
||||
public static void Error(string text)
|
||||
{
|
||||
Console.BackgroundColor = ConsoleColor.Red;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
Console.WriteLine($"[ERROR]: {text}");
|
||||
Console.ResetColor();
|
||||
Log("ERROR", text, "red");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -46,10 +43,7 @@ namespace Installer.Aki.Helper
|
||||
/// </summary>
|
||||
public static void Info(string text)
|
||||
{
|
||||
Console.BackgroundColor = ConsoleColor.DarkGray;
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.WriteLine($"[INFO]: {text}");
|
||||
Console.ResetColor();
|
||||
Log("INFO", text, "blue");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public class ProcessHelper
|
||||
{
|
||||
|
12
Aki.Helper/StatusHelper.cs
Normal file
12
Aki.Helper/StatusHelper.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
internal class StatusHelper
|
||||
{
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public static class StringHelper
|
||||
{
|
||||
|
@ -1,33 +1,57 @@
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Common;
|
||||
using Spectre.Console;
|
||||
using System.Linq;
|
||||
|
||||
namespace Installer.Aki.Helper
|
||||
namespace SPT_AKI_Installer.Aki.Helper
|
||||
{
|
||||
public static class ZipHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// will extract Zips in LZMA compression format, using Zips path
|
||||
/// will extract Zips in LZMA compression format, using Zips path
|
||||
/// to new path
|
||||
/// </summary>
|
||||
public static void Decompress(string zipPath, string extPath)
|
||||
public static void Decompress(string ArchivePath, string OutputFolderPath)
|
||||
{
|
||||
Stream stream = File.OpenRead(zipPath);
|
||||
var reader = ReaderFactory.Open(stream);
|
||||
|
||||
while (reader.MoveToNextEntry())
|
||||
AnsiConsole.Progress().Columns(
|
||||
new PercentageColumn(),
|
||||
new TaskDescriptionColumn(),
|
||||
new ProgressBarColumn(),
|
||||
new ElapsedTimeColumn()
|
||||
).Start((ProgressContext context) =>
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
using var archive = ZipArchive.Open(ArchivePath);
|
||||
var entries = archive.Entries.Where(entry => !entry.IsDirectory);
|
||||
var task = context.AddTask("Extracting", true, entries.Count());
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
Console.WriteLine(reader.Entry.Key);
|
||||
reader.WriteEntryToDirectory(extPath, new ExtractionOptions()
|
||||
entry.WriteToDirectory($"{OutputFolderPath}", new ExtractionOptions()
|
||||
{
|
||||
ExtractFullPath = true,
|
||||
Overwrite = true
|
||||
});
|
||||
|
||||
task.Increment(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Stream stream = File.OpenRead(zipPath);
|
||||
//var reader = ReaderFactory.Open(stream);
|
||||
|
||||
//while (reader.MoveToNextEntry())
|
||||
//{
|
||||
// if (!reader.Entry.IsDirectory)
|
||||
// {
|
||||
// Console.WriteLine(reader.Entry.Key);
|
||||
// reader.WriteEntryToDirectory(extPath, new ExtractionOptions()
|
||||
// {
|
||||
// ExtractFullPath = true,
|
||||
// Overwrite = true
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
Properties/PublishProfiles/FolderProfile.pubxml
Normal file
18
Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net6.0\publish\win-x64\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
</PropertyGroup>
|
||||
</Project>
|
9
Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
9
Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2022-05-14T00:56:09.8410037Z;True|2022-05-14T00:54:24.0683990+01:00;True|2022-05-14T00:53:04.7105427+01:00;True|2022-05-14T00:51:00.6280767+01:00;True|2022-05-14T00:49:19.4630888+01:00;True|2022-05-14T00:47:59.2166156+01:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,24 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<ApplicationIcon>Aki.Asset\icon.ico</ApplicationIcon>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Aki.Asset\" />
|
||||
<Folder Include="Aki.Locales\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpCompress" Version="0.31.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
34
SPT_AKI Installer.csproj
Normal file
34
SPT_AKI Installer.csproj
Normal file
@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<PackageIcon>icon.ico</PackageIcon>
|
||||
<ApplicationIcon>Aki.Asset\icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Aki.Asset\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Aki.Locales\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpCompress" Version="0.31.0" />
|
||||
<PackageReference Include="Spectre.Console" Version="0.44.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Aki.Asset\icon.ico">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
<None Update="Aki.Asset\icon.jpeg">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
6
SPT_AKI Installer.csproj.user
Normal file
6
SPT_AKI Installer.csproj.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>C:\Users\craig\source\repos\CWXDEV\CWX-SPTinstaller\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32407.343
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SPT-AKI Installer", "SPT-AKI Installer.csproj", "{7B07749A-3BE8-41B5-9B98-9F41C83FA15B}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SPT_AKI Installer", "SPT_AKI Installer.csproj", "{7B07749A-3BE8-41B5-9B98-9F41C83FA15B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
Loading…
x
Reference in New Issue
Block a user