Skip to content

Commit

Permalink
Bugfix vector3f xml type
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankvdStam committed Jun 17, 2022
1 parent c568e96 commit 407d8c1
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 17 deletions.
Binary file modified Components/SoulMemory.dll
Binary file not shown.
Binary file modified Components/SoulSplitter.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions Components/Updates.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<updates>
<update version="1.0.31">
<files>
<file path="Components/SoulMemory.dll" status="changed" />
<file path="Components/SoulSplitter.dll" status="changed" />
</files>
<changelog>
<change>Bugfix reading Sekiro position based splits from the .lss file work properly now</change>
</changelog>
</update>
<update version="1.0.30">
<files>
<file path="Components/SoulMemory.dll" status="changed" />
Expand Down
4 changes: 2 additions & 2 deletions src/SoulMemory/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.30")]
[assembly: AssemblyFileVersion("1.0.30")]
[assembly: AssemblyVersion("1.0.31")]
[assembly: AssemblyFileVersion("1.0.31")]
4 changes: 4 additions & 0 deletions src/SoulMemory/Vector3f.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace SoulMemory
{
[XmlType(Namespace = "SoulMemory")]
public class Vector3f
{
public Vector3f(){ }
Expand All @@ -17,7 +19,9 @@ public Vector3f(float x, float y, float z)
}

public float X { get; set; }

public float Y { get; set; }

public float Z { get; set; }

public Vector3f Clone()
Expand Down
4 changes: 2 additions & 2 deletions src/SoulSplitter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.30")]
[assembly: AssemblyFileVersion("1.0.30")]
[assembly: AssemblyVersion("1.0.31")]
[assembly: AssemblyFileVersion("1.0.31")]
2 changes: 1 addition & 1 deletion src/SoulSplitter/UI/Sekiro/HierarchicalViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class HierarchicalSplitViewModel : INotifyPropertyChanged
[NonSerialized]
public HierarchicalSplitTypeViewModel Parent;

[XmlElement(Namespace = "Sekiro")]
//[XmlElement(Namespace = "Sekiro")]
public object Split
{
get => _split;
Expand Down
2 changes: 1 addition & 1 deletion src/SoulSplitter/VersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace SoulSplitter
{
internal static class VersionHelper
{
public static Version Version => new Version(1, 0, 30);
public static Version Version => new Version(1, 0, 31);
}
}
50 changes: 39 additions & 11 deletions tests/SoulSplitter.Tests/SoulComponentTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using LiveSplit.Model;
using Moq;
using NUnit.Framework;
using SoulMemory;
using SoulSplitter.Splits.Sekiro;
using SoulSplitter.UI;

namespace SoulSplitter.Tests
Expand All @@ -28,19 +31,22 @@ public void SetSettingsTest()
{
var viewModel = new MainViewModel();
viewModel.EldenRingViewModel.StartAutomatically = false;
viewModel.SekiroViewModel.NewSplitTimingType = TimingType.Immediate;
viewModel.SekiroViewModel.NewSplitType = SplitType.Position;
viewModel.SekiroViewModel.NewSplitValue = new Vector3f(1.0f, 2.0f, 3.0f);
viewModel.SekiroViewModel.AddSplit();

var xml = viewModel.Serialize();
var deserializedViewModel = MainViewModel.Deserialize(xml);

var xml = MainViewModelToXml(viewModel);

var doc = new XmlDocument();
doc.LoadXml(xml);

var liveSplitStateMock = new Mock<LiveSplitState>(null, null, null, null, null);
var component = new SoulComponent(liveSplitStateMock.Object);
component.SetSettings(doc);

var componentViewModel = component.MainControlFormsWrapper.MainViewModel;
Assert.AreEqual(viewModel.EldenRingViewModel.StartAutomatically, deserializedViewModel.EldenRingViewModel.StartAutomatically);

var vector = deserializedViewModel.SekiroViewModel.Splits.FirstOrDefault().Children.FirstOrDefault().Children.FirstOrDefault().Split;

Assert.AreEqual(viewModel.EldenRingViewModel.StartAutomatically, componentViewModel.EldenRingViewModel.StartAutomatically);
Assert.AreEqual(typeof(Vector3f), vector.GetType());
Assert.AreEqual(1.0f, ((Vector3f)vector).X);
Assert.AreEqual(2.0f, ((Vector3f)vector).Y);
Assert.AreEqual(3.0f, ((Vector3f)vector).Z);
}


Expand Down Expand Up @@ -83,6 +89,28 @@ public void SetSettingsTest2()
private const string ExampleSettings = @"<MainViewModel xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">
<Version>1.0.24</Version>
<SelectedGameIndex>2</SelectedGameIndex>
<SekiroViewModel>
<StartAutomatically>true</StartAutomatically>
<Splits>
<HierarchicalTimingTypeViewModel>
<TimingType xmlns=""Sekiro"">Immediate</TimingType>
<Children xmlns=""Sekiro"">
<HierarchicalSplitTypeViewModel>
<SplitType>Position</SplitType>
<Children>
<HierarchicalSplitViewModel>
<Split xsi:type=""Vector3f"">
<X xmlns="""">-304.803772</X>
<Y xmlns="""">-53.6740761</Y>
<Z xmlns="""">305.3302</Z>
</Split>
</HierarchicalSplitViewModel>
</Children>
</HierarchicalSplitTypeViewModel>
</Children>
</HierarchicalTimingTypeViewModel>
</Splits>
</SekiroViewModel>
<EldenRingViewModel>
<StartAutomatically>true</StartAutomatically>
<LockIgtToZero>false</LockIgtToZero>
Expand Down
4 changes: 4 additions & 0 deletions tests/SoulSplitter.Tests/SoulSplitter.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SoulMemory\SoulMemory.csproj">
<Project>{03480f4f-f423-4144-90c6-cbda68269374}</Project>
<Name>SoulMemory</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\SoulSplitter\SoulSplitter.csproj">
<Project>{a30986d1-6b5a-415d-a737-ae0d9ef4ce9c}</Project>
<Name>SoulSplitter</Name>
Expand Down

0 comments on commit 407d8c1

Please sign in to comment.