Skip to content

Commit 904d6ff

Browse files
committed
use Argument.ThrowIfNull
1 parent 2596247 commit 904d6ff

File tree

7 files changed

+6
-11
lines changed

7 files changed

+6
-11
lines changed

Dat/FileParsing/ByteReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public static ILocoStruct ReadLocoStruct(ReadOnlySpan<byte> data, Type t)
239239
else
240240
{
241241
var newInstance = Activator.CreateInstance(p.PropertyType);
242-
Verify.NotNull(newInstance, paramName: p.PropertyType.Name);
242+
ArgumentNullException.ThrowIfNull(newInstance, paramName: p.PropertyType.Name);
243243
args.Add(newInstance!);
244244
}
245245

Dat/FileParsing/ByteWriter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using OpenLoco.Dat.Types;
2-
using Zenith.Core;
32

43
namespace OpenLoco.Dat.FileParsing
54
{
@@ -75,7 +74,7 @@ public static void WriteT(Span<byte> data, Type t, int offset, object val)
7574

7675
public static ReadOnlySpan<byte> WriteLocoStruct(ILocoStruct obj)
7776
{
78-
Verify.NotNull(obj);
77+
ArgumentNullException.ThrowIfNull(obj);
7978

8079
var t = obj.GetType();
8180
var objSize = ByteHelpers.GetObjectSize(t);

Dat/FileParsing/ObjectAnnotator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Reflection;
44
using System.Runtime.InteropServices;
55
using System.Text;
6-
using Zenith.Core;
76

87
namespace OpenLoco.Dat.FileParsing
98
{
@@ -40,7 +39,7 @@ .. SawyerStreamReader.Decode(objectHeader.Encoding, byteList[runningCount..(int)
4039
];
4140

4241
var locoStruct = SawyerStreamReader.GetLocoStruct(s5Header.ObjectType, fullData.AsSpan()[runningCount..]);
43-
Verify.NotNull(locoStruct);
42+
ArgumentNullException.ThrowIfNull(locoStruct);
4443

4544
var structSize = AttributeHelper.Get<LocoStructSizeAttribute>(locoStruct.GetType());
4645
var locoStructSize = structSize!.Size;

Dat/FileParsing/SawyerStreamReader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using OpenLoco.Dat.Types;
66
using OpenLoco.Dat.Types.SCV5;
77
using System.Text;
8-
using Zenith.Core;
98

109
namespace OpenLoco.Dat.FileParsing
1110
{
@@ -151,7 +150,7 @@ public static (DatFileInfo DatFileInfo, ILocoObject? LocoObject) LoadFullObjectF
151150
ReadOnlySpan<byte> remainingData = decodedData;
152151

153152
var locoStruct = GetLocoStruct(s5Header.ObjectType, remainingData);
154-
Verify.NotNull(locoStruct, paramName: filename);
153+
ArgumentNullException.ThrowIfNull(locoStruct, paramName: filename);
155154

156155
var structSize = AttributeHelper.Get<LocoStructSizeAttribute>(locoStruct.GetType());
157156
var locoStructSize = structSize!.Size;

Gui/Gui.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
5656
<PackageReference Include="ReactiveUI.Validation" Version="4.1.1" />
5757
<PackageReference Include="System.Text.Json" Version="8.0.5" />
58-
<PackageReference Include="Zenith.Core" Version="1.0.20" />
5958
</ItemGroup>
6059

6160
<ItemGroup>

Gui/Models/ObjectEditorModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using System.Text.Json;
1919
using System.Threading;
2020
using System.Threading.Tasks;
21-
using Zenith.Core;
2221

2322
namespace OpenLoco.Gui.Models
2423
{
@@ -95,7 +94,7 @@ public void LoadSettings()
9594

9695
var text = File.ReadAllText(SettingsFile);
9796
var settings = JsonSerializer.Deserialize<EditorSettings>(text, options: new() { WriteIndented = true }); // todo: try-catch this for invalid settings files
98-
Verify.NotNull(settings);
97+
ArgumentNullException.ThrowIfNull(settings);
9998

10099
Settings = settings!;
101100
InitialiseDownloadDirectory();

Tests/LoadSaveTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ void assertFunc(ILocoObject obj, TreeObject struc) => Assert.Multiple(() =>
919919
Assert.That(struc.ShadowImageOffset, Is.EqualTo(0), nameof(struc.ShadowImageOffset));
920920
Assert.That(struc.var_3C, Is.EqualTo(15), nameof(struc.var_3C));
921921
Assert.That(struc.SeasonState, Is.EqualTo(3), nameof(struc.SeasonState));
922-
Assert.That(struc.var_3E, Is.EqualTo(2), nameof(struc.var_3E));
922+
Assert.That(struc.Season, Is.EqualTo(2), nameof(struc.Season));
923923
Assert.That(struc.CostIndex, Is.EqualTo(3), nameof(struc.CostIndex));
924924
Assert.That(struc.BuildCostFactor, Is.EqualTo(8), nameof(struc.BuildCostFactor));
925925
Assert.That(struc.ClearCostFactor, Is.EqualTo(4), nameof(struc.ClearCostFactor));

0 commit comments

Comments
 (0)