ran code cleanup

This commit is contained in:
IsWaffle 2022-07-09 13:14:03 -04:00
parent b999f3cb4c
commit 96b6964165
16 changed files with 82 additions and 183 deletions

View File

@ -1,9 +1,5 @@
using Spectre.Console;
using SPT_AKI_Installer.Aki.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SPT_AKI_Installer.Aki.Core.Interfaces

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SPT_AKI_Installer.Aki.Core.Interfaces
namespace SPT_AKI_Installer.Aki.Core.Interfaces
{
internal interface IProgressableTask
{

View File

@ -1,7 +1,6 @@
using Spectre.Console;
using SPT_AKI_Installer.Aki.Core.Interfaces;
using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,12 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;
using Spectre.Console;
using System.IO;
using SPT_AKI_Installer.Aki.Core.Model;
using SPT_AKI_Installer.Aki.Core.Tasks;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace SPT_AKI_Installer.Aki.Core
{

View File

@ -1,11 +1,11 @@
using Newtonsoft.Json;
using CG.Web.MegaApiClient;
using Newtonsoft.Json;
using SPT_AKI_Installer.Aki.Core.Model;
using SPT_AKI_Installer.Aki.Helper;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using CG.Web.MegaApiClient;
namespace SPT_AKI_Installer.Aki.Core.Tasks
{

View File

@ -1,6 +1,5 @@
using SPT_AKI_Installer.Aki.Core.Model;
using SPT_AKI_Installer.Aki.Helper;
using System;
using System.IO;
using System.Threading.Tasks;

View File

@ -1,9 +1,9 @@
using System;
using HttpClientProgress;
using SPT_AKI_Installer.Aki.Core.Model;
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using HttpClientProgress;
using SPT_AKI_Installer.Aki.Core.Model;
namespace SPT_AKI_Installer.Aki.Helper
{

View File

@ -1,7 +1,6 @@
using System;
using SPT_AKI_Installer.Aki.Core.Model;
using System;
using System.IO;
using Spectre.Console;
using SPT_AKI_Installer.Aki.Core.Model;
namespace SPT_AKI_Installer.Aki.Helper
{
@ -34,68 +33,5 @@ namespace SPT_AKI_Installer.Aki.Helper
return GenericResult.FromError(ex.Message);
}
}
public static void DeleteFiles(string filePath, bool allFolders = false)
{
if (File.Exists(filePath) || Directory.Exists(filePath))
{
if (filePath.Contains('.'))
{
File.Delete(filePath);
}
else
{
Directory.Delete(filePath, allFolders);
}
}
}
public static string FindFile(string path, string name)
{
string[] filePaths = Directory.GetFiles(path);
foreach (string file in filePaths)
{
if (file.Contains(name, StringComparison.OrdinalIgnoreCase))
{
return file;
}
}
return null;
}
public static string FindFile(string path, string name, string altName)
{
string[] filePaths = Directory.GetFiles(path);
foreach (string file in filePaths)
{
if (file.Contains(name, StringComparison.OrdinalIgnoreCase) &&
file.Contains(altName, StringComparison.OrdinalIgnoreCase))
{
return file;
}
}
return null;
}
public static bool FindFolder(string patchRef, string targetPath, out DirectoryInfo dir)
{
var dirInfo = new DirectoryInfo(targetPath).GetDirectories();
string patchInner = null;
foreach (var file in dirInfo)
{
if (file.FullName.Contains("patcher", StringComparison.OrdinalIgnoreCase))
{
patchInner = file.FullName;
}
}
var path = new DirectoryInfo(patchInner);
if (path.Exists)
{
dir = path;
return true;
}
dir = null;
return false;
}
}
}

View File

@ -1,7 +1,7 @@
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace SPT_AKI_Installer.Aki.Helper
{
@ -26,30 +26,5 @@ namespace SPT_AKI_Installer.Aki.Helper
{
return FileVersionInfo.GetVersionInfo(Path.Join(gamePath + "/EscapeFromTarkov.exe")).ProductVersion.Replace('-', '.').Split('.')[^2];
}
//public static string GetPatcherZipPath(string gameVersion, string targetPath)
//{
// // example patch name - Patcher.12.12.15.17861.to.12.12.15.17349.zip
// var patchZip = FileHelper.FindFile(targetPath, gameVersion, "Patcher");
// if (patchZip == null)
// {
// patchZip = FileHelper.FindFile(targetPath, "PATCHERZIP");
// }
// return patchZip;
//}
//public static string GetAkiZipPath(string targetPath)
//{
// // example aki name - RELEASE-SPT-2.3.1-17349.zip
// var akiZip = FileHelper.FindFile(targetPath, "SPT", "RELEASE");
// if (akiZip == null)
// {
// akiZip = FileHelper.FindFile(targetPath, "AKIZIP");
// }
// return akiZip;
//}
}
}

View File

@ -1,6 +1,6 @@
using System.Diagnostics;
using SPT_AKI_Installer.Aki.Core.Model;
using System.Diagnostics;
using System.IO;
using SPT_AKI_Installer.Aki.Core.Model;
namespace SPT_AKI_Installer.Aki.Helper
{