Skip to content

Commit 4d330b9

Browse files
format
1 parent 24e281a commit 4d330b9

8 files changed

Lines changed: 159 additions & 151 deletions

File tree

Maple2.File.Cli/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Maple2.File.IO;
1+
using Maple2.File.IO;
22
using Maple2.File.Parser.Flat;
33

44
// Load .env from solution root

Maple2.File.IO/IsExternalInit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ReSharper disable once CheckNamespace
1+
// ReSharper disable once CheckNamespace
22
namespace System.Runtime.CompilerServices;
33

44
#if NETSTANDARD2_1

Maple2.File.IO/NetStandardExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Numerics;
33

44
namespace Maple2.File.IO;

Maple2.File.Parser/Flat/Convert/AssetIndex.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics;
1+
using System.Diagnostics;
22
using System.Text.RegularExpressions;
33
using Maple2.File.IO;
44
using Maple2.File.IO.Crypto.Common;

Maple2.File.Parser/Flat/FlatTypeIndex.cs

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Data;
1+
using System.Data;
22
using System.Drawing;
33
using System.Numerics;
44
using System.Xml;
@@ -219,33 +219,33 @@ private static void SerializePropertyValue(BinaryWriter writer, string type, obj
219219
writer.Write((double) value);
220220
break;
221221
case "Point3": {
222-
Vector3 v = (Vector3) value;
223-
writer.Write(v.X);
224-
writer.Write(v.Y);
225-
writer.Write(v.Z);
226-
break;
227-
}
222+
Vector3 v = (Vector3) value;
223+
writer.Write(v.X);
224+
writer.Write(v.Y);
225+
writer.Write(v.Z);
226+
break;
227+
}
228228
case "Point2": {
229-
Vector2 v = (Vector2) value;
230-
writer.Write(v.X);
231-
writer.Write(v.Y);
232-
break;
233-
}
229+
Vector2 v = (Vector2) value;
230+
writer.Write(v.X);
231+
writer.Write(v.Y);
232+
break;
233+
}
234234
case "Color": {
235-
Color c = (Color) value;
236-
writer.Write(c.R);
237-
writer.Write(c.G);
238-
writer.Write(c.B);
239-
break;
240-
}
235+
Color c = (Color) value;
236+
writer.Write(c.R);
237+
writer.Write(c.G);
238+
writer.Write(c.B);
239+
break;
240+
}
241241
case "ColorA": {
242-
Color c = (Color) value;
243-
writer.Write(c.A);
244-
writer.Write(c.R);
245-
writer.Write(c.G);
246-
writer.Write(c.B);
247-
break;
248-
}
242+
Color c = (Color) value;
243+
writer.Write(c.A);
244+
writer.Write(c.R);
245+
writer.Write(c.G);
246+
writer.Write(c.B);
247+
break;
248+
}
249249
case "String":
250250
case "EntityRef":
251251
case "AssetID":
@@ -254,43 +254,43 @@ private static void SerializePropertyValue(BinaryWriter writer, string type, obj
254254
case "AssocString":
255255
case "AssocEntityRef":
256256
case "AssocAttachedNifAsset": {
257-
var dict = (Dictionary<string, string>) value;
258-
writer.Write(dict.Count);
259-
foreach (var kvp in dict) {
260-
writer.Write(kvp.Key ?? string.Empty);
261-
writer.Write(kvp.Value ?? string.Empty);
257+
var dict = (Dictionary<string, string>) value;
258+
writer.Write(dict.Count);
259+
foreach (var kvp in dict) {
260+
writer.Write(kvp.Key ?? string.Empty);
261+
writer.Write(kvp.Value ?? string.Empty);
262+
}
263+
break;
262264
}
263-
break;
264-
}
265265
case "AssocPoint3": {
266-
var dict = (Dictionary<string, Vector3>) value;
267-
writer.Write(dict.Count);
268-
foreach (var kvp in dict) {
269-
writer.Write(kvp.Key ?? string.Empty);
270-
writer.Write(kvp.Value.X);
271-
writer.Write(kvp.Value.Y);
272-
writer.Write(kvp.Value.Z);
266+
var dict = (Dictionary<string, Vector3>) value;
267+
writer.Write(dict.Count);
268+
foreach (var kvp in dict) {
269+
writer.Write(kvp.Key ?? string.Empty);
270+
writer.Write(kvp.Value.X);
271+
writer.Write(kvp.Value.Y);
272+
writer.Write(kvp.Value.Z);
273+
}
274+
break;
273275
}
274-
break;
275-
}
276276
case "AssocUInt32": {
277-
var dict = (Dictionary<string, uint>) value;
278-
writer.Write(dict.Count);
279-
foreach (var kvp in dict) {
280-
writer.Write(kvp.Key ?? string.Empty);
281-
writer.Write(kvp.Value);
277+
var dict = (Dictionary<string, uint>) value;
278+
writer.Write(dict.Count);
279+
foreach (var kvp in dict) {
280+
writer.Write(kvp.Key ?? string.Empty);
281+
writer.Write(kvp.Value);
282+
}
283+
break;
282284
}
283-
break;
284-
}
285285
case "AssocSInt32": {
286-
var dict = (Dictionary<string, int>) value;
287-
writer.Write(dict.Count);
288-
foreach (var kvp in dict) {
289-
writer.Write(kvp.Key ?? string.Empty);
290-
writer.Write(kvp.Value);
286+
var dict = (Dictionary<string, int>) value;
287+
writer.Write(dict.Count);
288+
foreach (var kvp in dict) {
289+
writer.Write(kvp.Key ?? string.Empty);
290+
writer.Write(kvp.Value);
291+
}
292+
break;
291293
}
292-
break;
293-
}
294294
default:
295295
throw new ArgumentException($"Unknown property type for serialization: {type}");
296296
}
@@ -325,37 +325,37 @@ private static object DeserializePropertyValue(BinaryReader reader, string type)
325325
case "AssocString":
326326
case "AssocEntityRef":
327327
case "AssocAttachedNifAsset": {
328-
int count = reader.ReadInt32();
329-
var dict = new Dictionary<string, string>(count);
330-
for (int i = 0; i < count; i++) {
331-
dict[reader.ReadString()] = reader.ReadString();
328+
int count = reader.ReadInt32();
329+
var dict = new Dictionary<string, string>(count);
330+
for (int i = 0; i < count; i++) {
331+
dict[reader.ReadString()] = reader.ReadString();
332+
}
333+
return dict;
332334
}
333-
return dict;
334-
}
335335
case "AssocPoint3": {
336-
int count = reader.ReadInt32();
337-
var dict = new Dictionary<string, Vector3>(count);
338-
for (int i = 0; i < count; i++) {
339-
dict[reader.ReadString()] = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
336+
int count = reader.ReadInt32();
337+
var dict = new Dictionary<string, Vector3>(count);
338+
for (int i = 0; i < count; i++) {
339+
dict[reader.ReadString()] = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
340+
}
341+
return dict;
340342
}
341-
return dict;
342-
}
343343
case "AssocUInt32": {
344-
int count = reader.ReadInt32();
345-
var dict = new Dictionary<string, uint>(count);
346-
for (int i = 0; i < count; i++) {
347-
dict[reader.ReadString()] = reader.ReadUInt32();
344+
int count = reader.ReadInt32();
345+
var dict = new Dictionary<string, uint>(count);
346+
for (int i = 0; i < count; i++) {
347+
dict[reader.ReadString()] = reader.ReadUInt32();
348+
}
349+
return dict;
348350
}
349-
return dict;
350-
}
351351
case "AssocSInt32": {
352-
int count = reader.ReadInt32();
353-
var dict = new Dictionary<string, int>(count);
354-
for (int i = 0; i < count; i++) {
355-
dict[reader.ReadString()] = reader.ReadInt32();
352+
int count = reader.ReadInt32();
353+
var dict = new Dictionary<string, int>(count);
354+
for (int i = 0; i < count; i++) {
355+
dict[reader.ReadString()] = reader.ReadInt32();
356+
}
357+
return dict;
356358
}
357-
return dict;
358-
}
359359
default:
360360
throw new ArgumentException($"Unknown property type for deserialization: {type}");
361361
}

