diff --git a/Nodsoft.WowsReplaysUnpack.Console/Program.cs b/Nodsoft.WowsReplaysUnpack.Console/Program.cs index 65121d4..1e79939 100644 --- a/Nodsoft.WowsReplaysUnpack.Console/Program.cs +++ b/Nodsoft.WowsReplaysUnpack.Console/Program.cs @@ -1,4 +1,6 @@ using Nodsoft.WowsReplaysUnpack.Console.Samples.EntitySerializer; +using Nodsoft.WowsReplaysUnpack.Console.Tests; // await new SyncTest().ExecuteAsync(); -await new EntitySerializerSample().ExecuteAsync(); \ No newline at end of file +//await new EntitySerializerSample().ExecuteAsync(); +new BrokenReplayTests().Execute(); \ No newline at end of file diff --git a/Nodsoft.WowsReplaysUnpack.Console/Tests/BrokenReplayTests.cs b/Nodsoft.WowsReplaysUnpack.Console/Tests/BrokenReplayTests.cs new file mode 100644 index 0000000..abd8bf0 --- /dev/null +++ b/Nodsoft.WowsReplaysUnpack.Console/Tests/BrokenReplayTests.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.DependencyInjection; +using Nodsoft.WowsReplaysUnpack.Services; +using System.IO; + +namespace Nodsoft.WowsReplaysUnpack.Console.Tests; + +public class BrokenReplayTests +{ + public void Execute() + { + var services = new ServiceCollection(); + services.AddLogging(); + services.AddWowsReplayUnpacker(); + var sp = services.BuildServiceProvider(); + + var path = @"E:\Downloads\20241104_185414_PWSB719-Niord_19_OC_prey.wowsreplay"; + // var path = + // @"E:\Downloads\5915c052ee734ef68f0b6b0065a0fe52-20241027_003342_PHSD509-Groningen_45_Zigzag.wowsreplay"; + var fs = File.OpenRead(path); + + var replay = sp.GetRequiredService() + .GetUnpacker() + .Unpack(fs); + + System.Console.WriteLine(); + } +} \ No newline at end of file diff --git a/Nodsoft.WowsReplaysUnpack.Core/Definitions/EntityDefinition.cs b/Nodsoft.WowsReplaysUnpack.Core/Definitions/EntityDefinition.cs index d18f3ea..9e224f9 100644 --- a/Nodsoft.WowsReplaysUnpack.Core/Definitions/EntityDefinition.cs +++ b/Nodsoft.WowsReplaysUnpack.Core/Definitions/EntityDefinition.cs @@ -9,7 +9,7 @@ namespace Nodsoft.WowsReplaysUnpack.Core.Definitions; public sealed class EntityDefinition : BaseDefinition { private const string ENTITY_DEFS = "entity_defs"; - + private List CellMethods { get; set; } = new(); // public List BaseMethods { get; set; } = new(); @@ -18,8 +18,10 @@ public sealed class EntityDefinition : BaseDefinition /// public List ClientMethods { get; private set; } = new(); - private EntityDefinition(Version clientVersion, IDefinitionStore definitionStore, string name) - : base(clientVersion, definitionStore, name, ENTITY_DEFS) { } + private EntityDefinition(Version clientVersion, IDefinitionStore definitionStore, string name) + : base(clientVersion, definitionStore, name, ENTITY_DEFS) + { + } public static EntityDefinition Create(Version clientVersion, IDefinitionStore definitionStore, string name) { @@ -28,11 +30,12 @@ public static EntityDefinition Create(Version clientVersion, IDefinitionStore de { throw new Exception("XmlDocument has to be set"); } + definition.ParseDefinitionFile(definition.XmlDocument); definition.XmlDocument = null; // Xml does not need to stay in memory return definition; } - + /// /// Parses a .def file for the entity definition. /// @@ -57,7 +60,9 @@ private void ParseMethods(XmlNode? methodsNode, ICollection