forked from Goz3rr/SatisfactorySaveEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Vector2D and FINNetworkTrace structs
- Loading branch information
Showing
8 changed files
with
123 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
SatisfactorySaveParser/PropertyTypes/Structs/FINNetworkTrace.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.IO; | ||
|
||
using SatisfactorySaveParser.Structures; | ||
|
||
namespace SatisfactorySaveParser.PropertyTypes.Structs | ||
{ | ||
public class FINNetworkTrace : IStructData | ||
{ | ||
public bool IsValid { get; set; } | ||
public ObjectReference Reference { get; set; } | ||
public bool HasPrev { get; set; } | ||
public FINNetworkTrace Prev { get; set; } | ||
public bool HasStep { get; set; } | ||
public string Step { get; set; } | ||
|
||
public int SerializedLength => throw new NotImplementedException(); | ||
public string Type => "FINNetworkTrace"; | ||
|
||
public FINNetworkTrace(BinaryReader reader) | ||
{ | ||
IsValid = reader.ReadInt32() != 0; | ||
|
||
if(IsValid) | ||
{ | ||
Reference = new ObjectReference(reader); | ||
|
||
HasPrev = reader.ReadInt32() != 0; | ||
if (HasPrev) | ||
Prev = new FINNetworkTrace(reader); | ||
|
||
HasStep = reader.ReadInt32() != 0; | ||
if (HasStep) | ||
Step = reader.ReadLengthPrefixedString(); | ||
} | ||
} | ||
|
||
public void Serialize(BinaryWriter writer) | ||
{ | ||
writer.Write(IsValid ? 1 : 0); | ||
|
||
if (IsValid) | ||
{ | ||
writer.WriteLengthPrefixedString(Reference.LevelName); | ||
writer.WriteLengthPrefixedString(Reference.PathName); | ||
|
||
writer.Write(HasPrev ? 1 : 0); | ||
if (HasPrev) | ||
Prev.Serialize(writer); | ||
|
||
writer.Write(HasStep ? 1 : 0); | ||
if (HasStep) | ||
writer.WriteLengthPrefixedString(Step); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.IO; | ||
|
||
using SatisfactorySaveParser.Structures; | ||
|
||
namespace SatisfactorySaveParser.PropertyTypes.Structs | ||
{ | ||
public class Vector2D : IStructData | ||
{ | ||
public int SerializedLength => 8; | ||
public string Type => "Vector2D"; | ||
public Vector2 Data { get; set; } | ||
|
||
public Vector2D(BinaryReader reader) | ||
{ | ||
Data = reader.ReadVector2(); | ||
} | ||
|
||
public void Serialize(BinaryWriter writer) | ||
{ | ||
writer.Write(Data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace SatisfactorySaveParser.Structures | ||
{ | ||
public class Vector2 | ||
{ | ||
public float X { get; set; } | ||
public float Y { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"X: {X} Y: {Y}"; | ||
} | ||
} | ||
} |