Created CerasConfig with KnownTypes

This commit is contained in:
erri120 2019-10-27 13:12:35 +01:00
parent 4c694eafc9
commit df3d6b4179
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
4 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,27 @@
using Ceras;
using Compression.BSA;
using VFS;
using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
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),
typeof(DropboxDownloader), typeof(GoogleDriveDownloader), typeof(HTTPDownloader),
typeof(MegaDownloader), typeof(ModDBDownloader), typeof(NexusDownloader)
}
};
}
}

View File

@ -305,7 +305,7 @@ namespace Wabbajack.Lib
Utils.Log($"Exporting Modlist to : {ModListOutputFile}");
//ModList.ToJSON(Path.Combine(ModListOutputFolder, "modlist.json"));
ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"));
ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), ref CerasConfig.Config);
if (File.Exists(ModListOutputFile))
File.Delete(ModListOutputFile);

View File

@ -87,7 +87,7 @@ namespace Wabbajack.Lib
var entry = ar.GetEntry("modlist");
using (var e = entry.Open())
//return e.FromJSON<ModList>();
return e.FromCERAS<ModList>();
return e.FromCERAS<ModList>(ref CerasConfig.Config);
}
}

View File

@ -118,6 +118,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CerasConfig.cs" />
<Compile Include="Compiler.cs" />
<Compile Include="Data.cs" />
<Compile Include="Downloaders\AbstractDownloadState.cs" />