Maple2.File.Parser/Flat/ModelToNifResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Maple2.File.IO;
1+
using Maple2.File.IO;
22

33
namespace Maple2.File.Parser.Flat;
44

Maple2.File.Tests/FlatTypeIndexSerializationTest.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Drawing;
1+
using System.Drawing;
22
using System.Numerics;
33
using Maple2.File.Parser.Flat;
44
using Maple2.File.Parser.Flat.Convert;
@@ -536,47 +536,55 @@ private static (string, string, string, string, string[], Action<BinaryWriter>)
536536

537537
private static (string, string, string, string, string[], Action<BinaryWriter>) MakePoint3Property(
538538
string name, string id, string source, Vector3 value) =>
539-
(name, id, source, "Point3", Array.Empty<string>(), w => { w.Write(value.X); w.Write(value.Y); w.Write(value.Z); });
539+
(name, id, source, "Point3", Array.Empty<string>(), w => { w.Write(value.X); w.Write(value.Y); w.Write(value.Z); }
540+
);
540541

541542
private static (string, string, string, string, string[], Action<BinaryWriter>) MakePoint2Property(
542543
string name, string id, string source, Vector2 value) =>
543-
(name, id, source, "Point2", Array.Empty<string>(), w => { w.Write(value.X); w.Write(value.Y); });
544+
(name, id, source, "Point2", Array.Empty<string>(), w => { w.Write(value.X); w.Write(value.Y); }
545+
);
544546

