From af6b42563df561ab8e006afc90af4e404fb7807b Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 20 Dec 2019 14:01:01 -0600 Subject: [PATCH] Ceras version tolerance enabled --- Wabbajack.Common/Utils.cs | 4 ++-- Wabbajack.Lib/ACompiler.cs | 2 +- Wabbajack.Lib/AInstaller.cs | 2 +- Wabbajack.Lib/CerasConfig.cs | 44 ++++++++++++++++++++---------------- Wabbajack.Lib/Data.cs | 9 ++++---- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index 73d2e57d..63a99525 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -310,7 +310,7 @@ namespace Wabbajack.Common return new DynamicIniData(new FileIniDataParser().ReadData(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(file))))); } - public static void ToCERAS(this T obj, string filename, ref SerializerConfig config) + public static void ToCERAS(this T obj, string filename, SerializerConfig config) { var ceras = new CerasSerializer(config); byte[] buffer = null; @@ -324,7 +324,7 @@ namespace Wabbajack.Common } } - public static T FromCERAS(this Stream data, ref SerializerConfig config) + public static T FromCERAS(this Stream data, SerializerConfig config) { var ceras = new CerasSerializer(config); byte[] bytes = data.ReadAll(); diff --git a/Wabbajack.Lib/ACompiler.cs b/Wabbajack.Lib/ACompiler.cs index b11208d2..91867405 100644 --- a/Wabbajack.Lib/ACompiler.cs +++ b/Wabbajack.Lib/ACompiler.cs @@ -98,7 +98,7 @@ namespace Wabbajack.Lib ModList.ReadmeIsWebsite = ReadmeIsWebsite; //ModList.ToJSON(Path.Combine(ModListOutputFolder, "modlist.json")); - ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), ref CerasConfig.Config); + ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), CerasConfig.Config); if (File.Exists(ModListOutputFile)) File.Delete(ModListOutputFile); diff --git a/Wabbajack.Lib/AInstaller.cs b/Wabbajack.Lib/AInstaller.cs index 23dfd790..b87f9058 100644 --- a/Wabbajack.Lib/AInstaller.cs +++ b/Wabbajack.Lib/AInstaller.cs @@ -78,7 +78,7 @@ namespace Wabbajack.Lib return e.FromJSON(); } using (var e = entry.Open()) - return e.FromCERAS(ref CerasConfig.Config); + return e.FromCERAS(CerasConfig.Config); } } diff --git a/Wabbajack.Lib/CerasConfig.cs b/Wabbajack.Lib/CerasConfig.cs index 290bc843..3997c8bf 100644 --- a/Wabbajack.Lib/CerasConfig.cs +++ b/Wabbajack.Lib/CerasConfig.cs @@ -8,25 +8,31 @@ namespace Wabbajack.Lib { public class CerasConfig { - public static SerializerConfig Config = new SerializerConfig - { - KnownTypes = - { - typeof(ModList), typeof(Game), typeof(Directive), typeof(IgnoredDirectly), - typeof(NoMatch), typeof(InlineFile), typeof(PropertyType), typeof(CleanedESM), - typeof(RemappedInlineFile), typeof(FromArchive), typeof(CreateBSA), typeof(PatchedFromArchive), - typeof(SourcePatch), typeof(MergedPatch), typeof(Archive), typeof(IndexedArchive), typeof(IndexedEntry), - typeof(IndexedArchiveEntry), typeof(BSAIndexedEntry), typeof(VirtualFile), - typeof(ArchiveStateObject), typeof(FileStateObject), typeof(IDownloader), - typeof(IUrlDownloader), typeof(AbstractDownloadState), typeof(ManualDownloader.State), - typeof(DropboxDownloader), typeof(GoogleDriveDownloader.State), typeof(HTTPDownloader.State), - typeof(MegaDownloader.State), typeof(ModDBDownloader.State), typeof(NexusDownloader.State), - 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) + public static readonly SerializerConfig Config; - } - }; + static CerasConfig() + { + Config = new SerializerConfig + { + KnownTypes = + { + typeof(ModList), typeof(Game), typeof(Directive), typeof(IgnoredDirectly), + typeof(NoMatch), typeof(InlineFile), typeof(PropertyType), typeof(CleanedESM), + typeof(RemappedInlineFile), typeof(FromArchive), typeof(CreateBSA), typeof(PatchedFromArchive), + typeof(SourcePatch), typeof(MergedPatch), typeof(Archive), typeof(IndexedArchive), typeof(IndexedEntry), + typeof(IndexedArchiveEntry), typeof(BSAIndexedEntry), typeof(VirtualFile), + typeof(ArchiveStateObject), typeof(FileStateObject), typeof(IDownloader), + typeof(IUrlDownloader), typeof(AbstractDownloadState), typeof(ManualDownloader.State), + typeof(DropboxDownloader), typeof(GoogleDriveDownloader.State), typeof(HTTPDownloader.State), + typeof(MegaDownloader.State), typeof(ModDBDownloader.State), typeof(NexusDownloader.State), + 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) + + }, + }; + Config.VersionTolerance.Mode = VersionToleranceMode.Standard; + } } } diff --git a/Wabbajack.Lib/Data.cs b/Wabbajack.Lib/Data.cs index e438eadc..df21b4ee 100644 --- a/Wabbajack.Lib/Data.cs +++ b/Wabbajack.Lib/Data.cs @@ -91,11 +91,6 @@ namespace Wabbajack.Lib /// public string Readme; - /// - /// Whether readme is a website - /// - public bool ReadmeIsWebsite; - /// /// Content Report in HTML form /// @@ -118,6 +113,10 @@ namespace Wabbajack.Lib .Take(Environment.ProcessorCount) .Sum(a => a.Size) * 2; + /// + /// Whether readme is a website + /// + public bool ReadmeIsWebsite; } public class Directive