Ceras version tolerance enabled

This commit is contained in:
Justin Swanson 2019-12-20 14:01:01 -06:00
parent f26747bfe5
commit af6b42563d
5 changed files with 33 additions and 28 deletions

View File

@ -310,7 +310,7 @@ namespace Wabbajack.Common
return new DynamicIniData(new FileIniDataParser().ReadData(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(file))))); return new DynamicIniData(new FileIniDataParser().ReadData(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(file)))));
} }
public static void ToCERAS<T>(this T obj, string filename, ref SerializerConfig config) public static void ToCERAS<T>(this T obj, string filename, SerializerConfig config)
{ {
var ceras = new CerasSerializer(config); var ceras = new CerasSerializer(config);
byte[] buffer = null; byte[] buffer = null;
@ -324,7 +324,7 @@ namespace Wabbajack.Common
} }
} }
public static T FromCERAS<T>(this Stream data, ref SerializerConfig config) public static T FromCERAS<T>(this Stream data, SerializerConfig config)
{ {
var ceras = new CerasSerializer(config); var ceras = new CerasSerializer(config);
byte[] bytes = data.ReadAll(); byte[] bytes = data.ReadAll();

View File

@ -98,7 +98,7 @@ namespace Wabbajack.Lib
ModList.ReadmeIsWebsite = ReadmeIsWebsite; ModList.ReadmeIsWebsite = ReadmeIsWebsite;
//ModList.ToJSON(Path.Combine(ModListOutputFolder, "modlist.json")); //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)) if (File.Exists(ModListOutputFile))
File.Delete(ModListOutputFile); File.Delete(ModListOutputFile);

View File

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

View File

@ -8,7 +8,11 @@ namespace Wabbajack.Lib
{ {
public class CerasConfig public class CerasConfig
{ {
public static SerializerConfig Config = new SerializerConfig public static readonly SerializerConfig Config;
static CerasConfig()
{
Config = new SerializerConfig
{ {
KnownTypes = KnownTypes =
{ {
@ -26,7 +30,9 @@ namespace Wabbajack.Lib
typeof(PropertyFile), typeof(SteamMeta), typeof(SteamWorkshopDownloader), typeof(SteamWorkshopDownloader.State), typeof(PropertyFile), typeof(SteamMeta), typeof(SteamWorkshopDownloader), typeof(SteamWorkshopDownloader.State),
typeof(LoversLabDownloader.State), typeof(GameFileSourceDownloader.State) typeof(LoversLabDownloader.State), typeof(GameFileSourceDownloader.State)
} },
}; };
Config.VersionTolerance.Mode = VersionToleranceMode.Standard;
}
} }
} }

View File

@ -91,11 +91,6 @@ namespace Wabbajack.Lib
/// </summary> /// </summary>
public string Readme; public string Readme;
/// <summary>
/// Whether readme is a website
/// </summary>
public bool ReadmeIsWebsite;
/// <summary> /// <summary>
/// Content Report in HTML form /// Content Report in HTML form
/// </summary> /// </summary>
@ -118,6 +113,10 @@ namespace Wabbajack.Lib
.Take(Environment.ProcessorCount) .Take(Environment.ProcessorCount)
.Sum(a => a.Size) * 2; .Sum(a => a.Size) * 2;
/// <summary>
/// Whether readme is a website
/// </summary>
public bool ReadmeIsWebsite;
} }
public class Directive public class Directive