545547
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeColorProperty(
546548
string name, string id, string source, Color value) =>
547-
(name, id, source, "Color", Array.Empty<string>(), w => { w.Write(value.R); w.Write(value.G); w.Write(value.B); });
549+
(name, id, source, "Color", Array.Empty<string>(), w => { w.Write(value.R); w.Write(value.G); w.Write(value.B); }
550+
);
548551

549552
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeColorAProperty(
550553
string name, string id, string source, Color value) =>
551-
(name, id, source, "ColorA", Array.Empty<string>(), w => { w.Write(value.A); w.Write(value.R); w.Write(value.G); w.Write(value.B); });
554+
(name, id, source, "ColorA", Array.Empty<string>(), w => { w.Write(value.A); w.Write(value.R); w.Write(value.G); w.Write(value.B); }
555+
);
552556

553557
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeAssocStringProperty(
554558
string name, string id, string source, Dictionary<string, string> value) =>
555559
(name, id, source, "AssocString", Array.Empty<string>(), w => {
556560
w.Write(value.Count);
557561
foreach (var kvp in value) { w.Write(kvp.Key); w.Write(kvp.Value); }
558-
});
562+
}
563+
);
559564

560565
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeAssocPoint3Property(
561566
string name, string id, string source, Dictionary<string, Vector3> value) =>
562567
(name, id, source, "AssocPoint3", Array.Empty<string>(), w => {
563568
w.Write(value.Count);
564569
foreach (var kvp in value) { w.Write(kvp.Key); w.Write(kvp.Value.X); w.Write(kvp.Value.Y); w.Write(kvp.Value.Z); }
565-
});
570+
}
571+
);
566572

567573
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeAssocUInt32Property(
568574
string name, string id, string source, Dictionary<string, uint> value) =>
569575
(name, id, source, "AssocUInt32", Array.Empty<string>(), w => {
570576
w.Write(value.Count);
571577
foreach (var kvp in value) { w.Write(kvp.Key); w.Write(kvp.Value); }
572-
});
578+
}
579+
);
573580

574581
private static (string, string, string, string, string[], Action<BinaryWriter>) MakeAssocSInt32Property(
575582
string name, string id, string source, Dictionary<string, int> value) =>
576583
(name, id, source, "AssocSInt32", Array.Empty<string>(), w => {
577584
w.Write(value.Count);
578585
foreach (var kvp in value) { w.Write(kvp.Key); w.Write(kvp.Value); }
579-
});
586+
}
587+
);
580588

581589
private static (string Name, string Id, string Type, string Source, string[] Traits) MakeBehavior(
582590
string name, string id, string type, string source, string[] traits) =>

0 commit comments

Comments
 (0)