From dcf0113c17c66119d2a41b5dfdc67af77f07a021 Mon Sep 17 00:00:00 2001 From: erri120 Date: Fri, 13 Dec 2019 14:31:19 +0100 Subject: [PATCH] Disabled manual game files --- Wabbajack.Common/Consts.cs | 2 +- Wabbajack.Lib/CerasConfig.cs | 2 +- .../Downloaders/DownloadDispatcher.cs | 2 +- .../Downloaders/GameFileSourceDownloader.cs | 86 ------------------- .../Downloaders/SteamWorkshopDownloader.cs | 2 - Wabbajack.Lib/VortexCompiler.cs | 10 +-- Wabbajack.Lib/Wabbajack.Lib.csproj | 1 - 7 files changed, 8 insertions(+), 97 deletions(-) delete mode 100644 Wabbajack.Lib/Downloaders/GameFileSourceDownloader.cs diff --git a/Wabbajack.Common/Consts.cs b/Wabbajack.Common/Consts.cs index c839b5f0..7b943710 100644 --- a/Wabbajack.Common/Consts.cs +++ b/Wabbajack.Common/Consts.cs @@ -33,7 +33,7 @@ namespace Wabbajack.Common public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE"; public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE"; public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE"; - public static string WABBAJACK_VORTEX_MANUAL = "WABBAJACK_VORTEX_MANUAL"; + //public static string WABBAJACK_VORTEX_MANUAL = "WABBAJACK_VORTEX_MANUAL"; public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}"; public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}"; diff --git a/Wabbajack.Lib/CerasConfig.cs b/Wabbajack.Lib/CerasConfig.cs index 290bc843..56bd2efc 100644 --- a/Wabbajack.Lib/CerasConfig.cs +++ b/Wabbajack.Lib/CerasConfig.cs @@ -24,7 +24,7 @@ namespace Wabbajack.Lib typeof(BSAStateObject), typeof(BSAFileStateObject), typeof(BA2StateObject), typeof(BA2DX10EntryState), typeof(BA2FileEntryState), typeof(MediaFireDownloader.State), typeof(ArchiveMeta), typeof(PropertyFile), typeof(SteamMeta), typeof(SteamWorkshopDownloader), typeof(SteamWorkshopDownloader.State), - typeof(LoversLabDownloader.State), typeof(GameFileSourceDownloader.State) + typeof(LoversLabDownloader.State), //typeof(GameFileSourceDownloader.State) } }; diff --git a/Wabbajack.Lib/Downloaders/DownloadDispatcher.cs b/Wabbajack.Lib/Downloaders/DownloadDispatcher.cs index f2524f95..b69a55b6 100644 --- a/Wabbajack.Lib/Downloaders/DownloadDispatcher.cs +++ b/Wabbajack.Lib/Downloaders/DownloadDispatcher.cs @@ -10,7 +10,7 @@ namespace Wabbajack.Lib.Downloaders { public static readonly List Downloaders = new List() { - new GameFileSourceDownloader(), + //new GameFileSourceDownloader(), new MegaDownloader(), new DropboxDownloader(), new GoogleDriveDownloader(), diff --git a/Wabbajack.Lib/Downloaders/GameFileSourceDownloader.cs b/Wabbajack.Lib/Downloaders/GameFileSourceDownloader.cs deleted file mode 100644 index 8f389fbd..00000000 --- a/Wabbajack.Lib/Downloaders/GameFileSourceDownloader.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Alphaleonis.Win32.Filesystem; -using Wabbajack.Common; -using Wabbajack.Lib.Validation; -using File = Alphaleonis.Win32.Filesystem.File; -using Game = Wabbajack.Common.Game; - -namespace Wabbajack.Lib.Downloaders -{ - public class GameFileSourceDownloader : IDownloader - { - public async Task GetDownloaderState(dynamic archiveINI) - { - var gameName = (string)archiveINI?.General?.gameName; - var gameFile = (string)archiveINI?.General?.gameFile; - - if (gameFile == null || gameFile == null) - return null; - - var game = GameRegistry.GetByMO2ArchiveName(gameName); - if (game == null) return null; - - var path = game.GameLocation(); - var filePath = Path.Combine(path, gameFile); - - if (!File.Exists(filePath)) - return null; - - var hash = filePath.FileHashCached(); - - return new State - { - Game = GameRegistry.GetByMO2ArchiveName(gameName).Game, - GameFile = gameFile, - Hash = hash, - }; - } - - public async Task Prepare() - { - } - - public class State : AbstractDownloadState - { - public Game Game { get; set; } - public string GameFile { get; set; } - public string Hash { get; set; } - - internal string SourcePath => Path.Combine(Game.MetaData().GameLocation(), GameFile); - - public override bool IsWhitelisted(ServerWhitelist whitelist) - { - return true; - } - - public override async Task Download(Archive a, string destination) - { - using(var src = File.OpenRead(SourcePath)) - using (var dest = File.OpenWrite(destination)) - { - var size = new FileInfo(SourcePath).Length; - src.CopyToWithStatus(size, dest, "Copying from Game folder"); - } - } - - public override async Task Verify() - { - return File.Exists(SourcePath) && SourcePath.FileHashCached() == Hash; - } - - public override IDownloader GetDownloader() - { - return DownloadDispatcher.GetInstance(); - } - - public override string GetReportEntry(Archive a) - { - return $"* Game File {Game} - {GameFile}"; - } - } - } -} diff --git a/Wabbajack.Lib/Downloaders/SteamWorkshopDownloader.cs b/Wabbajack.Lib/Downloaders/SteamWorkshopDownloader.cs index 503e8563..73bea8a6 100644 --- a/Wabbajack.Lib/Downloaders/SteamWorkshopDownloader.cs +++ b/Wabbajack.Lib/Downloaders/SteamWorkshopDownloader.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Wabbajack.Common; diff --git a/Wabbajack.Lib/VortexCompiler.cs b/Wabbajack.Lib/VortexCompiler.cs index dde32891..4906465f 100644 --- a/Wabbajack.Lib/VortexCompiler.cs +++ b/Wabbajack.Lib/VortexCompiler.cs @@ -162,7 +162,7 @@ namespace Wabbajack.Lib Error($"Found {duplicates.Count} duplicates, exiting"); } - for (var i = 0; i < AllFiles.Count; i++) + /*for (var i = 0; i < AllFiles.Count; i++) { var f = AllFiles[i]; if (!f.Path.StartsWith(Consts.GameFolderFilesDir) || !IndexedFiles.ContainsKey(f.Hash)) @@ -202,7 +202,7 @@ namespace Wabbajack.Lib AllFiles.RemoveAt(i); AllFiles.Insert(i, replace); //AllFiles.Replace(f, replace); - } + }*/ var stack = MakeStack(); @@ -384,11 +384,11 @@ namespace Wabbajack.Lib if (line.Contains("tag=")) tag = line.Substring("tag=".Length); - if (tag != Consts.WABBAJACK_VORTEX_MANUAL) + //if (tag != Consts.WABBAJACK_VORTEX_MANUAL) return; - Utils.Log($"File {f} contains the {Consts.WABBAJACK_VORTEX_MANUAL} tag, adding to ActiveArchives"); - ActiveArchives.Add(Path.GetFileNameWithoutExtension(f)); + //Utils.Log($"File {f} contains the {Consts.WABBAJACK_VORTEX_MANUAL} tag, adding to ActiveArchives"); + //ActiveArchives.Add(Path.GetFileNameWithoutExtension(f)); }); } else diff --git a/Wabbajack.Lib/Wabbajack.Lib.csproj b/Wabbajack.Lib/Wabbajack.Lib.csproj index faa70202..6694591b 100644 --- a/Wabbajack.Lib/Wabbajack.Lib.csproj +++ b/Wabbajack.Lib/Wabbajack.Lib.csproj @@ -116,7 +116,6 @@ -