diff --git a/PangLib.DAT/DATFile.cs b/PangLib.DAT/DATFile.cs
index b727159..63a9567 100644
--- a/PangLib.DAT/DATFile.cs
+++ b/PangLib.DAT/DATFile.cs
@@ -3,144 +3,143 @@
using System.IO;
using System.Text;
-namespace PangLib.DAT
+namespace PangLib.DAT;
+
+///
+/// Main DAT file class
+///
+public class DATFile
{
+ public List Entries = new List();
+
+ private Encoding FileEncoding;
+
///
- /// Main DAT file class
+ /// Parses the data from the DAT file
///
- public class DATFile
+ /// Stream containing DAT file data
+ private void Parse(Stream data)
{
- public List Entries = new List();
-
- private Encoding FileEncoding;
-
- ///
- /// Parses the data from the DAT file
- ///
- /// Stream containing DAT file data
- private void Parse(Stream data)
+ using (BinaryReader reader = new BinaryReader(data, FileEncoding))
{
- using (BinaryReader reader = new BinaryReader(data, FileEncoding))
- {
- List stringChars = new List();
+ List stringChars = new List();
- while (reader.BaseStream.Position < reader.BaseStream.Length)
+ while (reader.BaseStream.Position < reader.BaseStream.Length)
+ {
+ if (reader.PeekChar() != 0x00)
+ {
+ stringChars.Add(reader.ReadChar());
+ }
+ else
{
- if (reader.PeekChar() != 0x00)
- {
- stringChars.Add(reader.ReadChar());
- }
- else
- {
- char[] chars = stringChars.ToArray();
- byte[] bytes = FileEncoding.GetBytes(chars);
-
- Entries.Add(FileEncoding.GetString(bytes));
-
- reader.BaseStream.Seek(1L, SeekOrigin.Current);
- stringChars = new List();
- }
+ char[] chars = stringChars.ToArray();
+ byte[] bytes = FileEncoding.GetBytes(chars);
+
+ Entries.Add(FileEncoding.GetString(bytes));
+
+ reader.BaseStream.Seek(1L, SeekOrigin.Current);
+ stringChars = new List();
}
}
}
+ }
- ///
- /// Tries to get the file encoding based on
- /// the naming scheme of the files
- ///
- /// Falls back on UTF-8 as default
- ///
- /// File name of the DAT file
- /// Encoding of the DAT file
- private Encoding GetEncodingFromFileName(string filePath)
+ ///
+ /// Tries to get the file encoding based on
+ /// the naming scheme of the files
+ ///
+ /// Falls back on UTF-8 as default
+ ///
+ /// File name of the DAT file
+ /// Encoding of the DAT file
+ private Encoding GetEncodingFromFileName(string filePath)
+ {
+ if (filePath == null)
{
- if (filePath == null)
- {
- throw new InvalidOperationException("No file path given to get encoding from, use SetEncoding() method!");
- }
-
- string fileName = Path.GetFileNameWithoutExtension(filePath).ToLower();
-
- Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ throw new InvalidOperationException("No file path given to get encoding from, use SetEncoding() method!");
+ }
- Encoding targetEncoding;
+ string fileName = Path.GetFileNameWithoutExtension(filePath).ToLower();
- switch (fileName)
- {
- case "korea":
- targetEncoding = Encoding.GetEncoding(51949);
- break;
- case "japan":
- targetEncoding = Encoding.GetEncoding(932);
- break;
- case "english":
- targetEncoding = Encoding.ASCII;
- break;
- case "thailand":
- targetEncoding = Encoding.GetEncoding(874);
- break;
- case "indonesia":
- targetEncoding = Encoding.GetEncoding(65001);
- break;
- case "brasil":
- case "spanish":
- case "german":
- case "french":
- targetEncoding = Encoding.GetEncoding(1252);
- break;
- default:
- targetEncoding = Encoding.GetEncoding(65001);
- break;
- }
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- return targetEncoding;
- }
+ Encoding targetEncoding;
- ///
- /// Sets the encoding to be used by the DATFile instance
- ///
- /// Encoding to set
- public void SetEncoding(Encoding encoding)
+ switch (fileName)
{
- FileEncoding = encoding;
+ case "korea":
+ targetEncoding = Encoding.GetEncoding(51949);
+ break;
+ case "japan":
+ targetEncoding = Encoding.GetEncoding(932);
+ break;
+ case "english":
+ targetEncoding = Encoding.ASCII;
+ break;
+ case "thailand":
+ targetEncoding = Encoding.GetEncoding(874);
+ break;
+ case "indonesia":
+ targetEncoding = Encoding.GetEncoding(65001);
+ break;
+ case "brasil":
+ case "spanish":
+ case "german":
+ case "french":
+ targetEncoding = Encoding.GetEncoding(1252);
+ break;
+ default:
+ targetEncoding = Encoding.GetEncoding(65001);
+ break;
}
+
+ return targetEncoding;
+ }
+
+ ///
+ /// Sets the encoding to be used by the DATFile instance
+ ///
+ /// Encoding to set
+ public void SetEncoding(Encoding encoding)
+ {
+ FileEncoding = encoding;
+ }
- ///
- /// Returns the encoding used by the DATFile instance
- ///
- public Encoding GetEncoding()
- {
- return FileEncoding;
- }
+ ///
+ /// Returns the encoding used by the DATFile instance
+ ///
+ public Encoding GetEncoding()
+ {
+ return FileEncoding;
+ }
- ///
- /// Load a DAT file into a DATFile instance
- ///
- /// File path to load the DAT file from
- public static DATFile Load(string filePath)
- {
- DATFile DAT = new DATFile();
+ ///
+ /// Load a DAT file into a DATFile instance
+ ///
+ /// File path to load the DAT file from
+ public static DATFile Load(string filePath)
+ {
+ DATFile DAT = new DATFile();
- DAT.SetEncoding(DAT.GetEncodingFromFileName(filePath));
- DAT.Parse(File.Open(filePath, FileMode.Open));
+ DAT.SetEncoding(DAT.GetEncodingFromFileName(filePath));
+ DAT.Parse(File.Open(filePath, FileMode.Open));
- return DAT;
- }
+ return DAT;
+ }
- ///
- /// Save a DATFile instance to a file
- ///
- /// File path to save the DAT file to
- public void Save(string filePath)
+ ///
+ /// Save a DATFile instance to a file
+ ///
+ /// File path to save the DAT file to
+ public void Save(string filePath)
+ {
+ using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.Create, FileAccess.Write), FileEncoding))
{
- using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.Create, FileAccess.Write), FileEncoding))
+ foreach (string entry in Entries)
{
- foreach (string entry in Entries)
- {
- writer.Write(entry.ToCharArray());
- writer.Write((byte)0);
- }
+ writer.Write(entry.ToCharArray());
+ writer.Write((byte)0);
}
}
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.DAT/PangLib.DAT.csproj b/PangLib.DAT/PangLib.DAT.csproj
index c87fb4f..0a97114 100644
--- a/PangLib.DAT/PangLib.DAT.csproj
+++ b/PangLib.DAT/PangLib.DAT.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.IFF/IFFFile.cs b/PangLib.IFF/IFFFile.cs
deleted file mode 100644
index cc2ade8..0000000
--- a/PangLib.IFF/IFFFile.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF
-{
- ///
- /// Main IFF file class
- ///
- public class IFFFile where T : new()
- {
- ///
- /// List of IFF file entries
- ///
- public List Entries { get; } = new List();
-
- ///
- /// ID determining relation to other IFF files
- ///
- public ushort BindingID { get; set; }
-
- ///
- /// Version of this IFF file
- ///
- public uint Version { get; set; }
-
- ///
- /// Constructs a new IFFFile instance
- ///
- public IFFFile() { }
-
- ///
- /// Initializes a new IFFFile instance from a stream of IFF file data
- ///
- /// Stream containing IFF file data
- public IFFFile(Stream data)
- {
- Parse(data);
- }
-
- ///
- /// Parses the data from the IFF file and saves it into the Entries property
- ///
- /// The bytes of a single entry are then marshalled into the structure provided by the
- /// generic type of the IFFFile instance
- ///
- /// Stream containing IFF file data
- /// Is thrown when the size of a single record mismatches the size of the given generic structure
- private void Parse(Stream stream)
- {
- using (BinaryReader reader = new BinaryReader(stream))
- {
- if (new string(reader.ReadChars(2)) == "PK")
- {
- throw new NotSupportedException("The given IFF file is a ZIP file, please unpack it before attempting to parse it");
- }
-
- reader.BaseStream.Seek(0, SeekOrigin.Begin);
-
- ushort recordCount = reader.ReadUInt16();
- long recordLength = ((reader.BaseStream.Length - 8L) / (recordCount));
- BindingID = reader.ReadUInt16();
- Version = reader.ReadUInt32();
-
- for (int i = 0; i < recordCount; i++)
- {
- reader.BaseStream.Seek(8L + (recordLength * i), System.IO.SeekOrigin.Begin);
-
- byte[] recordData = reader.ReadBytes((int) recordLength);
-
- T data = new T();
-
- int size = Marshal.SizeOf(data);
- IntPtr ptr = Marshal.AllocHGlobal(size);
-
- if (recordData.Length != size)
- {
- throw new InvalidCastException(
- $"The record length ({recordData.Length}) mismatches the length of the passed structure ({size})");
- }
-
- Marshal.Copy(recordData, 0, ptr, size);
-
- data = (T) Marshal.PtrToStructure(ptr, data.GetType());
- Marshal.FreeHGlobal(ptr);
-
- Entries.Add(data);
- }
- }
- }
-
- ///
- /// Save a IFFFile instance to a file
- ///
- /// File path to save the IFF file to
- public void Save(string filePath)
- {
- using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.Create, FileAccess.Write)))
- {
- writer.Write((ushort) Entries.Count);
- writer.Write(BindingID);
- writer.Write(Version);
-
- Entries.ForEach(entry =>
- {
- int size = Marshal.SizeOf(entry);
- byte[] arr = new byte[size];
-
- IntPtr ptr = Marshal.AllocHGlobal(size);
- Marshal.StructureToPtr(entry, ptr, true);
- Marshal.Copy(ptr, arr, 0, size);
- Marshal.FreeHGlobal(ptr);
-
- writer.Write(arr);
- });
- }
- }
- }
-}
diff --git a/PangLib.IFF/IffFile.cs b/PangLib.IFF/IffFile.cs
new file mode 100644
index 0000000..00c3683
--- /dev/null
+++ b/PangLib.IFF/IffFile.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF;
+
+///
+/// Main IFF file class
+///
+public class IffFile where T : new()
+{
+ ///
+ /// List of IFF file entries
+ ///
+ public List Entries { get; } = [];
+
+ ///
+ /// ID determining relation to other IFF files
+ ///
+ public ushort BindingId { get; set; }
+
+ ///
+ /// Version of this IFF file
+ ///
+ public uint Version { get; set; }
+
+ ///
+ /// Constructs a new IFFFile instance
+ ///
+ public IffFile() { }
+
+ ///
+ /// Initializes a new IFFFile instance from a stream of IFF file data
+ ///
+ /// Stream containing IFF file data
+ public IffFile(Stream data)
+ {
+ Parse(data);
+ }
+
+ ///
+ /// Parses the data from the IFF file and saves it into the Entries property
+ ///
+ /// The bytes of a single entry are then marshalled into the structure provided by the
+ /// generic type of the IffFile instance
+ ///
+ /// Stream containing IFF file data
+ /// Is thrown when the size of a single record mismatches the size of the given generic structure
+ private void Parse(Stream stream)
+ {
+ using BinaryReader reader = new(stream);
+
+ if (new string(reader.ReadChars(2)) == "PK")
+ {
+ throw new NotSupportedException("The given IFF file is a ZIP file, please unpack it before attempting to parse it");
+ }
+
+ reader.BaseStream.Seek(0, SeekOrigin.Begin);
+
+ ushort recordCount = reader.ReadUInt16();
+ long recordLength = (reader.BaseStream.Length - 8L) / recordCount;
+ BindingId = reader.ReadUInt16();
+ Version = reader.ReadUInt32();
+
+ Type type = typeof(T);
+
+ int size = Marshal.SizeOf(new T());
+ if (recordLength != size)
+ {
+ throw new ArgumentOutOfRangeException(nameof(size),
+ "The requested model doesn't meet the size expectations of the given Iff File." +
+ $"RequestedModel: '{type.FullName}' ModelSize: '{size}' ExpectedSize: {recordLength}");
+ }
+
+ for (int i = 0; i < recordCount; i++)
+ {
+ byte[] recordData = reader.ReadBytes((int) recordLength);
+
+ IntPtr ptr = Marshal.AllocHGlobal(size);
+
+ Marshal.Copy(recordData, 0, ptr, size);
+
+ T data = (T) Marshal.PtrToStructure(ptr, type);
+ Marshal.FreeHGlobal(ptr);
+
+ Entries.Add(data);
+ }
+ }
+
+ ///
+ /// Save a IffFile instance to a file
+ ///
+ /// File path to save the IFF file to
+ public void Save(string filePath)
+ {
+ using BinaryWriter writer = new(File.Open(filePath, FileMode.Create, FileAccess.Write));
+
+ writer.Write((ushort) Entries.Count);
+ writer.Write(BindingId);
+ writer.Write(Version);
+
+ Entries.ForEach(entry =>
+ {
+ int size = Marshal.SizeOf(entry);
+ byte[] arr = new byte[size];
+
+ IntPtr ptr = Marshal.AllocHGlobal(size);
+ Marshal.StructureToPtr(entry, ptr, true);
+ Marshal.Copy(ptr, arr, 0, size);
+ Marshal.FreeHGlobal(ptr);
+
+ writer.Write(arr);
+ });
+ }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/Data/AuxPart.cs b/PangLib.IFF/Models/Data/AuxPart.cs
deleted file mode 100644
index aad2365..0000000
--- a/PangLib.IFF/Models/Data/AuxPart.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct AuxPart
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- public byte Amount { get; set; }
- public byte Unknown1 { get; set; }
- public byte Unknown2 { get; set; }
- public byte Unknown3 { get; set; }
- public byte Unknown4 { get; set; }
- public byte Unknown5 { get; set; }
- public byte Unknown6 { get; set; }
- public byte Unknown7 { get; set; }
- public byte Unknown8 { get; set; }
- public byte Unknown9 { get; set; }
- public byte Power { get; set; }
- public byte Control { get; set; }
- public byte Accuracy { get; set; }
- public byte Spin { get; set; }
- public byte Curve { get; set; }
- public byte PowerSlot { get; set; }
- public byte ControlSlot { get; set; }
- public byte AccuracySlot { get; set; }
- public byte SpinSlot { get; set; }
- public byte CurveSlot { get; set; }
- public ushort ClubDistance { get; set; }
- public ushort Luck { get; set; }
- public ushort PowerGauge { get; set; }
- public ushort PangBonus { get; set; }
- public ushort ExperiencePercentage { get; set; }
- public byte Unknown24 { get; set; }
- public byte Unknown25 { get; set; }
- public byte Unknown26 { get; set; }
- public byte Unknown27 { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Ball.cs b/PangLib.IFF/Models/Data/Ball.cs
deleted file mode 100644
index 55f52e2..0000000
--- a/PangLib.IFF/Models/Data/Ball.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Ball
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)]
- public string Unknown1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture { get; set; }
- public uint Unknown2 { get; set; }
- public uint Unknown3 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence0 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence2 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence3 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence4 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence5 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string BallSequence6 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string EffectName { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 240)]
- public string Unknown4 { get; set; }
- public uint PangBonus { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Caddie.cs b/PangLib.IFF/Models/Data/Caddie.cs
deleted file mode 100644
index 1764d84..0000000
--- a/PangLib.IFF/Models/Data/Caddie.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Caddie
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- public uint Salary { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Model { get; set; }
- public ushort Power { get; set; }
- public ushort Control { get; set; }
- public ushort Accuracy { get; set; }
- public ushort Spin { get; set; }
- public ushort Curve { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Card.cs b/PangLib.IFF/Models/Data/Card.cs
deleted file mode 100644
index 0c0257a..0000000
--- a/PangLib.IFF/Models/Data/Card.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.Flags;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Card
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- public byte Rarity { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture { get; set; }
- public ushort PowerSlot { get; set; }
- public ushort ControlSlot { get; set; }
- public ushort AccuracySlot { get; set; }
- public ushort SpinSlot { get; set; }
- public ushort CurveSlot { get; set; }
- public CardEffectFlag Effect { get; set; }
- public ushort EffectValue { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string AdditionalTexture1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string AdditionalTexture2 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string AdditionalTexture3 { get; set; }
- public ushort EffectTime { get; set; }
- public ushort Volume { get; set; }
- public ushort CardID { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Character.cs b/PangLib.IFF/Models/Data/Character.cs
deleted file mode 100644
index c507631..0000000
--- a/PangLib.IFF/Models/Data/Character.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Character
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Model { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture2 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture3 { get; set; }
- public ushort Power { get; set; }
- public ushort Control { get; set; }
- public ushort Accuracy { get; set; }
- public ushort Spin { get; set; }
- public ushort Curve { get; set; }
- public byte PowerSlot { get; set; }
- public byte ControlSlot { get; set; }
- public byte AccuracySlot { get; set; }
- public byte SpinSlot { get; set; }
- public byte CurveSlot { get; set; }
- public byte Unknown1 { get; set; }
- public uint RankS { get; set; }
- public byte RankSPowerSlot { get; set; }
- public byte RankSControlSlot { get; set; }
- public byte RankSAccuracySlot { get; set; }
- public byte RankSSpinSlot { get; set; }
- public byte RankSCurveSlot { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string AdditionalTexture { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)]
- public string Unknown2 { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Club.cs b/PangLib.IFF/Models/Data/Club.cs
deleted file mode 100644
index 0d7c58b..0000000
--- a/PangLib.IFF/Models/Data/Club.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Club
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Model { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/ClubSet.cs b/PangLib.IFF/Models/Data/ClubSet.cs
deleted file mode 100644
index c4374e9..0000000
--- a/PangLib.IFF/Models/Data/ClubSet.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct ClubSet
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- public uint WoodID { get; set; }
- public uint IronID { get; set; }
- public uint WedgeID { get; set; }
- public uint PutterID { get; set; }
- public ushort Power { get; set; }
- public ushort Control { get; set; }
- public ushort Accuracy { get; set; }
- public ushort Spin { get; set; }
- public ushort Curve { get; set; }
- public ushort PowerSlot { get; set; }
- public ushort ControlSlot { get; set; }
- public ushort AccuracySlot { get; set; }
- public ushort SpinSlot { get; set; }
- public ushort CurveSlot { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Course.cs b/PangLib.IFF/Models/Data/Course.cs
deleted file mode 100644
index f8ae04e..0000000
--- a/PangLib.IFF/Models/Data/Course.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Course
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string ShortName { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string LocalizedName { get; set; }
- public byte CourseFlag { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string PropertyFileName { get; set; }
- public uint Unknown1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string CourseSequence { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Desc.cs b/PangLib.IFF/Models/Data/Desc.cs
deleted file mode 100644
index 2c603f6..0000000
--- a/PangLib.IFF/Models/Data/Desc.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Desc
- {
- public uint ID { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
- public string Text { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Enchant.cs b/PangLib.IFF/Models/Data/Enchant.cs
deleted file mode 100644
index b678140..0000000
--- a/PangLib.IFF/Models/Data/Enchant.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Enchant
- {
- public uint Active { get; set; }
- public uint ID { get; set; }
- public uint Price { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/HairStyle.cs b/PangLib.IFF/Models/Data/HairStyle.cs
deleted file mode 100644
index b12d0e0..0000000
--- a/PangLib.IFF/Models/Data/HairStyle.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct HairStyle
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- public uint Unknown1 { get; set; }
- public uint HairStyleID { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Mascot.cs b/PangLib.IFF/Models/Data/Mascot.cs
deleted file mode 100644
index 436d7ef..0000000
--- a/PangLib.IFF/Models/Data/Mascot.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.General;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Mascot
- {
- [field: MarshalAs(UnmanagedType.Struct)]
- public IFFCommon Header { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Texture2 { get; set; }
- public ushort Price1Day { get; set; }
- public ushort Price7Day { get; set; }
- public ushort Unknown1 { get; set; }
- public ushort Price30Day { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Match.cs b/PangLib.IFF/Models/Data/Match.cs
deleted file mode 100644
index c9528ef..0000000
--- a/PangLib.IFF/Models/Data/Match.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Match
- {
- public uint Active { get; set; }
- public uint ID { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
- public string Name { get; set; }
- public byte Level { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string TrophyTexture1 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string TrophyTexture2 { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string TrophyTexture3 { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Data/Title.cs b/PangLib.IFF/Models/Data/Title.cs
deleted file mode 100644
index 60d4095..0000000
--- a/PangLib.IFF/Models/Data/Title.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF.Models.Data
-{
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct Title
- {
- public uint Active { get; set; }
- public uint ID { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Name { get; set; }
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Icon { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/Flags/CardEffectFlag.cs b/PangLib.IFF/Models/Flags/CardEffectFlag.cs
deleted file mode 100644
index 1940752..0000000
--- a/PangLib.IFF/Models/Flags/CardEffectFlag.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-namespace PangLib.IFF.Models.Flags
-{
- ///
- /// This flag is handling different card effects
- ///
- public enum CardEffectFlag : ushort
- {
- ///
- /// No card effect
- ///
- None = 0,
-
- ///
- /// This card grants an experience bonus
- ///
- Experience = 1,
-
- ///
- /// This card grants a percentual pang increase
- ///
- PercentPang = 2,
-
- ///
- /// This card grants a percentual experience increase
- ///
- PercentExperience = 3,
-
- ///
- /// This card adds a fixed pang bonus
- ///
- Pang = 4,
-
- ///
- /// This card increases the Power statistic
- ///
- Power = 5,
-
- ///
- /// This card increases the Control statistic
- ///
- Control = 6,
-
- ///
- /// This card increases the Accuracy statistic
- ///
- Accuracy = 7,
-
- ///
- /// This card increases the Spin statistic
- ///
- Spin = 8,
-
- ///
- /// This card increases the Curve statistic
- ///
- Curve = 9,
-
- ///
- /// This card increases the Power shot gauge at the beginning of a match
- ///
- StartingGauge = 10,
-
- ///
- /// TODO: Figure out what this effect does again
- ///
- Inventory = 11
- }
-}
diff --git a/PangLib.IFF/Models/Flags/MoneyFlag.cs b/PangLib.IFF/Models/Flags/MoneyFlag.cs
deleted file mode 100644
index b8581fd..0000000
--- a/PangLib.IFF/Models/Flags/MoneyFlag.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-namespace PangLib.IFF.Models.Flags
-{
- ///
- /// This flag is handling shop display related values
- ///
- public enum MoneyFlag : byte
- {
- ///
- /// Unknown value
- ///
- Unknown1 = 128,
-
- ///
- /// Displays a "Special" banner on a shop item
- ///
- BannerSpecial = 64,
-
- ///
- /// Displays a "Hot" banner on a shop item
- ///
- BannerHot = 32,
-
- ///
- /// Displays a "New" banner on a shop item
- ///
- BannerNew = 16,
-
- ///
- /// Unknown value
- ///
- Unknown2 = 8,
-
- ///
- /// Item is for display only
- ///
- DisplayOnly = 4,
-
- ///
- /// TODO: Figure out what this value is again
- ///
- Type = 2,
-
- ///
- /// This shop item is active
- ///
- Active = 1,
-
- ///
- /// No special shop display condition
- ///
- None = 0
- }
-}
diff --git a/PangLib.IFF/Models/Flags/ShopFlag.cs b/PangLib.IFF/Models/Flags/ShopFlag.cs
deleted file mode 100644
index ada9324..0000000
--- a/PangLib.IFF/Models/Flags/ShopFlag.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-namespace PangLib.IFF.Models.Flags
-{
- ///
- /// This flag is handling buying conditions
- ///
- public enum ShopFlag : byte
- {
- ///
- /// Unknown value
- ///
- Unknown1 = 128,
-
- ///
- /// Unknown value
- ///
- Unknown2 = 64,
-
- ///
- /// Unknown value
- ///
- Unknown3 = 32,
-
- ///
- /// Unknown value
- ///
- Unknown4 = 16,
-
- ///
- /// Unknown value
- ///
- Unknown5 = 8,
-
- ///
- /// This shop item is a coupon
- ///
- Coupon = 4,
-
- ///
- /// This shop item is not giftable
- ///
- NonGiftable = 2,
-
- ///
- /// This shop item is giftable
- ///
- Giftable = 1,
-
- ///
- /// No special buying conditions
- ///
- None = 0
- }
-}
diff --git a/PangLib.IFF/Models/General/IFFCommon.cs b/PangLib.IFF/Models/General/IFFCommon.cs
deleted file mode 100644
index 91a347b..0000000
--- a/PangLib.IFF/Models/General/IFFCommon.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using System.Runtime.InteropServices;
-using PangLib.IFF.Models.Flags;
-
-namespace PangLib.IFF.Models.General
-{
- ///
- /// Common data structure found at the head of many IFF datasets
- ///
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct IFFCommon
- {
- ///
- /// Status of this object
- ///
- public uint Active { get; set; }
-
- ///
- /// ID of this object
- ///
- public uint ID { get; set; }
-
- ///
- /// Name of this object
- ///
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Name { get; set; }
-
- ///
- /// Level requirement for this object
- ///
- public byte Level { get; set; }
-
- ///
- /// Icon for this object
- ///
- [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
- public string Icon { get; set; }
-
- ///
- /// Price of this object
- ///
- public uint Price { get; set; }
-
- ///
- /// Discounted price of this object
- ///
- public uint DiscountPrice { get; set; }
-
- ///
- /// Used price of this object
- ///
- public uint UsedPrice { get; set; }
-
- ///
- /// Instance of
- ///
- public ShopFlag ShopFlag { get; set; }
-
- ///
- /// Instance of
- ///
- public MoneyFlag MoneyFlag { get; set; }
-
- ///
- /// A time flag
- ///
- public byte TimeFlag { get; set; }
-
- ///
- /// A time byte
- ///
- public byte TimeByte { get; set; }
-
- ///
- /// Point price of this object
- ///
- public uint Point { get; set; }
-
- ///
- /// Time this object becomes available
- ///
- [field: MarshalAs(UnmanagedType.Struct)]
- public SystemTime StartTime { get; set; }
-
- ///
- /// Time this object stops being available
- ///
- [field: MarshalAs(UnmanagedType.Struct)]
- public SystemTime EndTime { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/General/SystemTime.cs b/PangLib.IFF/Models/General/SystemTime.cs
deleted file mode 100644
index 4e6684b..0000000
--- a/PangLib.IFF/Models/General/SystemTime.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace PangLib.IFF.Models.General
-{
- ///
- /// System time structure based on Windows internal SYSTEMTIME struct
- ///
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public struct SystemTime
- {
- ///
- /// Year
- ///
- public ushort Year { get; set; }
-
- ///
- /// Month
- ///
- public ushort Month { get; set; }
-
- ///
- /// Day of Week
- ///
- public ushort DayOfWeek { get; set; }
-
- ///
- /// Day
- ///
- public ushort Day { get; set; }
-
- ///
- /// Hour
- ///
- public ushort Hour { get; set; }
-
- ///
- /// Minute
- ///
- public ushort Minute { get; set; }
-
- ///
- /// Second
- ///
- public ushort Second { get; set; }
-
- ///
- /// Millisecond
- ///
- public ushort MilliSecond { get; set; }
- }
-}
diff --git a/PangLib.IFF/Models/US/Season8/Data/AuxPart.cs b/PangLib.IFF/Models/US/Season8/Data/AuxPart.cs
new file mode 100644
index 0000000..96fe889
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/AuxPart.cs
@@ -0,0 +1,40 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct AuxPart
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ public byte Amount { get; set; }
+ public byte Unknown1 { get; set; }
+ public byte Unknown2 { get; set; }
+ public byte Unknown3 { get; set; }
+ public byte Unknown4 { get; set; }
+ public byte Unknown5 { get; set; }
+ public byte Unknown6 { get; set; }
+ public byte Unknown7 { get; set; }
+ public byte Unknown8 { get; set; }
+ public byte Unknown9 { get; set; }
+ public byte Power { get; set; }
+ public byte Control { get; set; }
+ public byte Accuracy { get; set; }
+ public byte Spin { get; set; }
+ public byte Curve { get; set; }
+ public byte PowerSlot { get; set; }
+ public byte ControlSlot { get; set; }
+ public byte AccuracySlot { get; set; }
+ public byte SpinSlot { get; set; }
+ public byte CurveSlot { get; set; }
+ public ushort ClubDistance { get; set; }
+ public ushort Luck { get; set; }
+ public ushort PowerGauge { get; set; }
+ public ushort PangBonus { get; set; }
+ public ushort ExperiencePercentage { get; set; }
+ public byte Unknown24 { get; set; }
+ public byte Unknown25 { get; set; }
+ public byte Unknown26 { get; set; }
+ public byte Unknown27 { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Ball.cs b/PangLib.IFF/Models/US/Season8/Data/Ball.cs
new file mode 100644
index 0000000..ce355e5
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Ball.cs
@@ -0,0 +1,53 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Ball
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+
+ public uint Unknown { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Model { get; set; }
+
+ public uint Unknown2 { get; set; }
+ public uint Unknown3 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence3 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence4 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence5 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence6 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallSequence7 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx3 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx4 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx5 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx6 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string BallFx7 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct Stats { get; set; }
+
+ public ushort Unknown4 { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Caddie.cs b/PangLib.IFF/Models/US/Season8/Data/Caddie.cs
new file mode 100644
index 0000000..4b90bb1
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Caddie.cs
@@ -0,0 +1,21 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Caddie
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+
+ public uint MonthRentalCost { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Model { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct Stats { get; set; }
+
+ public ushort Unknown { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Card.cs b/PangLib.IFF/Models/US/Season8/Data/Card.cs
new file mode 100644
index 0000000..131bdcc
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Card.cs
@@ -0,0 +1,31 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.Flag;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Card
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ public byte Rarity { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture { get; set; }
+ public ushort PowerSlot { get; set; }
+ public ushort ControlSlot { get; set; }
+ public ushort AccuracySlot { get; set; }
+ public ushort SpinSlot { get; set; }
+ public ushort CurveSlot { get; set; }
+ public CardEffectFlag Effect { get; set; }
+ public ushort EffectValue { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string AdditionalTexture1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string AdditionalTexture2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string AdditionalTexture3 { get; set; }
+ public ushort EffectTime { get; set; }
+ public ushort Volume { get; set; }
+ public ushort CardID { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Character.cs b/PangLib.IFF/Models/US/Season8/Data/Character.cs
new file mode 100644
index 0000000..ba536f5
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Character.cs
@@ -0,0 +1,39 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Character
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Model { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture3 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct Stats { get; set; }
+
+ public byte Unknown1 { get; set; }
+ public byte Unknown2 { get; set; }
+ public uint Unknown3 { get; set; }
+
+ public float ClubSetScale { get; set; }
+
+ public byte RankSPowerSlot { get; set; }
+ public byte RankSControlSlot { get; set; }
+ public byte RankSAccuracySlot { get; set; }
+ public byte RankSSpinSlot { get; set; }
+ public byte RankSCurveSlot { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string AdditionalTexture { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Club.cs b/PangLib.IFF/Models/US/Season8/Data/Club.cs
new file mode 100644
index 0000000..5b46293
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Club.cs
@@ -0,0 +1,13 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Club
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Model { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/ClubSet.cs b/PangLib.IFF/Models/US/Season8/Data/ClubSet.cs
new file mode 100644
index 0000000..3e712fa
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/ClubSet.cs
@@ -0,0 +1,50 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+using PangLib.IFF.Models.US.Season8.Type;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct ClubSet
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ public uint WoodID { get; set; }
+ public uint IronID { get; set; }
+ public uint WedgeID { get; set; }
+ public uint PutterID { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct Stats { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct SlotStats { get; set; }
+
+ public ClubSetWorkshopType WorkshopType { get; set; }
+
+ ///
+ /// TODO: Something for the Rank S Bonus stat
+ ///
+ public uint WorkshopRankSStat { get; set; }
+ public uint WorkshopRecoveryPointsLimit { get; set; }
+
+ ///
+ /// Rate that will get for hole played
+ ///
+ public float WorkshopPlayRate { get; set; }
+
+ ///
+ /// TODO: No idea, something related to Stats and XP
+ ///
+ public uint WorkshopRankSType { get; set; }
+
+ ///
+ /// TODO: No idea, something related to Transformation or Transafer
+ ///
+ public ushort WorkshopTransformFlag { get; set; }
+ public ushort UnknownFlag { get; set; }
+
+ public uint Unknown { get; set; }
+
+ public uint PangyaHitIconId { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Course.cs b/PangLib.IFF/Models/US/Season8/Data/Course.cs
new file mode 100644
index 0000000..c0fe799
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Course.cs
@@ -0,0 +1,37 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Course
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string MpetFile { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string GbinFile { get; set; }
+
+ public byte Difficulty { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string XmlFile { get; set; }
+
+ public float RatePang { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string SeqFile { get; set; }
+
+ /** TODO: investigate what this does */
+ [field: MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
+ public int[] Unknown3 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
+ public byte[] ParsByHole { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
+ public sbyte[] MinScoreByHole { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
+ public sbyte[] MaxScoreByHole { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Desc.cs b/PangLib.IFF/Models/US/Season8/Data/Desc.cs
new file mode 100644
index 0000000..51a771b
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Desc.cs
@@ -0,0 +1,11 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Desc
+{
+ public uint ID { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
+ public string Text { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Enchant.cs b/PangLib.IFF/Models/US/Season8/Data/Enchant.cs
new file mode 100644
index 0000000..fd48cc2
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Enchant.cs
@@ -0,0 +1,11 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Enchant
+{
+ public uint Active { get; set; }
+ public uint ID { get; set; }
+ public uint Price { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/HairStyle.cs b/PangLib.IFF/Models/US/Season8/Data/HairStyle.cs
new file mode 100644
index 0000000..bac8cb5
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/HairStyle.cs
@@ -0,0 +1,13 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct HairStyle
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ public uint Unknown1 { get; set; }
+ public uint HairStyleID { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Item.cs b/PangLib.IFF/Models/US/Season8/Data/Item.cs
new file mode 100644
index 0000000..da2c52b
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Item.cs
@@ -0,0 +1,32 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Item
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+
+ public uint ItemType { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture { get; set; }
+
+ ///
+ /// Array length 5.
+ /// It represents the {Power, Control, Accuracy, Spin, Curve} this item gives.
+ /// When the item is time-limited it says the price of the different days in the order of {1, 7, 15, 30, 365}
+ ///
+ public ushort PowerOrTimePrice1 { get; set; }
+ public ushort ControlOrTimePrice7 { get; set; }
+ public ushort AccuracyOrTimePrice15 { get; set; }
+ public ushort SpinOrTimePrice30 { get; set; }
+ public ushort CurveOrTimePrice365 { get; set; }
+
+ ///
+ /// Price when the item is not time-limited
+ ///
+ public ushort NoTimePrice { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Mascot.cs b/PangLib.IFF/Models/US/Season8/Data/Mascot.cs
new file mode 100644
index 0000000..9ae3a51
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Mascot.cs
@@ -0,0 +1,19 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Mascot
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon Header { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture2 { get; set; }
+ public ushort Price1Day { get; set; }
+ public ushort Price7Day { get; set; }
+ public ushort Unknown1 { get; set; }
+ public ushort Price30Day { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Match.cs b/PangLib.IFF/Models/US/Season8/Data/Match.cs
new file mode 100644
index 0000000..9fdccc2
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Match.cs
@@ -0,0 +1,19 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Match
+{
+ public uint Active { get; set; }
+ public uint ID { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
+ public string Name { get; set; }
+ public byte Level { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string TrophyTexture1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string TrophyTexture2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string TrophyTexture3 { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Part.cs b/PangLib.IFF/Models/US/Season8/Data/Part.cs
new file mode 100644
index 0000000..9a27195
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Part.cs
@@ -0,0 +1,62 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.General;
+using PangLib.IFF.Models.US.Season8.Type;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Part
+{
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public IffCommon CommonItem { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string MPet { get; set; }
+
+ public PartType PartType { get; set; }
+ ///
+ /// Slot in Equipment Array of CharacterDto
+ /// Flags of slot's index
+ ///
+ public uint PartSlotBitMap { get; set; }
+
+ public uint Unknown1 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture1 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture2 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture3 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture4 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture5 { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Texture6 { get; set; }
+
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct Stats { get; set; }
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public StatsStruct SlotStats { get; set; }
+
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Unknown2 { get; set; }
+
+ /** Second possible Id, probably related to items with 2 pieces (like gloves), it is useful for server-side cloth slot placement validation */
+ public int Id2 { get; set; }
+ public int Unknown4 { get; set; }
+
+ public ushort Unknown5 { get; set; }
+ ///
+ /// Third Caddie Card Slot
+ ///
+ public short CaddieCardSlotFlag { get; set; }
+
+ public uint Unknown6 { get; set; }
+ ///
+ /// TODO: investigate
+ ///
+ public int RentPrice { get; set; }
+ public uint Unknown7 { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Data/Title.cs b/PangLib.IFF/Models/US/Season8/Data/Title.cs
new file mode 100644
index 0000000..666a0e8
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Data/Title.cs
@@ -0,0 +1,14 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.Data;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct Title
+{
+ public uint Active { get; set; }
+ public uint ID { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Name { get; set; }
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Icon { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Extension/CourseExtensions.cs b/PangLib.IFF/Models/US/Season8/Extension/CourseExtensions.cs
new file mode 100644
index 0000000..79432fe
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Extension/CourseExtensions.cs
@@ -0,0 +1,12 @@
+using PangLib.IFF.Models.US.Season8.Data;
+
+namespace PangLib.IFF.Models.US.Season8.Extension;
+
+public static class CourseExtensions
+{
+ public static (byte difficultyNum, byte unknown) GetDifficulty(this Course course) =>
+ ((byte)(course.Difficulty & 0xF), (byte)(course.Difficulty >> 4));
+
+ public static byte FormDifficulty(this (byte difficultyNum, byte unknown) difficulty) =>
+ (byte)((difficulty.unknown << 4) | (difficulty.difficultyNum & 0xF));
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Flag/CardEffectFlag.cs b/PangLib.IFF/Models/US/Season8/Flag/CardEffectFlag.cs
new file mode 100644
index 0000000..db9418e
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Flag/CardEffectFlag.cs
@@ -0,0 +1,67 @@
+namespace PangLib.IFF.Models.US.Season8.Flag;
+
+///
+/// This flag is handling different card effects
+///
+public enum CardEffectFlag : ushort
+{
+ ///
+ /// No card effect
+ ///
+ None = 0,
+
+ ///
+ /// This card grants an experience bonus
+ ///
+ Experience = 1,
+
+ ///
+ /// This card grants a percentual pang increase
+ ///
+ PercentPang = 2,
+
+ ///
+ /// This card grants a percentual experience increase
+ ///
+ PercentExperience = 3,
+
+ ///
+ /// This card adds a fixed pang bonus
+ ///
+ Pang = 4,
+
+ ///
+ /// This card increases the Power statistic
+ ///
+ Power = 5,
+
+ ///
+ /// This card increases the Control statistic
+ ///
+ Control = 6,
+
+ ///
+ /// This card increases the Accuracy statistic
+ ///
+ Accuracy = 7,
+
+ ///
+ /// This card increases the Spin statistic
+ ///
+ Spin = 8,
+
+ ///
+ /// This card increases the Curve statistic
+ ///
+ Curve = 9,
+
+ ///
+ /// This card increases the Power shot gauge at the beginning of a match
+ ///
+ StartingGauge = 10,
+
+ ///
+ /// TODO: Figure out what this effect does again
+ ///
+ Inventory = 11
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Flag/ShopDisplayFlag.cs b/PangLib.IFF/Models/US/Season8/Flag/ShopDisplayFlag.cs
new file mode 100644
index 0000000..49b67bc
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Flag/ShopDisplayFlag.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace PangLib.IFF.Models.US.Season8.Flag;
+
+///
+/// This flag is handling shop display related values
+///
+[Flags]
+public enum ShopDisplayFlag : byte
+{
+ ///
+ /// No special shop display condition
+ ///
+ None = 0,
+
+ ///
+ /// This shop item is active
+ ///
+ Active = 1 << 0,
+
+ ///
+ /// TODO: Figure out what this value is again
+ ///
+ Type = 1 << 1,
+
+ ///
+ /// Item is for display only
+ ///
+ OnlyForDisplay = 1 << 2,
+ Unknown1 = 1 << 3,
+
+ ///
+ /// Displays a "New" banner on a shop item
+ ///
+ BannerNew = 1 << 4,
+
+ ///
+ /// Displays a "Hot" banner on a shop item
+ ///
+ BannerHot = 1 << 5,
+
+ ///
+ /// Displays a "Special" banner on a shop item
+ ///
+ BannerSpecial = 1 << 6,
+ Unknown2 = 1 << 7
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Flag/ShopFlag.cs b/PangLib.IFF/Models/US/Season8/Flag/ShopFlag.cs
new file mode 100644
index 0000000..77885af
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Flag/ShopFlag.cs
@@ -0,0 +1,36 @@
+using System;
+
+namespace PangLib.IFF.Models.US.Season8.Flag;
+
+///
+/// This flag is handling buying conditions
+///
+[Flags]
+public enum ShopFlag : byte
+{
+ ///
+ /// No special buying conditions
+ ///
+ None = 0,
+
+ ///
+ /// This shop item can be gifted
+ ///
+ CanBeGifted = 1 << 0,
+
+ ///
+ /// This shop item cannot be gifted
+ ///
+ CannotBeGifted = 1 << 1,
+
+ ///
+ /// This shop item is a coupon
+ ///
+ Coupon = 1 << 2,
+
+ Unknown1 = 1 << 3,
+ Unknown2 = 1 << 4,
+ Unknown3 = 1 << 5,
+ Unknown4 = 1 << 6,
+ Unknown5 = 1 << 7
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Flag/ShopTimeFlag.cs b/PangLib.IFF/Models/US/Season8/Flag/ShopTimeFlag.cs
new file mode 100644
index 0000000..bf16cc2
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Flag/ShopTimeFlag.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace PangLib.IFF.Models.US.Season8.Flag;
+
+[Flags]
+public enum ShopTimeFlag : byte
+{
+ None = 0,
+ Active = 1 << 0
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/General/IffCommon.cs b/PangLib.IFF/Models/US/Season8/General/IffCommon.cs
new file mode 100644
index 0000000..5c69fd1
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/General/IffCommon.cs
@@ -0,0 +1,108 @@
+using System.Runtime.InteropServices;
+using PangLib.IFF.Models.US.Season8.Flag;
+using PangLib.IFF.Models.US.Season8.Type;
+
+namespace PangLib.IFF.Models.US.Season8.General;
+
+///
+/// Common data structure found at the head of many IFF datasets
+///
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct IffCommon
+{
+ ///
+ /// Status of this object
+ ///
+ public uint Active { get; set; }
+
+ ///
+ /// ID of this object
+ ///
+ public uint ID { get; set; }
+
+ ///
+ /// Name of this object
+ ///
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Name { get; set; }
+
+ ///
+ /// Level requirement for this object
+ ///
+ public byte Level { get; set; }
+
+ ///
+ /// Icon for this object
+ ///
+ [field: MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
+ public string Icon { get; set; }
+
+ ///
+ /// Price of this object
+ ///
+ public uint Price { get; set; }
+
+ ///
+ /// Discounted price of this object
+ ///
+ public uint DiscountPrice { get; set; }
+
+ ///
+ /// Used price of this object
+ ///
+ public uint UsedPrice { get; set; }
+
+ ///
+ /// Instance of
+ ///
+ public ShopFlag ShopFlag { get; set; }
+
+ ///
+ /// Instance of
+ ///
+ public ShopDisplayFlag MoneyFlag { get; set; }
+
+ ///
+ /// A time flag
+ ///
+ public ShopTimeFlag TimeFlag { get; set; }
+
+ public ShopTempItemDurationType TempItemDuration { get; set; }
+
+ ///
+ /// The amount of items that gives the Tiki Shop for this "Tiki Buy"
+ ///
+ public uint TikiItemAmount { get; set; }
+
+ ///
+ /// Total Tiki Points to buy this "Tiki Buy"
+ ///
+ public uint TikiPointsPrice { get; set; }
+ public ushort MileagePoints { get; set; }
+ public ushort BonusProbability { get; set; }
+ public ushort MinBonus { get; set; }
+ public ushort MaxBonus { get; set; }
+
+ ///
+ /// TODO: Investigate
+ ///
+ public uint TikiShopType { get; set; }
+ public uint TikiPang { get; set; }
+
+ ///
+ /// The object has time-limited availability
+ ///
+ public TimeLimitedType IsTimeLimited { get; set; }
+
+ ///
+ /// Time this object becomes available
+ ///
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public SystemTime StartTime { get; set; }
+
+ ///
+ /// Time this object stops being available
+ ///
+ [field: MarshalAs(UnmanagedType.Struct)]
+ public SystemTime EndTime { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/General/StatsStruct.cs b/PangLib.IFF/Models/US/Season8/General/StatsStruct.cs
new file mode 100644
index 0000000..e95bfa4
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/General/StatsStruct.cs
@@ -0,0 +1,13 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.General;
+
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct StatsStruct
+{
+ public ushort Power { get; set; }
+ public ushort Control { get; set; }
+ public ushort Accuracy { get; set; }
+ public ushort Spin { get; set; }
+ public ushort Curve { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/General/SystemTime.cs b/PangLib.IFF/Models/US/Season8/General/SystemTime.cs
new file mode 100644
index 0000000..4792790
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/General/SystemTime.cs
@@ -0,0 +1,50 @@
+using System.Runtime.InteropServices;
+
+namespace PangLib.IFF.Models.US.Season8.General;
+
+///
+/// System time structure based on Windows internal SYSTEMTIME struct
+///
+[StructLayout(LayoutKind.Sequential, Pack = 4)]
+public struct SystemTime
+{
+ ///
+ /// Year
+ ///
+ public ushort Year { get; set; }
+
+ ///
+ /// Month
+ ///
+ public ushort Month { get; set; }
+
+ ///
+ /// Day of Week
+ ///
+ public ushort DayOfWeek { get; set; }
+
+ ///
+ /// Day
+ ///
+ public ushort Day { get; set; }
+
+ ///
+ /// Hour
+ ///
+ public ushort Hour { get; set; }
+
+ ///
+ /// Minute
+ ///
+ public ushort Minute { get; set; }
+
+ ///
+ /// Second
+ ///
+ public ushort Second { get; set; }
+
+ ///
+ /// Millisecond
+ ///
+ public ushort MilliSecond { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Type/ClubSetWorkshopType.cs b/PangLib.IFF/Models/US/Season8/Type/ClubSetWorkshopType.cs
new file mode 100644
index 0000000..5f13430
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Type/ClubSetWorkshopType.cs
@@ -0,0 +1,7 @@
+namespace PangLib.IFF.Models.US.Season8.Type;
+
+public enum ClubSetWorkshopType : int
+{
+ NotUpgradable = -1,
+ Upgradable = 0
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Type/PartType.cs b/PangLib.IFF/Models/US/Season8/Type/PartType.cs
new file mode 100644
index 0000000..bd06d36
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Type/PartType.cs
@@ -0,0 +1,14 @@
+namespace PangLib.IFF.Models.US.Season8.Type;
+
+public enum PartType : uint
+{
+ Top = 0,
+ Bottom = 1,
+ Hat = 2,
+ Gloves = 3,
+ Shoes = 4,
+ AccessoryOrBase = 5,
+ SubLeg = 6,
+ UccBlank = 8,
+ UccCopy = 9
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Type/ShopTempItemDurationType.cs b/PangLib.IFF/Models/US/Season8/Type/ShopTempItemDurationType.cs
new file mode 100644
index 0000000..2e0861f
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Type/ShopTempItemDurationType.cs
@@ -0,0 +1,11 @@
+namespace PangLib.IFF.Models.US.Season8.Type;
+
+public enum ShopTempItemDurationType : byte
+{
+ None = 0,
+ Day = 1,
+ Week = 7,
+ TwoWeeks = 15,
+ Month = 30,
+ Year = 0x6D
+}
\ No newline at end of file
diff --git a/PangLib.IFF/Models/US/Season8/Type/TimeLimitedType.cs b/PangLib.IFF/Models/US/Season8/Type/TimeLimitedType.cs
new file mode 100644
index 0000000..9a7cb5d
--- /dev/null
+++ b/PangLib.IFF/Models/US/Season8/Type/TimeLimitedType.cs
@@ -0,0 +1,7 @@
+namespace PangLib.IFF.Models.US.Season8.Type;
+
+public enum TimeLimitedType : uint
+{
+ NotTimeLimited = 0,
+ TimeLimited = 1
+}
\ No newline at end of file
diff --git a/PangLib.IFF/PangLib.IFF.csproj b/PangLib.IFF/PangLib.IFF.csproj
index c069ba9..ffda358 100644
--- a/PangLib.IFF/PangLib.IFF.csproj
+++ b/PangLib.IFF/PangLib.IFF.csproj
@@ -14,11 +14,7 @@
netstandard2.0
- 7.3
+ 12
-
-
-
-
diff --git a/PangLib.PAK/PAKFile.cs b/PangLib.PAK/PAKFile.cs
index ff2adc7..54d5cd0 100644
--- a/PangLib.PAK/PAKFile.cs
+++ b/PangLib.PAK/PAKFile.cs
@@ -8,206 +8,205 @@
using PangLib.Utilities.Cryptography;
using PangLib.Utilities.Compression;
-namespace PangLib.PAK
+namespace PangLib.PAK;
+
+///
+/// Main PAK file class
+///
+public class PAKFile
{
///
- /// Main PAK file class
+ /// File entries included in this archive
+ ///
+ public List Entries { get; } = new List();
+
+ ///
+ /// File path of the PAK archive
+ ///
+ private readonly string FilePath;
+
+ ///
+ /// Key used for en/decrypting parts of file entries
+ ///
+ private readonly dynamic Key;
+
+ ///
+ /// Constructor for the PAK file instance
///
- public class PAKFile
+ /// Path of the PAK file
+ /// Decryption key for encrypted fields
+ public PAKFile(string filePath, dynamic key)
{
- ///
- /// File entries included in this archive
- ///
- public List Entries { get; } = new List();
-
- ///
- /// File path of the PAK archive
- ///
- private readonly string FilePath;
-
- ///
- /// Key used for en/decrypting parts of file entries
- ///
- private readonly dynamic Key;
-
- ///
- /// Constructor for the PAK file instance
- ///
- /// Path of the PAK file
- /// Decryption key for encrypted fields
- public PAKFile(string filePath, dynamic key)
- {
- FilePath = filePath;
- Key = key;
+ FilePath = filePath;
+ Key = key;
- ReadMetadata();
- }
+ ReadMetadata();
+ }
- ///
- /// Reads the PAK file metadata, including file list information and the file list
- ///
- /// Is thrown if the given PAK file does not have a valid signature
- private void ReadMetadata()
+ ///
+ /// Reads the PAK file metadata, including file list information and the file list
+ ///
+ /// Is thrown if the given PAK file does not have a valid signature
+ private void ReadMetadata()
+ {
+ using (BinaryReader reader = new BinaryReader(new MemoryStream(File.ReadAllBytes(FilePath))))
{
- using (BinaryReader reader = new BinaryReader(new MemoryStream(File.ReadAllBytes(FilePath))))
- {
- reader.BaseStream.Seek(-9L, SeekOrigin.End);
-
- uint fileListOffset = reader.ReadUInt32();
- uint fileCount = reader.ReadUInt32();
+ reader.BaseStream.Seek(-9L, SeekOrigin.End);
- if ((reader.ReadByte()) != 0x12)
- {
- throw new NotSupportedException("The signature of this PAK file is invalid!");
- }
+ uint fileListOffset = reader.ReadUInt32();
+ uint fileCount = reader.ReadUInt32();
- reader.BaseStream.Seek(fileListOffset, SeekOrigin.Begin);
+ if ((reader.ReadByte()) != 0x12)
+ {
+ throw new NotSupportedException("The signature of this PAK file is invalid!");
+ }
- for (uint i = 0; i < fileCount; i++)
- {
- FileEntry fileEntry = new FileEntry();
+ reader.BaseStream.Seek(fileListOffset, SeekOrigin.Begin);
- fileEntry.FileNameLength = reader.ReadByte();
- fileEntry.Compression = reader.ReadByte();
- fileEntry.Offset = reader.ReadUInt32();
- fileEntry.FileSize = reader.ReadUInt32();
- fileEntry.RealFileSize = reader.ReadUInt32();
+ for (uint i = 0; i < fileCount; i++)
+ {
+ FileEntry fileEntry = new FileEntry();
- byte[] tempName = reader.ReadBytes(fileEntry.FileNameLength);
+ fileEntry.FileNameLength = reader.ReadByte();
+ fileEntry.Compression = reader.ReadByte();
+ fileEntry.Offset = reader.ReadUInt32();
+ fileEntry.FileSize = reader.ReadUInt32();
+ fileEntry.RealFileSize = reader.ReadUInt32();
- if (fileEntry.Compression < 4)
- {
- uint decryptionKey = (uint) Key;
+ byte[] tempName = reader.ReadBytes(fileEntry.FileNameLength);
- reader.BaseStream.Seek(1L, SeekOrigin.Current);
- fileEntry.FileName = Encoding.UTF8.GetString(XOR.Cipher(tempName, decryptionKey));
- }
- else
- {
- uint[] decryptionKey = (uint[]) Key;
+ if (fileEntry.Compression < 4)
+ {
+ uint decryptionKey = (uint) Key;
- fileEntry.Compression ^= 0x20;
+ reader.BaseStream.Seek(1L, SeekOrigin.Current);
+ fileEntry.FileName = Encoding.UTF8.GetString(XOR.Cipher(tempName, decryptionKey));
+ }
+ else
+ {
+ uint[] decryptionKey = (uint[]) Key;
- fileEntry.FileName = DecryptFileName(tempName, decryptionKey);
+ fileEntry.Compression ^= 0x20;
- uint[] decryptionData =
- {
- fileEntry.Offset,
- fileEntry.RealFileSize
- };
+ fileEntry.FileName = DecryptFileName(tempName, decryptionKey);
- uint[] resultData = XTEA.Decipher(16, decryptionData, decryptionKey);
+ uint[] decryptionData =
+ {
+ fileEntry.Offset,
+ fileEntry.RealFileSize
+ };
- fileEntry.Offset = resultData[0];
- fileEntry.RealFileSize = resultData[1];
- }
+ uint[] resultData = XTEA.Decipher(16, decryptionData, decryptionKey);
- Entries.Add(fileEntry);
+ fileEntry.Offset = resultData[0];
+ fileEntry.RealFileSize = resultData[1];
}
+
+ Entries.Add(fileEntry);
}
}
+ }
- ///
- /// Extracts the files from the file list
- ///
- /// Also performs decompression or creation of folders where necessary
- ///
- public void ExtractFiles()
+ ///
+ /// Extracts the files from the file list
+ ///
+ /// Also performs decompression or creation of folders where necessary
+ ///
+ public void ExtractFiles()
+ {
+ using (BinaryReader reader = new BinaryReader(new MemoryStream(File.ReadAllBytes(FilePath))))
{
- using (BinaryReader reader = new BinaryReader(new MemoryStream(File.ReadAllBytes(FilePath))))
+ byte[] data = null;
+
+ Entries.ForEach(fileEntry =>
{
- byte[] data = null;
+ reader.BaseStream.Seek(fileEntry.Offset, SeekOrigin.Begin);
+ data = reader.ReadBytes((int) fileEntry.FileSize);
- Entries.ForEach(fileEntry =>
+ switch (fileEntry.Compression)
{
- reader.BaseStream.Seek(fileEntry.Offset, SeekOrigin.Begin);
- data = reader.ReadBytes((int) fileEntry.FileSize);
+ case 1:
+ case 3:
+ data = LZ77.Decompress(data, fileEntry.FileSize, fileEntry.RealFileSize,
+ fileEntry.Compression);
+ break;
+ case 2:
+ Directory.CreateDirectory(fileEntry.FileName);
+ break;
+ default:
+ Debug.WriteLine($"Unknown compression value '{fileEntry.Compression.ToString()}'");
+ break;
+ }
- switch (fileEntry.Compression)
- {
- case 1:
- case 3:
- data = LZ77.Decompress(data, fileEntry.FileSize, fileEntry.RealFileSize,
- fileEntry.Compression);
- break;
- case 2:
- Directory.CreateDirectory(fileEntry.FileName);
- break;
- default:
- Debug.WriteLine($"Unknown compression value '{fileEntry.Compression.ToString()}'");
- break;
- }
-
- if (fileEntry.FileSize != 0)
- {
- File.WriteAllBytes(fileEntry.FileName, data);
- }
- });
- }
+ if (fileEntry.FileSize != 0)
+ {
+ File.WriteAllBytes(fileEntry.FileName, data);
+ }
+ });
}
+ }
- ///
- /// Decrypts the name of a file using XTEA
- ///
- /// Bytes of the file name
- /// Key to decrypt the filename with
- /// The decrypted filename
- private static string DecryptFileName(byte[] fileNameBuffer, uint[] key)
- {
- Span nameSpan = fileNameBuffer;
-
- for (int j = 0; j < nameSpan.Length; j = j + 8)
- {
- Span chunk = nameSpan.Slice(j, 8);
- Span decrypted = XTEA.Decipher(16, MemoryMarshal.Cast(chunk).ToArray(), key);
- Span resource = MemoryMarshal.AsBytes(decrypted);
- resource.CopyTo(chunk);
- }
+ ///
+ /// Decrypts the name of a file using XTEA
+ ///
+ /// Bytes of the file name
+ /// Key to decrypt the filename with
+ /// The decrypted filename
+ private static string DecryptFileName(byte[] fileNameBuffer, uint[] key)
+ {
+ Span nameSpan = fileNameBuffer;
- return Encoding.UTF8.GetString(nameSpan.ToArray().TakeWhile(x => x != 0x00).ToArray());
+ for (int j = 0; j < nameSpan.Length; j = j + 8)
+ {
+ Span chunk = nameSpan.Slice(j, 8);
+ Span decrypted = XTEA.Decipher(16, MemoryMarshal.Cast(chunk).ToArray(), key);
+ Span resource = MemoryMarshal.AsBytes(decrypted);
+ resource.CopyTo(chunk);
}
+
+ return Encoding.UTF8.GetString(nameSpan.ToArray().TakeWhile(x => x != 0x00).ToArray());
}
+}
+///
+/// Main structure of file entries
+///
+public struct FileEntry : IEquatable
+{
///
- /// Main structure of file entries
+ /// Length of the file name
///
- public struct FileEntry : IEquatable
+ public byte FileNameLength { get; set; }
+
+ ///
+ /// Compression flag determining if the file is compressed, or a directory
+ ///
+ public byte Compression { get; set; }
+
+ ///
+ /// Offset of the file data from the beginning of the archive
+ ///
+ public uint Offset { get; set; }
+
+ ///
+ /// (Compressed) size of the file
+ ///
+ public uint FileSize { get; set; }
+
+ ///
+ /// Real size of the file
+ ///
+ public uint RealFileSize { get; set; }
+
+ ///
+ /// Full path and name of the file
+ ///
+ public string FileName { get; set; }
+
+ public bool Equals(FileEntry other)
{
- ///
- /// Length of the file name
- ///
- public byte FileNameLength { get; set; }
-
- ///
- /// Compression flag determining if the file is compressed, or a directory
- ///
- public byte Compression { get; set; }
-
- ///
- /// Offset of the file data from the beginning of the archive
- ///
- public uint Offset { get; set; }
-
- ///
- /// (Compressed) size of the file
- ///
- public uint FileSize { get; set; }
-
- ///
- /// Real size of the file
- ///
- public uint RealFileSize { get; set; }
-
- ///
- /// Full path and name of the file
- ///
- public string FileName { get; set; }
-
- public bool Equals(FileEntry other)
- {
- return FileNameLength == other.FileNameLength && Compression == other.Compression &&
- Offset == other.Offset && FileSize == other.FileSize && RealFileSize == other.RealFileSize &&
- string.Equals(FileName, other.FileName);
- }
+ return FileNameLength == other.FileNameLength && Compression == other.Compression &&
+ Offset == other.Offset && FileSize == other.FileSize && RealFileSize == other.RealFileSize &&
+ string.Equals(FileName, other.FileName);
}
}
\ No newline at end of file
diff --git a/PangLib.PAK/PangLib.PAK.csproj b/PangLib.PAK/PangLib.PAK.csproj
index d0dcd4a..5ac37b1 100644
--- a/PangLib.PAK/PangLib.PAK.csproj
+++ b/PangLib.PAK/PangLib.PAK.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.PET/Helpers/AnimationReader.cs b/PangLib.PET/Helpers/AnimationReader.cs
index 146b5b2..ff642da 100644
--- a/PangLib.PET/Helpers/AnimationReader.cs
+++ b/PangLib.PET/Helpers/AnimationReader.cs
@@ -3,131 +3,130 @@
using PangLib.PET.Models;
using Version = PangLib.PET.Models.Version;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class AnimationReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all animations from a Puppet file and return a list of them
///
- static class AnimationReader
+ /// BinaryReader instance containing the Animation section data
+ /// Version of the Puppet file
+ /// List of animations from the Puppet file
+ public static List ReadAllAnimations(BinaryReader sectionReader, Version version)
{
- ///
- /// Helper method to read all animations from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Animation section data
- /// Version of the Puppet file
- /// List of animations from the Puppet file
- public static List ReadAllAnimations(BinaryReader sectionReader, Version version)
+ List Animations = new List();
+
+ while (sectionReader.BaseStream.Position < sectionReader.BaseStream.Length)
{
- List Animations = new List();
+ Animation animation = new Animation();
+
+ animation.BoneID = sectionReader.ReadByte();
- while (sectionReader.BaseStream.Position < sectionReader.BaseStream.Length)
+ // Once the root bone is reached (ID 255) stop reading animations
+ if (animation.BoneID == 255)
{
- Animation animation = new Animation();
+ break;
+ }
- animation.BoneID = sectionReader.ReadByte();
+ // Bone ID 254 have two additional bytes after the ID (FE 00) to skip over
+ if (animation.BoneID == 254)
+ {
+ animation.SubID = sectionReader.ReadByte();
+ animation.SubSubID = sectionReader.ReadByte();
+ }
- // Once the root bone is reached (ID 255) stop reading animations
- if (animation.BoneID == 255)
- {
- break;
- }
+ uint positionDataCount = sectionReader.ReadUInt32();
+ animation.PositionData = new PositionData[positionDataCount];
- // Bone ID 254 have two additional bytes after the ID (FE 00) to skip over
- if (animation.BoneID == 254)
- {
- animation.SubID = sectionReader.ReadByte();
- animation.SubSubID = sectionReader.ReadByte();
- }
+ for (int i = 0; i < positionDataCount; i++)
+ {
+ PositionData positionData = new PositionData {
+ Time = sectionReader.ReadSingle(),
+ X = sectionReader.ReadSingle(),
+ Y = sectionReader.ReadSingle(),
+ Z = sectionReader.ReadSingle(),
+ };
+
+ animation.PositionData[i] = positionData;
+ }
+
+ uint rotationDataCount = sectionReader.ReadUInt32();
+ animation.RotationData = new RotationData[rotationDataCount];
+
+ if (version.Minor == 0)
+ {
+ // TODO: Check if this is an unknown value or just padding
+ animation.Unknown1 = sectionReader.ReadUInt32();
+ }
- uint positionDataCount = sectionReader.ReadUInt32();
- animation.PositionData = new PositionData[positionDataCount];
+ for (int i = 0; i < rotationDataCount; i++)
+ {
+ RotationData rotationData;
- for (int i = 0; i < positionDataCount; i++)
+ if (version.Minor >= 2)
{
- PositionData positionData = new PositionData {
+ rotationData = new RotationData {
Time = sectionReader.ReadSingle(),
X = sectionReader.ReadSingle(),
Y = sectionReader.ReadSingle(),
Z = sectionReader.ReadSingle(),
+ W = sectionReader.ReadSingle()
+ };
+ }
+ else {
+ rotationData = new RotationData {
+ X = sectionReader.ReadSingle(),
+ Y = sectionReader.ReadSingle(),
+ Z = sectionReader.ReadSingle(),
+ W = sectionReader.ReadSingle(),
+ Time = sectionReader.ReadSingle()
};
-
- animation.PositionData[i] = positionData;
}
+
+ animation.RotationData[i] = rotationData;
+ }
- uint rotationDataCount = sectionReader.ReadUInt32();
- animation.RotationData = new RotationData[rotationDataCount];
+ if (version.Minor >= 2)
+ {
+ uint scalingDataCount = sectionReader.ReadUInt32();
+ animation.ScalingData = new ScalingData[scalingDataCount];
- if (version.Minor == 0)
+ for (int i = 0; i < scalingDataCount; i++)
{
- // TODO: Check if this is an unknown value or just padding
- animation.Unknown1 = sectionReader.ReadUInt32();
- }
+ ScalingData scalingData = new ScalingData {
+ Time = sectionReader.ReadSingle(),
+ X = sectionReader.ReadSingle(),
+ Y = sectionReader.ReadSingle(),
+ Z = sectionReader.ReadSingle()
+ };
- for (int i = 0; i < rotationDataCount; i++)
- {
- RotationData rotationData;
-
- if (version.Minor >= 2)
- {
- rotationData = new RotationData {
- Time = sectionReader.ReadSingle(),
- X = sectionReader.ReadSingle(),
- Y = sectionReader.ReadSingle(),
- Z = sectionReader.ReadSingle(),
- W = sectionReader.ReadSingle()
- };
- }
- else {
- rotationData = new RotationData {
- X = sectionReader.ReadSingle(),
- Y = sectionReader.ReadSingle(),
- Z = sectionReader.ReadSingle(),
- W = sectionReader.ReadSingle(),
- Time = sectionReader.ReadSingle()
- };
- }
-
- animation.RotationData[i] = rotationData;
+ animation.ScalingData[i] = scalingData;
}
+ }
- if (version.Minor >= 2)
- {
- uint scalingDataCount = sectionReader.ReadUInt32();
- animation.ScalingData = new ScalingData[scalingDataCount];
-
- for (int i = 0; i < scalingDataCount; i++)
- {
- ScalingData scalingData = new ScalingData {
- Time = sectionReader.ReadSingle(),
- X = sectionReader.ReadSingle(),
- Y = sectionReader.ReadSingle(),
- Z = sectionReader.ReadSingle()
- };
-
- animation.ScalingData[i] = scalingData;
- }
- }
+ if (version.Minor >= 3)
+ {
+ uint animationFlagCount = sectionReader.ReadUInt32();
+ animation.AnimationFlags = new AnimationFlag[animationFlagCount];
- if (version.Minor >= 3)
+ for (int i = 0; i < animationFlagCount; i++)
{
- uint animationFlagCount = sectionReader.ReadUInt32();
- animation.AnimationFlags = new AnimationFlag[animationFlagCount];
-
- for (int i = 0; i < animationFlagCount; i++)
- {
- AnimationFlag animationFlag = new AnimationFlag {
- Time = sectionReader.ReadSingle(),
- Value = sectionReader.ReadSingle()
- };
-
- animation.AnimationFlags[i] = animationFlag;
- }
- }
+ AnimationFlag animationFlag = new AnimationFlag {
+ Time = sectionReader.ReadSingle(),
+ Value = sectionReader.ReadSingle()
+ };
- Animations.Add(animation);
+ animation.AnimationFlags[i] = animationFlag;
+ }
}
- return Animations;
+ Animations.Add(animation);
}
+
+ return Animations;
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/BoneReader.cs b/PangLib.PET/Helpers/BoneReader.cs
index c5064f6..856a5da 100644
--- a/PangLib.PET/Helpers/BoneReader.cs
+++ b/PangLib.PET/Helpers/BoneReader.cs
@@ -3,60 +3,59 @@
using System.Text;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class BoneReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all bones from a Puppet file and return a list of them
///
- static class BoneReader
+ /// BinaryReader instance containing the Bone section data
+ /// Version of the Puppet file
+ /// List of bones from the Puppet file
+ public static List ReadAllBones(BinaryReader sectionReader, Version version)
{
- ///
- /// Helper method to read all bones from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Bone section data
- /// Version of the Puppet file
- /// List of bones from the Puppet file
- public static List ReadAllBones(BinaryReader sectionReader, Version version)
- {
- List bones = new List();
+ List bones = new List();
- int boneCount = (int) sectionReader.ReadSByte();
+ int boneCount = (int) sectionReader.ReadSByte();
- for (int i = 0; i < boneCount; i++)
- {
- Bone bone = new Bone();
+ for (int i = 0; i < boneCount; i++)
+ {
+ Bone bone = new Bone();
- List nameChars = new List();
+ List nameChars = new List();
- while (sectionReader.PeekChar() != 0x00)
- {
- nameChars.Add(sectionReader.ReadChar());
- }
+ while (sectionReader.PeekChar() != 0x00)
+ {
+ nameChars.Add(sectionReader.ReadChar());
+ }
- char[] chars = nameChars.ToArray();
- byte[] bytes = Encoding.UTF8.GetBytes(chars);
+ char[] chars = nameChars.ToArray();
+ byte[] bytes = Encoding.UTF8.GetBytes(chars);
- bone.Name = Encoding.UTF8.GetString(bytes);
- sectionReader.BaseStream.Seek(1L, SeekOrigin.Current);
+ bone.Name = Encoding.UTF8.GetString(bytes);
+ sectionReader.BaseStream.Seek(1L, SeekOrigin.Current);
- bone.Parent = sectionReader.ReadByte();
+ bone.Parent = sectionReader.ReadByte();
- bone.Matrix = new float[12];
+ bone.Matrix = new float[12];
- for (int j = 0; j < 12; j++)
- {
- bone.Matrix[j] = sectionReader.ReadSingle();
- }
-
- if (version.Minor >= 3)
- {
- bone.Unknown1 = sectionReader.ReadSingle();
- }
+ for (int j = 0; j < 12; j++)
+ {
+ bone.Matrix[j] = sectionReader.ReadSingle();
+ }
- bones.Add(bone);
+ if (version.Minor >= 3)
+ {
+ bone.Unknown1 = sectionReader.ReadSingle();
}
- return bones;
+ bones.Add(bone);
}
+
+ return bones;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/CollisionBoxReader.cs b/PangLib.PET/Helpers/CollisionBoxReader.cs
index e843866..e1c0127 100644
--- a/PangLib.PET/Helpers/CollisionBoxReader.cs
+++ b/PangLib.PET/Helpers/CollisionBoxReader.cs
@@ -3,57 +3,56 @@
using System.Text;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class CollisionBoxReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all collision boxes from a Puppet file and return a list of them
///
- static class CollisionBoxReader
+ /// BinaryReader instance containing the Collision Box section data
+ /// Version of the Puppet file
+ /// List of collision boxes from the Puppet file
+ public static List ReadAllCollisionBoxes(BinaryReader sectionReader, Version version)
{
- ///
- /// Helper method to read all collision boxes from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Collision Box section data
- /// Version of the Puppet file
- /// List of collision boxes from the Puppet file
- public static List ReadAllCollisionBoxes(BinaryReader sectionReader, Version version)
- {
- List collisionBoxes = new List();
+ List collisionBoxes = new List();
- uint collisionBoxCount = sectionReader.ReadUInt32();
+ uint collisionBoxCount = sectionReader.ReadUInt32();
- for (int i = 0; i < collisionBoxCount; i++)
- {
- CollisionBox collisionBox = new CollisionBox();
+ for (int i = 0; i < collisionBoxCount; i++)
+ {
+ CollisionBox collisionBox = new CollisionBox();
- collisionBox.Unknown1 = sectionReader.ReadUInt32();
- collisionBox.Unknown2 = sectionReader.ReadUInt32();
+ collisionBox.Unknown1 = sectionReader.ReadUInt32();
+ collisionBox.Unknown2 = sectionReader.ReadUInt32();
- uint nameLength = sectionReader.ReadUInt32();
+ uint nameLength = sectionReader.ReadUInt32();
- collisionBox.Name = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) nameLength));
+ collisionBox.Name = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) nameLength));
- uint boneNameLength = sectionReader.ReadUInt32();
+ uint boneNameLength = sectionReader.ReadUInt32();
- collisionBox.BoneName = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) boneNameLength));
+ collisionBox.BoneName = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) boneNameLength));
- uint scriptLength = sectionReader.ReadUInt32();
+ uint scriptLength = sectionReader.ReadUInt32();
- collisionBox.Script = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) scriptLength));
+ collisionBox.Script = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) scriptLength));
- collisionBox.Unknown3 = sectionReader.ReadUInt32();
+ collisionBox.Unknown3 = sectionReader.ReadUInt32();
- collisionBox.MinX = sectionReader.ReadSingle();
- collisionBox.MinY = sectionReader.ReadSingle();
- collisionBox.MinZ = sectionReader.ReadSingle();
- collisionBox.MaxX = sectionReader.ReadSingle();
- collisionBox.MaxY = sectionReader.ReadSingle();
- collisionBox.MaxZ = sectionReader.ReadSingle();
+ collisionBox.MinX = sectionReader.ReadSingle();
+ collisionBox.MinY = sectionReader.ReadSingle();
+ collisionBox.MinZ = sectionReader.ReadSingle();
+ collisionBox.MaxX = sectionReader.ReadSingle();
+ collisionBox.MaxY = sectionReader.ReadSingle();
+ collisionBox.MaxZ = sectionReader.ReadSingle();
- collisionBoxes.Add(collisionBox);
- }
-
- return collisionBoxes;
+ collisionBoxes.Add(collisionBox);
}
+
+ return collisionBoxes;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/ExtraReader.cs b/PangLib.PET/Helpers/ExtraReader.cs
index 55ee8dc..c471f7d 100644
--- a/PangLib.PET/Helpers/ExtraReader.cs
+++ b/PangLib.PET/Helpers/ExtraReader.cs
@@ -1,31 +1,30 @@
using System.IO;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class ExtraReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read the extra section of a Puppet file and return the contained data as a structure
///
- static class ExtraReader
+ /// BinaryReader instance containing the Extra section data
+ /// An instance of containing parsed data
+ public static Extra ReadExtra(BinaryReader sectionReader)
{
- ///
- /// Helper method to read the extra section of a Puppet file and return the contained data as a structure
- ///
- /// BinaryReader instance containing the Extra section data
- /// An instance of containing parsed data
- public static Extra ReadExtra(BinaryReader sectionReader)
- {
- Extra extra = new Extra();
-
- uint charCount = sectionReader.ReadUInt32();
- extra.CharacterSet = new char[charCount];
+ Extra extra = new Extra();
- for (int i = 0; i < charCount; i++)
- {
- extra.CharacterSet[i] = sectionReader.ReadChar();
- }
+ uint charCount = sectionReader.ReadUInt32();
+ extra.CharacterSet = new char[charCount];
- return extra;
+ for (int i = 0; i < charCount; i++)
+ {
+ extra.CharacterSet[i] = sectionReader.ReadChar();
}
+
+ return extra;
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/FrameReader.cs b/PangLib.PET/Helpers/FrameReader.cs
index cf9f018..2d33d65 100644
--- a/PangLib.PET/Helpers/FrameReader.cs
+++ b/PangLib.PET/Helpers/FrameReader.cs
@@ -3,42 +3,41 @@
using System.Text;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class FrameReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all frames from a Puppet file and return a list of them
///
- static class FrameReader
+ /// BinaryReader instance containing the Frame section data
+ /// List of frames from the Puppet file
+ public static List ReadAllFrames(BinaryReader sectionReader)
{
- ///
- /// Helper method to read all frames from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Frame section data
- /// List of frames from the Puppet file
- public static List ReadAllFrames(BinaryReader sectionReader)
- {
- List frames = new List();
+ List frames = new List();
- uint frameCount = sectionReader.ReadUInt32();
+ uint frameCount = sectionReader.ReadUInt32();
- for (int i = 0; i < frameCount; i++)
- {
- Frame frame = new Frame();
+ for (int i = 0; i < frameCount; i++)
+ {
+ Frame frame = new Frame();
- frame.Index = sectionReader.ReadUInt32();
+ frame.Index = sectionReader.ReadUInt32();
- uint scriptLength = sectionReader.ReadUInt32();
+ uint scriptLength = sectionReader.ReadUInt32();
- frame.Script = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) scriptLength));
+ frame.Script = Encoding.UTF8.GetString(sectionReader.ReadBytes((int) scriptLength));
- frame.X = sectionReader.ReadSingle();
- frame.Y = sectionReader.ReadSingle();
- frame.Z = sectionReader.ReadSingle();
+ frame.X = sectionReader.ReadSingle();
+ frame.Y = sectionReader.ReadSingle();
+ frame.Z = sectionReader.ReadSingle();
- frames.Add(frame);
- }
-
- return frames;
+ frames.Add(frame);
}
+
+ return frames;
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/MeshReader.cs b/PangLib.PET/Helpers/MeshReader.cs
index 8f6f8ce..8b3a15a 100644
--- a/PangLib.PET/Helpers/MeshReader.cs
+++ b/PangLib.PET/Helpers/MeshReader.cs
@@ -2,137 +2,136 @@
using System.IO;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read a structure from Puppet files
+///
+static class MeshReader
{
///
- /// Helper class to read a structure from Puppet files
+ /// Helper method to read the mesh from a Puppet file and return it
///
- static class MeshReader
+ /// BinaryReader instance containing the Mesh section data
+ /// Version of the Puppet file
+ /// The mesh from the Puppet file
+ public static Mesh ReadMesh(BinaryReader sectionReader, Version version)
{
- ///
- /// Helper method to read the mesh from a Puppet file and return it
- ///
- /// BinaryReader instance containing the Mesh section data
- /// Version of the Puppet file
- /// The mesh from the Puppet file
- public static Mesh ReadMesh(BinaryReader sectionReader, Version version)
- {
- Mesh mesh = new Mesh();
+ Mesh mesh = new Mesh();
- uint vertexCount = sectionReader.ReadUInt32();
- mesh.Vertices = new Vertex[vertexCount];
+ uint vertexCount = sectionReader.ReadUInt32();
+ mesh.Vertices = new Vertex[vertexCount];
- for (int i = 0; i < vertexCount; i++)
- {
- mesh.Vertices[i] = ReadVertex(sectionReader);
- }
+ for (int i = 0; i < vertexCount; i++)
+ {
+ mesh.Vertices[i] = ReadVertex(sectionReader);
+ }
- uint polygonCount = sectionReader.ReadUInt32();
- mesh.Polygons = new Polygon[polygonCount];
+ uint polygonCount = sectionReader.ReadUInt32();
+ mesh.Polygons = new Polygon[polygonCount];
- for (int i = 0; i < polygonCount; i++)
- {
- mesh.Polygons[i] = ReadPolygon(sectionReader, version);
- }
+ for (int i = 0; i < polygonCount; i++)
+ {
+ mesh.Polygons[i] = ReadPolygon(sectionReader, version);
+ }
- mesh.TextureMap = new uint[polygonCount];
+ mesh.TextureMap = new uint[polygonCount];
- for (int i = 0; i < polygonCount; i++)
- {
- mesh.TextureMap[i] = sectionReader.ReadByte();
- }
-
- return mesh;
+ for (int i = 0; i < polygonCount; i++)
+ {
+ mesh.TextureMap[i] = sectionReader.ReadByte();
}
- ///
- /// Helper method to read a single vertex
- ///
- /// BinaryReader instance
- /// An instance of
- public static Vertex ReadVertex(BinaryReader sectionReader)
- {
- Vertex vertex = new Vertex();
+ return mesh;
+ }
- vertex.X = sectionReader.ReadSingle();
- vertex.Y = sectionReader.ReadSingle();
- vertex.Z = sectionReader.ReadSingle();
+ ///
+ /// Helper method to read a single vertex
+ ///
+ /// BinaryReader instance
+ /// An instance of
+ public static Vertex ReadVertex(BinaryReader sectionReader)
+ {
+ Vertex vertex = new Vertex();
- byte fullWeight = 0;
- int readCount = 0;
-
- vertex.BoneInformation = new List();
+ vertex.X = sectionReader.ReadSingle();
+ vertex.Y = sectionReader.ReadSingle();
+ vertex.Z = sectionReader.ReadSingle();
- while (fullWeight != 255 || readCount < 2)
- {
- BoneInformation boneInformation = new BoneInformation();
+ byte fullWeight = 0;
+ int readCount = 0;
+
+ vertex.BoneInformation = new List();
- byte weight = sectionReader.ReadByte();
+ while (fullWeight != 255 || readCount < 2)
+ {
+ BoneInformation boneInformation = new BoneInformation();
- boneInformation.Weight = weight;
- fullWeight += weight;
+ byte weight = sectionReader.ReadByte();
- boneInformation.BoneID = sectionReader.ReadByte();
+ boneInformation.Weight = weight;
+ fullWeight += weight;
- vertex.BoneInformation.Add(boneInformation);
- readCount += 1;
- }
+ boneInformation.BoneID = sectionReader.ReadByte();
- return vertex;
+ vertex.BoneInformation.Add(boneInformation);
+ readCount += 1;
}
- ///
- /// Helper method to read a single polygon
- ///
- /// BinaryReader instance
- /// Version of the Puppet file
- /// An instance of
- public static Polygon ReadPolygon(BinaryReader sectionReader, Version version)
+ return vertex;
+ }
+
+ ///
+ /// Helper method to read a single polygon
+ ///
+ /// BinaryReader instance
+ /// Version of the Puppet file
+ /// An instance of
+ public static Polygon ReadPolygon(BinaryReader sectionReader, Version version)
+ {
+ Polygon polygon = new Polygon();
+ polygon.PolygonIndices = new PolygonIndex[3];
+
+ for (int i = 0; i < 3; i++)
{
- Polygon polygon = new Polygon();
- polygon.PolygonIndices = new PolygonIndex[3];
+ PolygonIndex polygonIndex = new PolygonIndex
+ {
+ Index = sectionReader.ReadUInt32(),
+ X = sectionReader.ReadSingle(),
+ Y = sectionReader.ReadSingle(),
+ Z = sectionReader.ReadSingle()
+ };
- for (int i = 0; i < 3; i++)
+ if (version.Minor >= 2)
{
- PolygonIndex polygonIndex = new PolygonIndex
- {
- Index = sectionReader.ReadUInt32(),
- X = sectionReader.ReadSingle(),
- Y = sectionReader.ReadSingle(),
- Z = sectionReader.ReadSingle()
- };
+ byte uvMapCount = sectionReader.ReadByte();
+ polygonIndex.UVMappings = new UVMapping[uvMapCount];
- if (version.Minor >= 2)
+ for (int j = 0; j < uvMapCount; j++)
{
- byte uvMapCount = sectionReader.ReadByte();
- polygonIndex.UVMappings = new UVMapping[uvMapCount];
-
- for (int j = 0; j < uvMapCount; j++)
- {
- UVMapping uvMapping = new UVMapping {
- U = sectionReader.ReadSingle(),
- V = sectionReader.ReadSingle()
- };
-
- polygonIndex.UVMappings[j] = uvMapping;
- }
- }
- else
- {
- polygonIndex.UVMappings = new UVMapping[1];
-
UVMapping uvMapping = new UVMapping {
U = sectionReader.ReadSingle(),
V = sectionReader.ReadSingle()
};
- polygonIndex.UVMappings[0] = uvMapping;
+ polygonIndex.UVMappings[j] = uvMapping;
}
+ }
+ else
+ {
+ polygonIndex.UVMappings = new UVMapping[1];
+
+ UVMapping uvMapping = new UVMapping {
+ U = sectionReader.ReadSingle(),
+ V = sectionReader.ReadSingle()
+ };
- polygon.PolygonIndices[i] = polygonIndex;
+ polygonIndex.UVMappings[0] = uvMapping;
}
- return polygon;
+ polygon.PolygonIndices[i] = polygonIndex;
}
+
+ return polygon;
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/MotionReader.cs b/PangLib.PET/Helpers/MotionReader.cs
index 45338ee..589d2cc 100644
--- a/PangLib.PET/Helpers/MotionReader.cs
+++ b/PangLib.PET/Helpers/MotionReader.cs
@@ -3,53 +3,52 @@
using System.Text;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class MotionReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all motions from a Puppet file and return a list of them
///
- static class MotionReader
+ /// BinaryReader instance containing the Motion section data
+ /// List of motions from the Puppet file
+ public static List ReadAllMotions(BinaryReader sectionReader)
{
- ///
- /// Helper method to read all motions from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Motion section data
- /// List of motions from the Puppet file
- public static List ReadAllMotions(BinaryReader sectionReader)
- {
- List motions = new List();
-
- uint motionCount = sectionReader.ReadUInt32();
+ List motions = new List();
- for (int i = 0; i < motionCount; i++)
- {
- Motion motion = new Motion();
+ uint motionCount = sectionReader.ReadUInt32();
- int nameLength = sectionReader.ReadInt32();
+ for (int i = 0; i < motionCount; i++)
+ {
+ Motion motion = new Motion();
- motion.Name = Encoding.UTF8.GetString(sectionReader.ReadBytes(nameLength));
+ int nameLength = sectionReader.ReadInt32();
- motion.FrameStart = sectionReader.ReadUInt32();
- motion.FrameEnd = sectionReader.ReadUInt32();
+ motion.Name = Encoding.UTF8.GetString(sectionReader.ReadBytes(nameLength));
- int targetNameLength = sectionReader.ReadInt32();
+ motion.FrameStart = sectionReader.ReadUInt32();
+ motion.FrameEnd = sectionReader.ReadUInt32();
- motion.TargetName = Encoding.UTF8.GetString(sectionReader.ReadBytes(targetNameLength));
+ int targetNameLength = sectionReader.ReadInt32();
- int typeNameLength = sectionReader.ReadInt32();
+ motion.TargetName = Encoding.UTF8.GetString(sectionReader.ReadBytes(targetNameLength));
- motion.TypeName = Encoding.UTF8.GetString(sectionReader.ReadBytes(typeNameLength));
+ int typeNameLength = sectionReader.ReadInt32();
- motion.Type = sectionReader.ReadUInt32();
+ motion.TypeName = Encoding.UTF8.GetString(sectionReader.ReadBytes(typeNameLength));
- int boneNameLength = sectionReader.ReadInt32();
+ motion.Type = sectionReader.ReadUInt32();
- motion.BoneName = Encoding.UTF8.GetString(sectionReader.ReadBytes(boneNameLength));
+ int boneNameLength = sectionReader.ReadInt32();
- motions.Add(motion);
- }
+ motion.BoneName = Encoding.UTF8.GetString(sectionReader.ReadBytes(boneNameLength));
- return motions;
+ motions.Add(motion);
}
+
+ return motions;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/TextureReader.cs b/PangLib.PET/Helpers/TextureReader.cs
index 1e9ccc0..54a1684 100644
--- a/PangLib.PET/Helpers/TextureReader.cs
+++ b/PangLib.PET/Helpers/TextureReader.cs
@@ -4,37 +4,36 @@
using System.Text;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read structures from Puppet files
+///
+static class TextureReader
{
///
- /// Helper class to read structures from Puppet files
+ /// Helper method to read all textures from a Puppet file and return a list of them
///
- static class TextureReader
+ /// BinaryReader instance containing the Texture section data
+ /// List of textures from the Puppet file
+ public static List ReadAllTextures(BinaryReader sectionReader)
{
- ///
- /// Helper method to read all textures from a Puppet file and return a list of them
- ///
- /// BinaryReader instance containing the Texture section data
- /// List of textures from the Puppet file
- public static List ReadAllTextures(BinaryReader sectionReader)
- {
- List textures = new List();
-
- uint textureCount = sectionReader.ReadUInt32();
+ List textures = new List();
- for (int i = 0; i < textureCount; i++)
- {
- Texture texture = new Texture();
+ uint textureCount = sectionReader.ReadUInt32();
- // TODO each texture section is 44 bytes, currently only the filename is read from the beginning of each
- char[] chars = sectionReader.ReadChars(44).TakeWhile(c => c != 0x00).ToArray();
- byte[] bytes = Encoding.UTF8.GetBytes(chars);
- texture.FileName = Encoding.UTF8.GetString(bytes);
+ for (int i = 0; i < textureCount; i++)
+ {
+ Texture texture = new Texture();
- textures.Add(texture);
- }
+ // TODO each texture section is 44 bytes, currently only the filename is read from the beginning of each
+ char[] chars = sectionReader.ReadChars(44).TakeWhile(c => c != 0x00).ToArray();
+ byte[] bytes = Encoding.UTF8.GetBytes(chars);
+ texture.FileName = Encoding.UTF8.GetString(bytes);
- return textures;
+ textures.Add(texture);
}
+
+ return textures;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.PET/Helpers/VersionReader.cs b/PangLib.PET/Helpers/VersionReader.cs
index 9ed3054..c306422 100644
--- a/PangLib.PET/Helpers/VersionReader.cs
+++ b/PangLib.PET/Helpers/VersionReader.cs
@@ -1,24 +1,23 @@
using System.IO;
using PangLib.PET.Models;
-namespace PangLib.PET.Helpers
+namespace PangLib.PET.Helpers;
+
+///
+/// Helper class to read a structure from Puppet files
+///
+static class VersionReader
{
///
- /// Helper class to read a structure from Puppet files
+ /// Helper method to read the version from a Puppet file and return it
///
- static class VersionReader
+ /// BinaryReader instance containing the Version section data
+ /// The version of the Puppet file
+ public static Version ReadVersion(BinaryReader sectionReader)
{
- ///
- /// Helper method to read the version from a Puppet file and return it
- ///
- /// BinaryReader instance containing the Version section data
- /// The version of the Puppet file
- public static Version ReadVersion(BinaryReader sectionReader)
- {
- return new Version() {
- Minor = sectionReader.ReadByte(),
- Major = sectionReader.ReadByte()
- };
- }
+ return new Version() {
+ Minor = sectionReader.ReadByte(),
+ Major = sectionReader.ReadByte()
+ };
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Animation.cs b/PangLib.PET/Models/Animation.cs
index 1811dab..7a4c627 100644
--- a/PangLib.PET/Models/Animation.cs
+++ b/PangLib.PET/Models/Animation.cs
@@ -1,52 +1,51 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base animation structure for Puppet files
+///
+public struct Animation
{
///
- /// Base animation structure for Puppet files
+ /// ID of the being animated
///
- public struct Animation
- {
- ///
- /// ID of the being animated
- ///
- public byte BoneID { get; set; }
+ public byte BoneID { get; set; }
- ///
- /// Sub ID of the being animated
- ///
- /// This is only used in Animations with the 254
- ///
- public byte SubID { get; set; }
+ ///
+ /// Sub ID of the being animated
+ ///
+ /// This is only used in Animations with the 254
+ ///
+ public byte SubID { get; set; }
- ///
- /// Sub-Sub ID of the being animated
- ///
- /// This is only used in Animations with the 254
- ///
- public byte SubSubID { get; set; }
+ ///
+ /// Sub-Sub ID of the being animated
+ ///
+ /// This is only used in Animations with the 254
+ ///
+ public byte SubSubID { get; set; }
- ///
- /// List of of this animation
- ///
- public PositionData[] PositionData { get; set; }
+ ///
+ /// List of of this animation
+ ///
+ public PositionData[] PositionData { get; set; }
- ///
- /// Unknown value
- ///
- public uint Unknown1 { get; set; }
+ ///
+ /// Unknown value
+ ///
+ public uint Unknown1 { get; set; }
- ///
- /// List of of this animation
- ///
- public RotationData[] RotationData { get; set; }
+ ///
+ /// List of of this animation
+ ///
+ public RotationData[] RotationData { get; set; }
- ///
- /// List of of this animation
- ///
- public ScalingData[] ScalingData { get; set; }
+ ///
+ /// List of of this animation
+ ///
+ public ScalingData[] ScalingData { get; set; }
- ///
- /// List of of this animation
- ///
- public AnimationFlag[] AnimationFlags { get; set; }
- }
+ ///
+ /// List of of this animation
+ ///
+ public AnimationFlag[] AnimationFlags { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/AnimationFlag.cs b/PangLib.PET/Models/AnimationFlag.cs
index e2ac742..34f4a14 100644
--- a/PangLib.PET/Models/AnimationFlag.cs
+++ b/PangLib.PET/Models/AnimationFlag.cs
@@ -1,18 +1,17 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// AnimationFlag structure used inside
+///
+public struct AnimationFlag
{
///
- /// AnimationFlag structure used inside
+ /// Time in seconds
///
- public struct AnimationFlag
- {
- ///
- /// Time in seconds
- ///
- public float Time { get; set; }
+ public float Time { get; set; }
- ///
- /// Value of the flag at
- ///
- public float Value { get; set; }
- }
+ ///
+ /// Value of the flag at
+ ///
+ public float Value { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Bone.cs b/PangLib.PET/Models/Bone.cs
index e7c5067..583198b 100644
--- a/PangLib.PET/Models/Bone.cs
+++ b/PangLib.PET/Models/Bone.cs
@@ -1,31 +1,30 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base bone structure for Puppet files
+///
+public struct Bone
{
///
- /// Base bone structure for Puppet files
+ /// Name of the bone
///
- public struct Bone
- {
- ///
- /// Name of the bone
- ///
- public string Name { get; set; }
+ public string Name { get; set; }
- ///
- /// ID of the parent bone
- ///
- ///
- /// If this ID is 255 the bone is a root bone
- ///
- public byte Parent { get; set; }
+ ///
+ /// ID of the parent bone
+ ///
+ ///
+ /// If this ID is 255 the bone is a root bone
+ ///
+ public byte Parent { get; set; }
- ///
- /// Perspective projection matrix of the bone
- ///
- public float[] Matrix { get; set; }
+ ///
+ /// Perspective projection matrix of the bone
+ ///
+ public float[] Matrix { get; set; }
- ///
- /// Unknown value present in version 1.3 files
- ///
- public float Unknown1 { get; set; }
- }
-}
+ ///
+ /// Unknown value present in version 1.3 files
+ ///
+ public float Unknown1 { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/BoneInformation.cs b/PangLib.PET/Models/BoneInformation.cs
index d69d7b8..eacbad3 100644
--- a/PangLib.PET/Models/BoneInformation.cs
+++ b/PangLib.PET/Models/BoneInformation.cs
@@ -1,18 +1,17 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Bone information structure used inside
+///
+public struct BoneInformation
{
///
- /// Bone information structure used inside
+ /// Weight of the binding to
///
- public struct BoneInformation
- {
- ///
- /// Weight of the binding to
- ///
- public byte Weight { get; set; }
+ public byte Weight { get; set; }
- ///
- /// ID of the the is attached to
- ///
- public byte BoneID { get; set; }
- }
-}
+ ///
+ /// ID of the the is attached to
+ ///
+ public byte BoneID { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/CollisionBox.cs b/PangLib.PET/Models/CollisionBox.cs
index 59244ab..311958a 100644
--- a/PangLib.PET/Models/CollisionBox.cs
+++ b/PangLib.PET/Models/CollisionBox.cs
@@ -1,68 +1,67 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base collision box structure for Puppet files
+///
+public struct CollisionBox
{
///
- /// Base collision box structure for Puppet files
+ /// Unknown value
///
- public struct CollisionBox
- {
- ///
- /// Unknown value
- ///
- public uint Unknown1 { get; set; }
+ public uint Unknown1 { get; set; }
- ///
- /// Unknown value
- ///
- public uint Unknown2 { get; set; }
+ ///
+ /// Unknown value
+ ///
+ public uint Unknown2 { get; set; }
- ///
- /// Name of the collision box
- ///
- public string Name { get; set; }
+ ///
+ /// Name of the collision box
+ ///
+ public string Name { get; set; }
- ///
- /// Name of the this collision box is attached to
- ///
- public string BoneName { get; set; }
+ ///
+ /// Name of the this collision box is attached to
+ ///
+ public string BoneName { get; set; }
- ///
- /// Script executed on this collision box
- ///
- public string Script { get; set; }
+ ///
+ /// Script executed on this collision box
+ ///
+ public string Script { get; set; }
- ///
- /// Unknown value
- ///
- public uint Unknown3 { get; set; }
+ ///
+ /// Unknown value
+ ///
+ public uint Unknown3 { get; set; }
- ///
- /// Minimal X coordinate
- ///
- public float MinX { get; set; }
+ ///
+ /// Minimal X coordinate
+ ///
+ public float MinX { get; set; }
- ///
- /// Minimal Y coordinate
- ///
- public float MinY { get; set; }
+ ///
+ /// Minimal Y coordinate
+ ///
+ public float MinY { get; set; }
- ///
- /// Minimal Z coordinate
- ///
- public float MinZ { get; set; }
+ ///
+ /// Minimal Z coordinate
+ ///
+ public float MinZ { get; set; }
- ///
- /// Maximal X coordinate
- ///
- public float MaxX { get; set; }
+ ///
+ /// Maximal X coordinate
+ ///
+ public float MaxX { get; set; }
- ///
- /// Maximal Y coordinate
- ///
- public float MaxY { get; set; }
+ ///
+ /// Maximal Y coordinate
+ ///
+ public float MaxY { get; set; }
- ///
- /// Maximal Z coordinate
- ///
- public float MaxZ { get; set; }
- }
-}
+ ///
+ /// Maximal Z coordinate
+ ///
+ public float MaxZ { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Extra.cs b/PangLib.PET/Models/Extra.cs
index dc67eae..14b4225 100644
--- a/PangLib.PET/Models/Extra.cs
+++ b/PangLib.PET/Models/Extra.cs
@@ -1,13 +1,12 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base extra structure for Puppet files
+///
+public struct Extra
{
///
- /// Base extra structure for Puppet files
+ /// Character set used in the Puppet file
///
- public struct Extra
- {
- ///
- /// Character set used in the Puppet file
- ///
- public char[] CharacterSet;
- }
+ public char[] CharacterSet;
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Frame.cs b/PangLib.PET/Models/Frame.cs
index 49a35a8..04fba9f 100644
--- a/PangLib.PET/Models/Frame.cs
+++ b/PangLib.PET/Models/Frame.cs
@@ -1,33 +1,32 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base frame structure for Puppet files
+///
+public struct Frame
{
///
- /// Base frame structure for Puppet files
+ /// Index of the frame
///
- public struct Frame
- {
- ///
- /// Index of the frame
- ///
- public uint Index { get; set; }
+ public uint Index { get; set; }
- ///
- /// Script executed on this frame
- ///
- public string Script { get; set; }
+ ///
+ /// Script executed on this frame
+ ///
+ public string Script { get; set; }
- ///
- /// X origin coordinate
- ///
- public float X { get; set; }
+ ///
+ /// X origin coordinate
+ ///
+ public float X { get; set; }
- ///
- /// Y origin coordinate
- ///
- public float Y { get; set; }
+ ///
+ /// Y origin coordinate
+ ///
+ public float Y { get; set; }
- ///
- /// Z origin coordinate
- ///
- public float Z { get; set; }
- }
+ ///
+ /// Z origin coordinate
+ ///
+ public float Z { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Mesh.cs b/PangLib.PET/Models/Mesh.cs
index 90ca514..d4c90ad 100644
--- a/PangLib.PET/Models/Mesh.cs
+++ b/PangLib.PET/Models/Mesh.cs
@@ -1,23 +1,22 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base mesh structure for Puppet files
+///
+public struct Mesh
{
///
- /// Base mesh structure for Puppet files
+ /// List of making up this mesh
///
- public struct Mesh
- {
- ///
- /// List of making up this mesh
- ///
- public Vertex[] Vertices { get; set; }
+ public Vertex[] Vertices { get; set; }
- ///
- /// List of making up this mesh
- ///
- public Polygon[] Polygons { get; set; }
+ ///
+ /// List of making up this mesh
+ ///
+ public Polygon[] Polygons { get; set; }
- ///
- /// Texture mapping of to
- ///
- public uint[] TextureMap { get; set; }
- }
+ ///
+ /// Texture mapping of to
+ ///
+ public uint[] TextureMap { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Motion.cs b/PangLib.PET/Models/Motion.cs
index 38cb8a4..c839c06 100644
--- a/PangLib.PET/Models/Motion.cs
+++ b/PangLib.PET/Models/Motion.cs
@@ -1,43 +1,42 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base motion structure for Puppet files
+///
+public struct Motion
{
///
- /// Base motion structure for Puppet files
+ /// Name of the motion
///
- public struct Motion
- {
- ///
- /// Name of the motion
- ///
- public string Name { get; set; }
+ public string Name { get; set; }
- ///
- /// Start index
- ///
- public uint FrameStart { get; set; }
+ ///
+ /// Start index
+ ///
+ public uint FrameStart { get; set; }
- ///
- /// End index
- ///
- public uint FrameEnd { get; set; }
+ ///
+ /// End index
+ ///
+ public uint FrameEnd { get; set; }
- ///
- /// Target name
- ///
- public string TargetName { get; set; }
+ ///
+ /// Target name
+ ///
+ public string TargetName { get; set; }
- ///
- /// Type of motion
- ///
- public string TypeName { get; set; }
+ ///
+ /// Type of motion
+ ///
+ public string TypeName { get; set; }
- ///
- /// Type identifier
- ///
- public uint Type { get; set; }
+ ///
+ /// Type identifier
+ ///
+ public uint Type { get; set; }
- ///
- /// Name of the this motion belongs to
- ///
- public string BoneName { get; set; }
- }
-}
+ ///
+ /// Name of the this motion belongs to
+ ///
+ public string BoneName { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Polygon.cs b/PangLib.PET/Models/Polygon.cs
index 798c2ad..633b1bb 100644
--- a/PangLib.PET/Models/Polygon.cs
+++ b/PangLib.PET/Models/Polygon.cs
@@ -1,13 +1,12 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Polygon structure used inside
+///
+public struct Polygon
{
///
- /// Polygon structure used inside
+ /// List of making up this polygon
///
- public struct Polygon
- {
- ///
- /// List of making up this polygon
- ///
- public PolygonIndex[] PolygonIndices { get; set; }
- }
-}
+ public PolygonIndex[] PolygonIndices { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/PolygonIndex.cs b/PangLib.PET/Models/PolygonIndex.cs
index f661660..cf3b55a 100644
--- a/PangLib.PET/Models/PolygonIndex.cs
+++ b/PangLib.PET/Models/PolygonIndex.cs
@@ -1,33 +1,32 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Polygon index/point structure used inside
+///
+public struct PolygonIndex
{
///
- /// Polygon index/point structure used inside
+ /// Index of the this polygon index belongs to
///
- public struct PolygonIndex
- {
- ///
- /// Index of the this polygon index belongs to
- ///
- public uint Index { get; set; }
+ public uint Index { get; set; }
- ///
- /// X coordinate of this polygon point
- ///
- public float X { get; set; }
+ ///
+ /// X coordinate of this polygon point
+ ///
+ public float X { get; set; }
- ///
- /// Y coordinate of this polygon point
- ///
- public float Y { get; set; }
+ ///
+ /// Y coordinate of this polygon point
+ ///
+ public float Y { get; set; }
- ///
- /// Z coordinate of this polygon point
- ///
- public float Z { get; set; }
+ ///
+ /// Z coordinate of this polygon point
+ ///
+ public float Z { get; set; }
- ///
- /// List of of this polygon index
- ///
- public UVMapping[] UVMappings { get; set; }
- }
-}
+ ///
+ /// List of of this polygon index
+ ///
+ public UVMapping[] UVMappings { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/PositionData.cs b/PangLib.PET/Models/PositionData.cs
index cbca867..a35a17c 100644
--- a/PangLib.PET/Models/PositionData.cs
+++ b/PangLib.PET/Models/PositionData.cs
@@ -1,28 +1,27 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Positional data structure used inside , determining position changes
+///
+public struct PositionData
{
///
- /// Positional data structure used inside , determining position changes
+ /// Time in seconds
///
- public struct PositionData
- {
- ///
- /// Time in seconds
- ///
- public float Time { get; set; }
+ public float Time { get; set; }
- ///
- /// X coordinate at
- ///
- public float X { get; set; }
+ ///
+ /// X coordinate at
+ ///
+ public float X { get; set; }
- ///
- /// Y coordinate at
- ///
- public float Y { get; set; }
+ ///
+ /// Y coordinate at
+ ///
+ public float Y { get; set; }
- ///
- /// Z coordinate at
- ///
- public float Z { get; set; }
- }
+ ///
+ /// Z coordinate at
+ ///
+ public float Z { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/RotationData.cs b/PangLib.PET/Models/RotationData.cs
index 253aee1..8cea651 100644
--- a/PangLib.PET/Models/RotationData.cs
+++ b/PangLib.PET/Models/RotationData.cs
@@ -1,36 +1,35 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Rotational data used inside , determining rotation changes
+///
+///
+/// The structure and maths for rotations in Pangya are based around Quaternions
+///
+public struct RotationData
{
///
- /// Rotational data used inside , determining rotation changes
+ /// Time in seconds
///
- ///
- /// The structure and maths for rotations in Pangya are based around Quaternions
- ///
- public struct RotationData
- {
- ///
- /// Time in seconds
- ///
- public float Time { get; set; }
+ public float Time { get; set; }
- ///
- /// X coordinate of the rotation axis at
- ///
- public float X { get; set; }
+ ///
+ /// X coordinate of the rotation axis at
+ ///
+ public float X { get; set; }
- ///
- /// Y coordinate of the rotation axis at
- ///
- public float Y { get; set; }
+ ///
+ /// Y coordinate of the rotation axis at
+ ///
+ public float Y { get; set; }
- ///
- /// Z coordinate of the rotation axis at
- ///
- public float Z { get; set; }
+ ///
+ /// Z coordinate of the rotation axis at
+ ///
+ public float Z { get; set; }
- ///
- /// Scalar value for rotation around the X/Y/Z-axis at
- ///
- public float W { get; set; }
- }
+ ///
+ /// Scalar value for rotation around the X/Y/Z-axis at
+ ///
+ public float W { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/ScalingData.cs b/PangLib.PET/Models/ScalingData.cs
index 3001428..6050e5a 100644
--- a/PangLib.PET/Models/ScalingData.cs
+++ b/PangLib.PET/Models/ScalingData.cs
@@ -1,28 +1,27 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Scaling data structure used inside , determining scale changes
+///
+public struct ScalingData
{
///
- /// Scaling data structure used inside , determining scale changes
+ /// Time in seconds
///
- public struct ScalingData
- {
- ///
- /// Time in seconds
- ///
- public float Time { get; set; }
+ public float Time { get; set; }
- ///
- /// Scale of X coordinate at
- ///
- public float X { get; set; }
+ ///
+ /// Scale of X coordinate at
+ ///
+ public float X { get; set; }
- ///
- /// Scale of Y coordinate at
- ///
- public float Y { get; set; }
+ ///
+ /// Scale of Y coordinate at
+ ///
+ public float Y { get; set; }
- ///
- /// Scale of Z coordinate at
- ///
- public float Z { get; set; }
- }
+ ///
+ /// Scale of Z coordinate at
+ ///
+ public float Z { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Texture.cs b/PangLib.PET/Models/Texture.cs
index a25653b..2ff12e7 100644
--- a/PangLib.PET/Models/Texture.cs
+++ b/PangLib.PET/Models/Texture.cs
@@ -1,13 +1,12 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base texture structure for Puppet files
+///
+public struct Texture
{
///
- /// Base texture structure for Puppet files
+ /// File name of the texture
///
- public struct Texture
- {
- ///
- /// File name of the texture
- ///
- public string FileName { get; set; }
- }
-}
+ public string FileName { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/Models/UVMapping.cs b/PangLib.PET/Models/UVMapping.cs
index 4b30c30..238adee 100644
--- a/PangLib.PET/Models/UVMapping.cs
+++ b/PangLib.PET/Models/UVMapping.cs
@@ -1,18 +1,17 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// UV mapping structure used inside
+///
+public struct UVMapping
{
///
- /// UV mapping structure used inside
+ /// U-axis of the UV mapping
///
- public struct UVMapping
- {
- ///
- /// U-axis of the UV mapping
- ///
- public float U { get; set; }
+ public float U { get; set; }
- ///
- /// V-axis of the UV mapping
- ///
- public float V { get; set; }
- }
+ ///
+ /// V-axis of the UV mapping
+ ///
+ public float V { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Version.cs b/PangLib.PET/Models/Version.cs
index dba73c8..a673cc0 100644
--- a/PangLib.PET/Models/Version.cs
+++ b/PangLib.PET/Models/Version.cs
@@ -1,27 +1,26 @@
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Base version structure for Puppet files
+///
+public struct Version
{
///
- /// Base version structure for Puppet files
+ /// Major version number
///
- public struct Version
- {
- ///
- /// Major version number
- ///
- public int Major { get; set; }
+ public int Major { get; set; }
- ///
- /// Minor version number
- ///
- public int Minor { get; set; }
+ ///
+ /// Minor version number
+ ///
+ public int Minor { get; set; }
- ///
- /// String override that returns the full version number
- ///
- /// A string composed of the Major and Minor version number
- public override string ToString()
- {
- return $"{Major.ToString()}.{Minor.ToString()}";
- }
+ ///
+ /// String override that returns the full version number
+ ///
+ /// A string composed of the Major and Minor version number
+ public override string ToString()
+ {
+ return $"{Major.ToString()}.{Minor.ToString()}";
}
}
\ No newline at end of file
diff --git a/PangLib.PET/Models/Vertex.cs b/PangLib.PET/Models/Vertex.cs
index 231fcaa..e638fc5 100644
--- a/PangLib.PET/Models/Vertex.cs
+++ b/PangLib.PET/Models/Vertex.cs
@@ -1,30 +1,29 @@
using System.Collections.Generic;
-namespace PangLib.PET.Models
+namespace PangLib.PET.Models;
+
+///
+/// Vertex structure used inside
+///
+public class Vertex
{
///
- /// Vertex structure used inside
+ /// X coordinate of the vertex
///
- public class Vertex
- {
- ///
- /// X coordinate of the vertex
- ///
- public float X { get; set; }
+ public float X { get; set; }
- ///
- /// Y coordinate of the vertex
- ///
- public float Y { get; set; }
+ ///
+ /// Y coordinate of the vertex
+ ///
+ public float Y { get; set; }
- ///
- /// Z coordinate of the vertex
- ///
- public float Z { get; set; }
+ ///
+ /// Z coordinate of the vertex
+ ///
+ public float Z { get; set; }
- ///
- /// List of tied to this vertex
- ///
- public List BoneInformation { get; set; }
- }
-}
+ ///
+ /// List of tied to this vertex
+ ///
+ public List BoneInformation { get; set; }
+}
\ No newline at end of file
diff --git a/PangLib.PET/PETFile.cs b/PangLib.PET/PETFile.cs
index 8e9db5d..8c1cfd4 100644
--- a/PangLib.PET/PETFile.cs
+++ b/PangLib.PET/PETFile.cs
@@ -7,156 +7,155 @@
using PangLib.PET.Helpers;
using Version = PangLib.PET.Models.Version;
-namespace PangLib.PET
+namespace PangLib.PET;
+
+///
+/// Main PET file class
+///
+public class PETFile
{
///
- /// Main PET file class
+ /// Version of the Puppet file
///
- public class PETFile
+ ///
+ /// Initializes with a 1.0 version because some Puppet files don't have a Version section
+ /// these files are regarded as 1.0
+ ///
+ public Version Version { get; set; } = new Version
{
- ///
- /// Version of the Puppet file
- ///
- ///
- /// Initializes with a 1.0 version because some Puppet files don't have a Version section
- /// these files are regarded as 1.0
- ///
- public Version Version { get; set; } = new Version
- {
- Major = 1,
- Minor = 0
- };
+ Major = 1,
+ Minor = 0
+ };
- ///
- /// List of parsed from this Puppet file
- ///
- public List Animations { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List Animations { get; set; }
- ///
- /// List of parsed from this Puppet file
- ///
- public List Frames { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List Frames { get; set; }
- ///
- /// List of parsed from this Puppet file
- ///
- public List CollisionBoxes { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List CollisionBoxes { get; set; }
- ///
- /// List of parsed from this Puppet file
- ///
- public List Motions { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List Motions { get; set; }
- ///
- /// List of parsed from this Puppet file
- ///
- public List Bones { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List Bones { get; set; }
- ///
- /// List of parsed from this Puppet file
- ///
- public List Textures { get; set; }
+ ///
+ /// List of parsed from this Puppet file
+ ///
+ public List Textures { get; set; }
- ///
- /// parsed from this Puppet file
- ///
- public Mesh Mesh { get; set; }
+ ///
+ /// parsed from this Puppet file
+ ///
+ public Mesh Mesh { get; set; }
- ///
- /// Denotes that this Puppet file has a specular effect applied
- ///
- public bool SpecularMaterial { get; set; }
+ ///
+ /// Denotes that this Puppet file has a specular effect applied
+ ///
+ public bool SpecularMaterial { get; set; }
- ///
- /// section parsed from this Puppet file
- ///
- public Extra Extra { get; set; }
+ ///
+ /// section parsed from this Puppet file
+ ///
+ public Extra Extra { get; set; }
- ///
- /// Initializes a new instance of from the provided stream
- ///
- /// Stream containing the Puppet file data
- public PETFile(Stream data)
- {
- Parse(data);
- }
+ ///
+ /// Initializes a new instance of from the provided stream
+ ///
+ /// Stream containing the Puppet file data
+ public PETFile(Stream data)
+ {
+ Parse(data);
+ }
- ///
- /// Initializes a new instance of from the provided stream
- ///
- /// Stream containing the Puppet file data
- /// Flag allowing conditional exception catching
- public PETFile(Stream data, bool catchExceptions)
- {
- Parse(data, catchExceptions);
- }
+ ///
+ /// Initializes a new instance of from the provided stream
+ ///
+ /// Stream containing the Puppet file data
+ /// Flag allowing conditional exception catching
+ public PETFile(Stream data, bool catchExceptions)
+ {
+ Parse(data, catchExceptions);
+ }
- ///
- /// Parses the passed Stream into Puppet structures
- ///
- /// Stream containing the Puppet file data
- /// Flag allowing conditional exception catching
- private void Parse(Stream data, bool catchExceptions = false)
+ ///
+ /// Parses the passed Stream into Puppet structures
+ ///
+ /// Stream containing the Puppet file data
+ /// Flag allowing conditional exception catching
+ private void Parse(Stream data, bool catchExceptions = false)
+ {
+ using (BinaryReader reader = new BinaryReader(data))
{
- using (BinaryReader reader = new BinaryReader(data))
+ while (reader.BaseStream.Position < reader.BaseStream.Length)
{
- while (reader.BaseStream.Position < reader.BaseStream.Length)
- {
- string sectionName = Encoding.UTF8.GetString(reader.ReadBytes(4));
- int sectionLength = reader.ReadInt32();
- byte[] sectionBytes = reader.ReadBytes(sectionLength);
+ string sectionName = Encoding.UTF8.GetString(reader.ReadBytes(4));
+ int sectionLength = reader.ReadInt32();
+ byte[] sectionBytes = reader.ReadBytes(sectionLength);
- using (BinaryReader sectionReader = new BinaryReader(new MemoryStream(sectionBytes)))
+ using (BinaryReader sectionReader = new BinaryReader(new MemoryStream(sectionBytes)))
+ {
+ try
{
- try
- {
- switch (sectionName)
- {
- case "VERS":
- Version = VersionReader.ReadVersion(sectionReader);
- break;
- case "TEXT":
- Textures = TextureReader.ReadAllTextures(sectionReader);
- break;
- case "SMTL":
- SpecularMaterial = true;
- break;
- case "BONE":
- Bones = BoneReader.ReadAllBones(sectionReader, Version);
- break;
- case "EXTR":
- Extra = ExtraReader.ReadExtra(sectionReader);
- break;
- case "ANIM":
- Animations = AnimationReader.ReadAllAnimations(sectionReader, Version);
- break;
- case "MESH":
- Mesh = MeshReader.ReadMesh(sectionReader, Version);
- break;
- case "FANM":
- // TODO: Implement parsing of FANM section
- break;
- case "FRAM":
- Frames = FrameReader.ReadAllFrames(sectionReader);
- break;
- case "MOTI":
- Motions = MotionReader.ReadAllMotions(sectionReader);
- break;
- case "COLL":
- CollisionBoxes = CollisionBoxReader.ReadAllCollisionBoxes(sectionReader, Version);
- break;
- default:
- Debug.WriteLine($"Unknown section '${sectionName}' with size of ${sectionLength.ToString()} bytes");
- break;
- }
- }
- catch (Exception e) when (catchExceptions)
+ switch (sectionName)
{
- Debug.WriteLine($"{e.Message}\n{e.StackTrace}");
+ case "VERS":
+ Version = VersionReader.ReadVersion(sectionReader);
+ break;
+ case "TEXT":
+ Textures = TextureReader.ReadAllTextures(sectionReader);
+ break;
+ case "SMTL":
+ SpecularMaterial = true;
+ break;
+ case "BONE":
+ Bones = BoneReader.ReadAllBones(sectionReader, Version);
+ break;
+ case "EXTR":
+ Extra = ExtraReader.ReadExtra(sectionReader);
+ break;
+ case "ANIM":
+ Animations = AnimationReader.ReadAllAnimations(sectionReader, Version);
+ break;
+ case "MESH":
+ Mesh = MeshReader.ReadMesh(sectionReader, Version);
+ break;
+ case "FANM":
+ // TODO: Implement parsing of FANM section
+ break;
+ case "FRAM":
+ Frames = FrameReader.ReadAllFrames(sectionReader);
+ break;
+ case "MOTI":
+ Motions = MotionReader.ReadAllMotions(sectionReader);
+ break;
+ case "COLL":
+ CollisionBoxes = CollisionBoxReader.ReadAllCollisionBoxes(sectionReader, Version);
+ break;
+ default:
+ Debug.WriteLine($"Unknown section '${sectionName}' with size of ${sectionLength.ToString()} bytes");
+ break;
}
}
+ catch (Exception e) when (catchExceptions)
+ {
+ Debug.WriteLine($"{e.Message}\n{e.StackTrace}");
+ }
}
}
}
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.PET/PangLib.PET.csproj b/PangLib.PET/PangLib.PET.csproj
index 0e650cf..6e1eba9 100644
--- a/PangLib.PET/PangLib.PET.csproj
+++ b/PangLib.PET/PangLib.PET.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
\ No newline at end of file
diff --git a/PangLib.SBIN/ExtensionMethods.cs b/PangLib.SBIN/ExtensionMethods.cs
index 5ded12c..5f5bccf 100644
--- a/PangLib.SBIN/ExtensionMethods.cs
+++ b/PangLib.SBIN/ExtensionMethods.cs
@@ -3,83 +3,82 @@
using System.Text;
using PangLib.SBIN.Models;
-namespace PangLib.SBIN
+namespace PangLib.SBIN;
+
+public static class ExtensionMethods
{
- public static class ExtensionMethods
+ ///
+ /// Read a string from a fixed amount of bytes
+ ///
+ /// BinaryReader instance
+ /// String length
+ /// String encoding
+ /// The read string
+ public static string ReadFixedString(this BinaryReader reader, int length, Encoding encoding = null)
{
- ///
- /// Read a string from a fixed amount of bytes
- ///
- /// BinaryReader instance
- /// String length
- /// String encoding
- /// The read string
- public static string ReadFixedString(this BinaryReader reader, int length, Encoding encoding = null)
+ if (encoding == null)
{
- if (encoding == null)
- {
- encoding = Encoding.GetEncoding(51949);
- }
+ encoding = Encoding.GetEncoding(51949);
+ }
- char[] chars = reader.ReadChars(length).TakeWhile(c => c != 0x00).ToArray();
- byte[] bytes = encoding.GetBytes(chars);
+ char[] chars = reader.ReadChars(length).TakeWhile(c => c != 0x00).ToArray();
+ byte[] bytes = encoding.GetBytes(chars);
- return encoding.GetString(bytes);
- }
+ return encoding.GetString(bytes);
+ }
- ///
- /// Read a pascal-style string
- ///
- /// BinaryReader instance
- /// String encoding
- /// The read string
- public static string ReadPascalString(this BinaryReader reader, Encoding encoding = null)
- {
- int length = reader.ReadInt32();
- return ReadFixedString(reader, length, encoding);
- }
+ ///
+ /// Read a pascal-style string
+ ///
+ /// BinaryReader instance
+ /// String encoding
+ /// The read string
+ public static string ReadPascalString(this BinaryReader reader, Encoding encoding = null)
+ {
+ int length = reader.ReadInt32();
+ return ReadFixedString(reader, length, encoding);
+ }
- ///
- /// Read a vector from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Vector structure
- public static Vector2 ReadVector2(this BinaryReader reader)
+ ///
+ /// Read a vector from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Vector structure
+ public static Vector2 ReadVector2(this BinaryReader reader)
+ {
+ return new Vector2
{
- return new Vector2
- {
- X = reader.ReadSingle(),
- Y = reader.ReadSingle(),
- };
- }
+ X = reader.ReadSingle(),
+ Y = reader.ReadSingle(),
+ };
+ }
- ///
- /// Read a vector from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Vector structure
- public static Vector3 ReadVector3(this BinaryReader reader)
+ ///
+ /// Read a vector from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Vector structure
+ public static Vector3 ReadVector3(this BinaryReader reader)
+ {
+ return new Vector3
{
- return new Vector3
- {
- X = reader.ReadSingle(),
- Y = reader.ReadSingle(),
- Z = reader.ReadSingle()
- };
- }
+ X = reader.ReadSingle(),
+ Y = reader.ReadSingle(),
+ Z = reader.ReadSingle()
+ };
+ }
- ///
- /// Read a vertex from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Vertex structure
- public static Vertex ReadVertex(this BinaryReader reader)
+ ///
+ /// Read a vertex from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Vertex structure
+ public static Vertex ReadVertex(this BinaryReader reader)
+ {
+ return new Vertex
{
- return new Vertex
- {
- Number = reader.ReadInt32(),
- Index = reader.ReadInt32()
- };
- }
+ Number = reader.ReadInt32(),
+ Index = reader.ReadInt32()
+ };
}
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Helpers/PuppetShadowMapReader.cs b/PangLib.SBIN/Helpers/PuppetShadowMapReader.cs
index e1e42b8..7a2fa7a 100644
--- a/PangLib.SBIN/Helpers/PuppetShadowMapReader.cs
+++ b/PangLib.SBIN/Helpers/PuppetShadowMapReader.cs
@@ -2,26 +2,25 @@
using System.IO;
using PangLib.SBIN.Models;
-namespace PangLib.SBIN.Helpers
+namespace PangLib.SBIN.Helpers;
+
+public class PuppetShadowMapReader
{
- public class PuppetShadowMapReader
+ public static List ReadAllPuppetShadowMaps(BinaryReader reader)
{
- public static List ReadAllPuppetShadowMaps(BinaryReader reader)
- {
- List puppetShadowMaps = new List();
+ List puppetShadowMaps = new List();
- int puppetCount = reader.ReadInt32();
+ int puppetCount = reader.ReadInt32();
- for (int i = 0; i < puppetCount; i++)
+ for (int i = 0; i < puppetCount; i++)
+ {
+ puppetShadowMaps.Add(new PuppetShadowMap()
{
- puppetShadowMaps.Add(new PuppetShadowMap()
- {
- Name = reader.ReadPascalString(),
- ShadowMap = ShadowMapReader.ReadShadowMap(reader)
- });
- }
-
- return puppetShadowMaps;
+ Name = reader.ReadPascalString(),
+ ShadowMap = ShadowMapReader.ReadShadowMap(reader)
+ });
}
+
+ return puppetShadowMaps;
}
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Helpers/ShadowMapReader.cs b/PangLib.SBIN/Helpers/ShadowMapReader.cs
index 3450937..07b133b 100644
--- a/PangLib.SBIN/Helpers/ShadowMapReader.cs
+++ b/PangLib.SBIN/Helpers/ShadowMapReader.cs
@@ -2,138 +2,137 @@
using System.IO;
using PangLib.SBIN.Models;
-namespace PangLib.SBIN.Helpers
+namespace PangLib.SBIN.Helpers;
+
+public class ShadowMapReader
{
- public class ShadowMapReader
+ public static ShadowMap ReadShadowMap(BinaryReader reader)
{
- public static ShadowMap ReadShadowMap(BinaryReader reader)
- {
- ShadowMap shadowMap = new ShadowMap();
+ ShadowMap shadowMap = new ShadowMap();
- int meshCount = reader.ReadInt32();
- List vertices = new List();
+ int meshCount = reader.ReadInt32();
+ List vertices = new List();
- for (int i = 0; i < meshCount; i++)
- {
- vertices.Add(reader.ReadVertex());
- }
+ for (int i = 0; i < meshCount; i++)
+ {
+ vertices.Add(reader.ReadVertex());
+ }
- shadowMap.Vertices = vertices;
+ shadowMap.Vertices = vertices;
- int mesh3DCount = reader.ReadInt32();
- int mesh2DCount = reader.ReadInt32();
+ int mesh3DCount = reader.ReadInt32();
+ int mesh2DCount = reader.ReadInt32();
- List> mesh3D = new List>();
+ List> mesh3D = new List>();
- for (int i = 0; i < mesh3DCount; i++)
- {
- mesh3D.Add(reader.ReadVector3());
- }
+ for (int i = 0; i < mesh3DCount; i++)
+ {
+ mesh3D.Add(reader.ReadVector3());
+ }
- List> mesh2D = new List>();
+ List> mesh2D = new List>();
- for (int i = 0; i < mesh2DCount; i++)
- {
- mesh2D.Add(reader.ReadVector2());
- }
+ for (int i = 0; i < mesh2DCount; i++)
+ {
+ mesh2D.Add(reader.ReadVector2());
+ }
- shadowMap.Mesh3D = mesh3D;
- shadowMap.Mesh2D = mesh2D;
+ shadowMap.Mesh3D = mesh3D;
+ shadowMap.Mesh2D = mesh2D;
- int globalTextureSize = reader.ReadInt32();
+ int globalTextureSize = reader.ReadInt32();
- if (globalTextureSize > 0)
- {
- shadowMap.GlobalTextures = TextureReader.ReadAllTextures(reader);
- }
+ if (globalTextureSize > 0)
+ {
+ shadowMap.GlobalTextures = TextureReader.ReadAllTextures(reader);
+ }
- int type0TextureSize = reader.ReadInt32();
+ int type0TextureSize = reader.ReadInt32();
- if (type0TextureSize > 0)
- {
- shadowMap.Type0Textures = TextureReader.ReadAllTextures(reader);
- }
+ if (type0TextureSize > 0)
+ {
+ shadowMap.Type0Textures = TextureReader.ReadAllTextures(reader);
+ }
- int type1TextureSize = reader.ReadInt32();
+ int type1TextureSize = reader.ReadInt32();
- if (type1TextureSize > 0)
- {
- shadowMap.Type1Textures = TextureReader.ReadAllTextures(reader);
- }
+ if (type1TextureSize > 0)
+ {
+ shadowMap.Type1Textures = TextureReader.ReadAllTextures(reader);
+ }
- int globalValueCount = reader.ReadInt32();
- int type0ValueCount = reader.ReadInt32();
- int type1ValueCount = reader.ReadInt32();
+ int globalValueCount = reader.ReadInt32();
+ int type0ValueCount = reader.ReadInt32();
+ int type1ValueCount = reader.ReadInt32();
- List globalNumberValues = new List();
+ List globalNumberValues = new List();
- if (globalValueCount > 0)
+ if (globalValueCount > 0)
+ {
+ for (int i = 0; i < meshCount; i++)
{
- for (int i = 0; i < meshCount; i++)
- {
- globalNumberValues.Add(reader.ReadInt32());
- }
+ globalNumberValues.Add(reader.ReadInt32());
}
+ }
- List type0NumberValues = new List();
+ List type0NumberValues = new List();
- if (type0ValueCount > 0)
+ if (type0ValueCount > 0)
+ {
+ for (int i = 0; i < meshCount; i++)
{
- for (int i = 0; i < meshCount; i++)
- {
- type0NumberValues.Add(reader.ReadInt32());
- }
+ type0NumberValues.Add(reader.ReadInt32());
}
+ }
- List type1NumberValues = new List();
+ List type1NumberValues = new List();
- if (type1ValueCount > 0)
+ if (type1ValueCount > 0)
+ {
+ for (int i = 0; i < meshCount; i++)
{
- for (int i = 0; i < meshCount; i++)
- {
- type1NumberValues.Add(reader.ReadInt32());
- }
+ type1NumberValues.Add(reader.ReadInt32());
}
+ }
- shadowMap.GlobalNumberValues = globalNumberValues;
- shadowMap.Type0NumberValues = type0NumberValues;
- shadowMap.Type1NumberValues = type1NumberValues;
+ shadowMap.GlobalNumberValues = globalNumberValues;
+ shadowMap.Type0NumberValues = type0NumberValues;
+ shadowMap.Type1NumberValues = type1NumberValues;
- List globalValues = new List();
+ List globalValues = new List();
- if (globalValueCount > 0)
+ if (globalValueCount > 0)
+ {
+ for (int i = 0; i < globalValueCount; i++)
{
- for (int i = 0; i < globalValueCount; i++)
- {
- globalValues.Add(reader.ReadInt64());
- }
+ globalValues.Add(reader.ReadInt64());
}
+ }
- List type0Values = new List();
+ List type0Values = new List();
- if (type0ValueCount > 0)
+ if (type0ValueCount > 0)
+ {
+ for (int i = 0; i < type0ValueCount; i++)
{
- for (int i = 0; i < type0ValueCount; i++)
- {
- type0Values.Add(reader.ReadInt64());
- }
+ type0Values.Add(reader.ReadInt64());
}
+ }
- List type1Values = new List();
+ List type1Values = new List();
- if (type1ValueCount > 0)
+ if (type1ValueCount > 0)
+ {
+ for (int i = 0; i < type1ValueCount; i++)
{
- for (int i = 0; i < type1ValueCount; i++)
- {
- type1Values.Add(reader.ReadInt64());
- }
+ type1Values.Add(reader.ReadInt64());
}
+ }
- shadowMap.GlobalValues = globalValues;
- shadowMap.Type0Values = type0Values;
- shadowMap.Type1Values = type1Values;
+ shadowMap.GlobalValues = globalValues;
+ shadowMap.Type0Values = type0Values;
+ shadowMap.Type1Values = type1Values;
- return shadowMap;
- }
+ return shadowMap;
}
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Helpers/TextureReader.cs b/PangLib.SBIN/Helpers/TextureReader.cs
index 53b5273..c488b4f 100644
--- a/PangLib.SBIN/Helpers/TextureReader.cs
+++ b/PangLib.SBIN/Helpers/TextureReader.cs
@@ -2,42 +2,41 @@
using System.IO;
using PangLib.SBIN.Models;
-namespace PangLib.SBIN.Helpers
+namespace PangLib.SBIN.Helpers;
+
+public class TextureReader
{
- public class TextureReader
+ public static List ReadAllTextures(BinaryReader reader)
{
- public static List ReadAllTextures(BinaryReader reader)
- {
- List textures = new List();
+ List textures = new List();
- int textureCount = reader.ReadInt32();
+ int textureCount = reader.ReadInt32();
- for (int i = 0; i < textureCount; i++)
+ for (int i = 0; i < textureCount; i++)
+ {
+ Texture texture = new Texture()
{
- Texture texture = new Texture()
- {
- Width = reader.ReadInt32(),
- Height = reader.ReadInt32()
- };
-
- texture.TextureData = reader.ReadBytes((texture.Height * texture.Width) / 2);
+ Width = reader.ReadInt32(),
+ Height = reader.ReadInt32()
+ };
- int ddsMapCount = reader.ReadInt32();
+ texture.TextureData = reader.ReadBytes((texture.Height * texture.Width) / 2);
- if (ddsMapCount > 0)
- {
- List ddsMaps = new List();
+ int ddsMapCount = reader.ReadInt32();
- for (int j = 0; i < ddsMapCount; i++)
- {
- ddsMaps.Add(new DDSMap() { Values = reader.ReadBytes(16) });
- }
+ if (ddsMapCount > 0)
+ {
+ List ddsMaps = new List();
- texture.DDSMaps = ddsMaps;
+ for (int j = 0; i < ddsMapCount; i++)
+ {
+ ddsMaps.Add(new DDSMap() { Values = reader.ReadBytes(16) });
}
- }
- return textures;
+ texture.DDSMaps = ddsMaps;
+ }
}
+
+ return textures;
}
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/DDSMap.cs b/PangLib.SBIN/Models/DDSMap.cs
index ec29e2c..5a7951e 100644
--- a/PangLib.SBIN/Models/DDSMap.cs
+++ b/PangLib.SBIN/Models/DDSMap.cs
@@ -1,7 +1,6 @@
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public struct DDSMap
{
- public struct DDSMap
- {
- public byte[] Values;
- }
+ public byte[] Values;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/PuppetShadowMap.cs b/PangLib.SBIN/Models/PuppetShadowMap.cs
index 6507ced..4315be0 100644
--- a/PangLib.SBIN/Models/PuppetShadowMap.cs
+++ b/PangLib.SBIN/Models/PuppetShadowMap.cs
@@ -1,8 +1,7 @@
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public class PuppetShadowMap
{
- public class PuppetShadowMap
- {
- public string Name;
- public ShadowMap ShadowMap;
- }
+ public string Name;
+ public ShadowMap ShadowMap;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/ShadowMap.cs b/PangLib.SBIN/Models/ShadowMap.cs
index 7c88e92..480ac6d 100644
--- a/PangLib.SBIN/Models/ShadowMap.cs
+++ b/PangLib.SBIN/Models/ShadowMap.cs
@@ -1,20 +1,19 @@
using System.Collections.Generic;
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public class ShadowMap
{
- public class ShadowMap
- {
- public List Vertices;
- public List> Mesh3D;
- public List> Mesh2D;
- public List GlobalTextures;
- public List Type0Textures;
- public List Type1Textures;
- public List GlobalNumberValues;
- public List Type0NumberValues;
- public List Type1NumberValues;
- public List GlobalValues;
- public List Type0Values;
- public List Type1Values;
- }
+ public List Vertices;
+ public List> Mesh3D;
+ public List> Mesh2D;
+ public List GlobalTextures;
+ public List Type0Textures;
+ public List Type1Textures;
+ public List GlobalNumberValues;
+ public List Type0NumberValues;
+ public List Type1NumberValues;
+ public List GlobalValues;
+ public List Type0Values;
+ public List Type1Values;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/Texture.cs b/PangLib.SBIN/Models/Texture.cs
index 1439f13..68f7240 100644
--- a/PangLib.SBIN/Models/Texture.cs
+++ b/PangLib.SBIN/Models/Texture.cs
@@ -1,12 +1,11 @@
using System.Collections.Generic;
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public struct Texture
{
- public struct Texture
- {
- public int Width;
- public int Height;
- public byte[] TextureData;
- public List DDSMaps;
- }
+ public int Width;
+ public int Height;
+ public byte[] TextureData;
+ public List DDSMaps;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/Vector.cs b/PangLib.SBIN/Models/Vector.cs
index 9c614a5..f0c5439 100644
--- a/PangLib.SBIN/Models/Vector.cs
+++ b/PangLib.SBIN/Models/Vector.cs
@@ -1,15 +1,14 @@
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public struct Vector2
{
- public struct Vector2
- {
- public T X;
- public T Y;
- }
+ public T X;
+ public T Y;
+}
- public struct Vector3
- {
- public T X;
- public T Y;
- public T Z;
- }
+public struct Vector3
+{
+ public T X;
+ public T Y;
+ public T Z;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/Models/Vertex.cs b/PangLib.SBIN/Models/Vertex.cs
index 5134ebd..18b32a9 100644
--- a/PangLib.SBIN/Models/Vertex.cs
+++ b/PangLib.SBIN/Models/Vertex.cs
@@ -1,8 +1,7 @@
-namespace PangLib.SBIN.Models
+namespace PangLib.SBIN.Models;
+
+public struct Vertex
{
- public struct Vertex
- {
- public int Number;
- public int Index;
- }
+ public int Number;
+ public int Index;
}
\ No newline at end of file
diff --git a/PangLib.SBIN/PangLib.SBIN.csproj b/PangLib.SBIN/PangLib.SBIN.csproj
index 89f1f0a..fafb103 100644
--- a/PangLib.SBIN/PangLib.SBIN.csproj
+++ b/PangLib.SBIN/PangLib.SBIN.csproj
@@ -15,6 +15,8 @@
netstandard2.0
PangLib.SBIN
+
+ 12
diff --git a/PangLib.SBIN/SBINFile.cs b/PangLib.SBIN/SBINFile.cs
index 94862a9..c0b0659 100644
--- a/PangLib.SBIN/SBINFile.cs
+++ b/PangLib.SBIN/SBINFile.cs
@@ -3,34 +3,33 @@
using PangLib.SBIN.Helpers;
using PangLib.SBIN.Models;
-namespace PangLib.SBIN
+namespace PangLib.SBIN;
+
+public class SBINFile
{
- public class SBINFile
+ public List PuppetShadowMaps;
+ public ShadowMap ShadowMap;
+
+ public SBINFile(Stream data)
{
- public List PuppetShadowMaps;
- public ShadowMap ShadowMap;
+ Parse(data);
+ }
- public SBINFile(Stream data)
+ private void Parse(Stream data)
+ {
+ using (BinaryReader reader = new BinaryReader(data))
{
- Parse(data);
- }
+ int version = reader.ReadInt32();
- private void Parse(Stream data)
- {
- using (BinaryReader reader = new BinaryReader(data))
+ if (version > 0xFFFE000)
{
- int version = reader.ReadInt32();
-
- if (version > 0xFFFE000)
- {
- PuppetShadowMaps = PuppetShadowMapReader.ReadAllPuppetShadowMaps(reader);
- }
- else
- {
- reader.BaseStream.Seek(0, SeekOrigin.Begin);
- ShadowMap = ShadowMapReader.ReadShadowMap(reader);
- }
+ PuppetShadowMaps = PuppetShadowMapReader.ReadAllPuppetShadowMaps(reader);
+ }
+ else
+ {
+ reader.BaseStream.Seek(0, SeekOrigin.Begin);
+ ShadowMap = ShadowMapReader.ReadShadowMap(reader);
}
}
- }
-}
+ }
+}
\ No newline at end of file
diff --git a/PangLib.Scripting/PET/PETCommand.cs b/PangLib.Scripting/PET/PETCommand.cs
index 585bd69..3575a0a 100644
--- a/PangLib.Scripting/PET/PETCommand.cs
+++ b/PangLib.Scripting/PET/PETCommand.cs
@@ -1,20 +1,19 @@
using System.Collections.Generic;
-namespace PangLib.Scripting.PET
+namespace PangLib.Scripting.PET;
+
+///
+/// Basic structure for a command used in
+///
+public struct PETCommand
{
///
- /// Basic structure for a command used in
+ /// Name of the command
///
- public struct PETCommand
- {
- ///
- /// Name of the command
- ///
- public string Name { get; set; }
+ public string Name { get; set; }
- ///
- /// List of the arguments of the command
- ///
- public List Arguments { get; set; }
- }
+ ///
+ /// List of the arguments of the command
+ ///
+ public List Arguments { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.Scripting/PET/PETScript.cs b/PangLib.Scripting/PET/PETScript.cs
index 873490c..4f9c427 100644
--- a/PangLib.Scripting/PET/PETScript.cs
+++ b/PangLib.Scripting/PET/PETScript.cs
@@ -2,38 +2,37 @@
using PETToken = PangLib.Scripting.Token;
using PETTokenDefinition = PangLib.Scripting.TokenDefinition;
-namespace PangLib.Scripting.PET
+namespace PangLib.Scripting.PET;
+
+///
+/// Class containing tokenizing and parsing utilities for a custom script format included
+/// in Puppet (.?pet) files
+///
+public class PETScript
{
///
- /// Class containing tokenizing and parsing utilities for a custom script format included
- /// in Puppet (.?pet) files
+ /// Parsed commands from the tokens of the PET script
///
- public class PETScript
- {
- ///
- /// Parsed commands from the tokens of the PET script
- ///
- public List Commands { get; }
+ public List Commands { get; }
- ///
- /// Constructor for , tokenizing and parsing the PET script
- ///
- /// The PET script to be parsed
- public PETScript(string petScript)
- {
- Tokenizer tokenizer = new Tokenizer(
- new List
- {
- new PETTokenDefinition(PETTokenType.CommandName, @"^\*\w+"),
- new PETTokenDefinition(PETTokenType.OpenParenthesis, "^\\("),
- new PETTokenDefinition(PETTokenType.Argument, "^\"[^\"]*\"{1}"),
- new PETTokenDefinition(PETTokenType.CloseParenthesis, "^\\)")
- }
- );
+ ///
+ /// Constructor for , tokenizing and parsing the PET script
+ ///
+ /// The PET script to be parsed
+ public PETScript(string petScript)
+ {
+ Tokenizer tokenizer = new Tokenizer(
+ new List
+ {
+ new PETTokenDefinition(PETTokenType.CommandName, @"^\*\w+"),
+ new PETTokenDefinition(PETTokenType.OpenParenthesis, "^\\("),
+ new PETTokenDefinition(PETTokenType.Argument, "^\"[^\"]*\"{1}"),
+ new PETTokenDefinition(PETTokenType.CloseParenthesis, "^\\)")
+ }
+ );
- List tokens = tokenizer.Tokenize(petScript);
+ List tokens = tokenizer.Tokenize(petScript);
- Commands = new PETScriptParser(tokens).Parse();
- }
+ Commands = new PETScriptParser(tokens).Parse();
}
}
\ No newline at end of file
diff --git a/PangLib.Scripting/PET/PETScriptParser.cs b/PangLib.Scripting/PET/PETScriptParser.cs
index c2a9669..bba99ca 100644
--- a/PangLib.Scripting/PET/PETScriptParser.cs
+++ b/PangLib.Scripting/PET/PETScriptParser.cs
@@ -1,68 +1,67 @@
using System.Collections.Generic;
using PETToken = PangLib.Scripting.Token;
-namespace PangLib.Scripting.PET
+namespace PangLib.Scripting.PET;
+
+///
+/// PET script parsed implementation used in
+///
+public class PETScriptParser
{
///
- /// PET script parsed implementation used in
+ /// Stack containing all s to be parsed
+ ///
+ private readonly Stack TokenSequence;
+
+ ///
+ /// Constructor for the
+ ///
+ /// List of tokens to be parsed
+ public PETScriptParser(List Tokens)
+ {
+ Tokens.Reverse();
+ TokenSequence = new Stack(Tokens);
+ }
+
+ ///
+ /// Steps through and parses the tokens into objects
///
- public class PETScriptParser
+ /// s parsed from s
+ public List Parse()
{
- ///
- /// Stack containing all s to be parsed
- ///
- private readonly Stack TokenSequence;
+ List commands = new List();
- ///
- /// Constructor for the
- ///
- /// List of tokens to be parsed
- public PETScriptParser(List Tokens)
+ while (TokenSequence.Count > 0)
{
- Tokens.Reverse();
- TokenSequence = new Stack(Tokens);
+ commands.Add(ReadCommand());
}
-
- ///
- /// Steps through and parses the tokens into objects
- ///
- /// s parsed from s
- public List Parse()
- {
- List commands = new List();
-
- while (TokenSequence.Count > 0)
- {
- commands.Add(ReadCommand());
- }
- return commands;
- }
+ return commands;
+ }
- ///
- /// Parsing function that returns s contained in the PET script
- ///
- /// A single instance of parsed from the
- private PETCommand ReadCommand()
- {
- PETCommand command = new PETCommand();
+ ///
+ /// Parsing function that returns s contained in the PET script
+ ///
+ /// A single instance of parsed from the
+ private PETCommand ReadCommand()
+ {
+ PETCommand command = new PETCommand();
- command.Name = TokenSequence.Pop().Value.TrimStart('*');
- command.Arguments = new List();
+ command.Name = TokenSequence.Pop().Value.TrimStart('*');
+ command.Arguments = new List();
- if (TokenSequence.Peek().TokenType == PETTokenType.OpenParenthesis)
- {
- TokenSequence.Pop();
-
- while (TokenSequence.Peek().TokenType != PETTokenType.CloseParenthesis)
- {
- command.Arguments.Add(TokenSequence.Pop().Value.Trim('"'));
- }
+ if (TokenSequence.Peek().TokenType == PETTokenType.OpenParenthesis)
+ {
+ TokenSequence.Pop();
- TokenSequence.Pop();
+ while (TokenSequence.Peek().TokenType != PETTokenType.CloseParenthesis)
+ {
+ command.Arguments.Add(TokenSequence.Pop().Value.Trim('"'));
}
-
- return command;
+
+ TokenSequence.Pop();
}
+
+ return command;
}
}
\ No newline at end of file
diff --git a/PangLib.Scripting/PET/PETTokenType.cs b/PangLib.Scripting/PET/PETTokenType.cs
index fb52f24..28c26a6 100644
--- a/PangLib.Scripting/PET/PETTokenType.cs
+++ b/PangLib.Scripting/PET/PETTokenType.cs
@@ -1,36 +1,35 @@
-namespace PangLib.Scripting.PET
+namespace PangLib.Scripting.PET;
+
+///
+/// All token types used in
+///
+public enum PETTokenType
{
///
- /// All token types used in
+ /// An argument in a
+ ///
+ /// "__facetexture__"
///
- public enum PETTokenType
- {
- ///
- /// An argument in a
- ///
- /// "__facetexture__"
- ///
- Argument,
+ Argument,
- ///
- /// A closing parenthesis
- ///
- /// )
- ///
- CloseParenthesis,
+ ///
+ /// A closing parenthesis
+ ///
+ /// )
+ ///
+ CloseParenthesis,
- ///
- /// Name of a
- ///
- /// *ptex
- ///
- CommandName,
+ ///
+ /// Name of a
+ ///
+ /// *ptex
+ ///
+ CommandName,
- ///
- /// A opening parenthesis
- ///
- /// (
- ///
- OpenParenthesis
- }
+ ///
+ /// A opening parenthesis
+ ///
+ /// (
+ ///
+ OpenParenthesis
}
\ No newline at end of file
diff --git a/PangLib.Scripting/PangLib.Scripting.csproj b/PangLib.Scripting/PangLib.Scripting.csproj
index aca934e..fddc451 100644
--- a/PangLib.Scripting/PangLib.Scripting.csproj
+++ b/PangLib.Scripting/PangLib.Scripting.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/retreev/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.Scripting/Token.cs b/PangLib.Scripting/Token.cs
index b6d2e3d..d13dab6 100644
--- a/PangLib.Scripting/Token.cs
+++ b/PangLib.Scripting/Token.cs
@@ -1,20 +1,19 @@
-namespace PangLib.Scripting
+namespace PangLib.Scripting;
+
+public class Token where T : new()
{
- public class Token where T : new()
- {
- public T TokenType { get; set; }
- public string Value { get; set; }
+ public T TokenType { get; set; }
+ public string Value { get; set; }
- public Token(T tokenType)
- {
- TokenType = tokenType;
- Value = string.Empty;
- }
+ public Token(T tokenType)
+ {
+ TokenType = tokenType;
+ Value = string.Empty;
+ }
- public Token(T tokenType, string value)
- {
- TokenType = tokenType;
- Value = value;
- }
+ public Token(T tokenType, string value)
+ {
+ TokenType = tokenType;
+ Value = value;
}
}
\ No newline at end of file
diff --git a/PangLib.Scripting/TokenDefinition.cs b/PangLib.Scripting/TokenDefinition.cs
index ac9cde1..6aa2626 100644
--- a/PangLib.Scripting/TokenDefinition.cs
+++ b/PangLib.Scripting/TokenDefinition.cs
@@ -1,37 +1,36 @@
using System.Text.RegularExpressions;
-namespace PangLib.Scripting
+namespace PangLib.Scripting;
+
+public class TokenDefinition where T : new()
{
- public class TokenDefinition where T : new()
- {
- private Regex Regex;
- private readonly T ReturnToken;
+ private Regex Regex;
+ private readonly T ReturnToken;
- public TokenDefinition(T returnToken, string regexPattern)
- {
- Regex = new Regex(regexPattern, RegexOptions.IgnoreCase);
- ReturnToken = returnToken;
- }
+ public TokenDefinition(T returnToken, string regexPattern)
+ {
+ Regex = new Regex(regexPattern, RegexOptions.IgnoreCase);
+ ReturnToken = returnToken;
+ }
- public TokenMatch Match(string inputString)
+ public TokenMatch Match(string inputString)
+ {
+ var match = Regex.Match(inputString);
+ if (match.Success)
{
- var match = Regex.Match(inputString);
- if (match.Success)
- {
- string remainingText = string.Empty;
- if (match.Length != inputString.Length)
- remainingText = inputString.Substring(match.Length);
+ string remainingText = string.Empty;
+ if (match.Length != inputString.Length)
+ remainingText = inputString.Substring(match.Length);
- return new TokenMatch
- {
- IsMatch = true,
- RemainingText = remainingText,
- TokenType = ReturnToken,
- Value = match.Value
- };
- }
-
- return new TokenMatch { IsMatch = false};
+ return new TokenMatch
+ {
+ IsMatch = true,
+ RemainingText = remainingText,
+ TokenType = ReturnToken,
+ Value = match.Value
+ };
}
+
+ return new TokenMatch { IsMatch = false};
}
}
\ No newline at end of file
diff --git a/PangLib.Scripting/TokenMatch.cs b/PangLib.Scripting/TokenMatch.cs
index 3f5e471..eb42826 100644
--- a/PangLib.Scripting/TokenMatch.cs
+++ b/PangLib.Scripting/TokenMatch.cs
@@ -1,10 +1,9 @@
-namespace PangLib.Scripting
+namespace PangLib.Scripting;
+
+public class TokenMatch where T : new()
{
- public class TokenMatch where T : new()
- {
- public bool IsMatch { get; set; }
- public T TokenType { get; set; }
- public string Value { get; set; }
- public string RemainingText { get; set; }
- }
+ public bool IsMatch { get; set; }
+ public T TokenType { get; set; }
+ public string Value { get; set; }
+ public string RemainingText { get; set; }
}
\ No newline at end of file
diff --git a/PangLib.Scripting/Tokenizer.cs b/PangLib.Scripting/Tokenizer.cs
index 90bd264..6c18fdf 100644
--- a/PangLib.Scripting/Tokenizer.cs
+++ b/PangLib.Scripting/Tokenizer.cs
@@ -1,49 +1,48 @@
using System.Collections.Generic;
-namespace PangLib.Scripting.PET
+namespace PangLib.Scripting;
+
+public class Tokenizer where T : new()
{
- public class Tokenizer where T : new()
- {
- private List> TokenDefinitions;
+ private List> TokenDefinitions;
- public Tokenizer(List> tokenDefinitions)
- {
- TokenDefinitions = tokenDefinitions;
- }
+ public Tokenizer(List> tokenDefinitions)
+ {
+ TokenDefinitions = tokenDefinitions;
+ }
+
+ public List> Tokenize(string inputString)
+ {
+ List> token = new List>();
+ string remainingText = inputString;
- public List> Tokenize(string inputString)
+ while (!string.IsNullOrWhiteSpace(remainingText))
{
- List> token = new List>();
- string remainingText = inputString;
+ TokenMatch match = FindMatch(remainingText);
- while (!string.IsNullOrWhiteSpace(remainingText))
+ if (match.IsMatch)
{
- TokenMatch match = FindMatch(remainingText);
-
- if (match.IsMatch)
- {
- token.Add(new Token(match.TokenType, match.Value));
- remainingText = match.RemainingText;
- }
- else
- {
- remainingText = remainingText.Substring(1);
- }
+ token.Add(new Token(match.TokenType, match.Value));
+ remainingText = match.RemainingText;
+ }
+ else
+ {
+ remainingText = remainingText.Substring(1);
}
-
- return token;
}
+
+ return token;
+ }
- private TokenMatch FindMatch(string inputString)
+ private TokenMatch FindMatch(string inputString)
+ {
+ foreach (var tokenDefinition in TokenDefinitions)
{
- foreach (var tokenDefinition in TokenDefinitions)
- {
- var match = tokenDefinition.Match(inputString);
- if (match.IsMatch)
- return match;
- }
-
- return new TokenMatch { IsMatch = false };
+ var match = tokenDefinition.Match(inputString);
+ if (match.IsMatch)
+ return match;
}
+
+ return new TokenMatch { IsMatch = false };
}
}
\ No newline at end of file
diff --git a/PangLib.UCC/PangLib.UCC.csproj b/PangLib.UCC/PangLib.UCC.csproj
index 705f3e7..9de2a4a 100644
--- a/PangLib.UCC/PangLib.UCC.csproj
+++ b/PangLib.UCC/PangLib.UCC.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.UCC/UCCFile.cs b/PangLib.UCC/UCCFile.cs
index aa1db24..24896f4 100644
--- a/PangLib.UCC/UCCFile.cs
+++ b/PangLib.UCC/UCCFile.cs
@@ -2,103 +2,102 @@
using System.IO.Compression;
using SkiaSharp;
-namespace PangLib.UCC
+namespace PangLib.UCC;
+
+///
+/// Main UCC file class
+///
+public class UCCFile
{
///
- /// Main UCC file class
+ /// ZIPArchive instance for the UCC file containing the self-design parts
///
- public class UCCFile
+ private ZipArchive ZIPFile;
+
+ ///
+ /// Constructor for UCC file instance
+ ///
+ /// Stream containing the UCC file data
+ public UCCFile(Stream data)
{
- ///
- /// ZIPArchive instance for the UCC file containing the self-design parts
- ///
- private ZipArchive ZIPFile;
-
- ///
- /// Constructor for UCC file instance
- ///
- /// Stream containing the UCC file data
- public UCCFile(Stream data)
- {
- ZIPFile = new ZipArchive(data);
- }
+ ZIPFile = new ZipArchive(data);
+ }
- ///
- /// Get the specified entry of the UCC file and return it as a bitmap
- ///
- /// Name of the entry
- /// Bitmap instance of the specified entry
- public SKBitmap GetBitmapFromFileEntry(string entryName)
- {
- int width;
- int height;
- int posX = 0;
- int posY = 0;
+ ///
+ /// Get the specified entry of the UCC file and return it as a bitmap
+ ///
+ /// Name of the entry
+ /// Bitmap instance of the specified entry
+ public SKBitmap GetBitmapFromFileEntry(string entryName)
+ {
+ int width;
+ int height;
+ int posX = 0;
+ int posY = 0;
- ZipArchiveEntry entry = ZIPFile.GetEntry(entryName);
+ ZipArchiveEntry entry = ZIPFile.GetEntry(entryName);
- MemoryStream memoryStream = new MemoryStream();
- entry?.Open().CopyTo(memoryStream);
- memoryStream.Position = 0;
+ MemoryStream memoryStream = new MemoryStream();
+ entry?.Open().CopyTo(memoryStream);
+ memoryStream.Position = 0;
- if (memoryStream.Length > 65536)
- {
- width = 256;
- height = 256;
- }
- else if (memoryStream.Length > 32768)
- {
- width = 128;
- height = 64;
- }
- else if (entryName == "icon")
- {
- width = 64;
- height = 84;
- }
- else
- {
- width = 128;
- height = 128;
- }
+ if (memoryStream.Length > 65536)
+ {
+ width = 256;
+ height = 256;
+ }
+ else if (memoryStream.Length > 32768)
+ {
+ width = 128;
+ height = 64;
+ }
+ else if (entryName == "icon")
+ {
+ width = 64;
+ height = 84;
+ }
+ else
+ {
+ width = 128;
+ height = 128;
+ }
- SKBitmap bitmap = new SKBitmap(width, height);
+ SKBitmap bitmap = new SKBitmap(width, height);
- using (BinaryReader reader = new BinaryReader(memoryStream))
+ using (BinaryReader reader = new BinaryReader(memoryStream))
+ {
+ while (reader.BaseStream.Position < reader.BaseStream.Length)
{
- while (reader.BaseStream.Position < reader.BaseStream.Length)
- {
- int loopCount = 3;
+ int loopCount = 3;
- if (entryName == "icon")
- {
- loopCount = 4;
- }
+ if (entryName == "icon")
+ {
+ loopCount = 4;
+ }
- byte[] hexColor = new byte[4];
+ byte[] hexColor = new byte[4];
- for (byte i = 0; i < loopCount; i++)
- {
- hexColor[i] = reader.ReadByte();
- }
+ for (byte i = 0; i < loopCount; i++)
+ {
+ hexColor[i] = reader.ReadByte();
+ }
- SKColor color = new SKColor(hexColor[2], hexColor[1], hexColor[0], entryName == "icon" ? hexColor[3] : (byte) 255);
+ SKColor color = new SKColor(hexColor[2], hexColor[1], hexColor[0], entryName == "icon" ? hexColor[3] : (byte) 255);
- bitmap.SetPixel(posX, posY, color);
+ bitmap.SetPixel(posX, posY, color);
- posX++;
+ posX++;
- if (posX != width)
- {
- continue;
- }
-
- posY++;
- posX = 0;
+ if (posX != width)
+ {
+ continue;
}
+
+ posY++;
+ posX = 0;
}
-
- return bitmap;
}
+
+ return bitmap;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.UpdateList/PangLib.UpdateList.csproj b/PangLib.UpdateList/PangLib.UpdateList.csproj
index 8a7fca9..37a2391 100644
--- a/PangLib.UpdateList/PangLib.UpdateList.csproj
+++ b/PangLib.UpdateList/PangLib.UpdateList.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.UpdateList/UpdateList.cs b/PangLib.UpdateList/UpdateList.cs
index a827fd2..3b03390 100644
--- a/PangLib.UpdateList/UpdateList.cs
+++ b/PangLib.UpdateList/UpdateList.cs
@@ -5,59 +5,58 @@
using System.Xml;
using PangLib.Utilities.Cryptography;
-namespace PangLib.UpdateList
+namespace PangLib.UpdateList;
+
+///
+/// Main UpdateList file class
+///
+public class UpdateList
{
+ public string Document;
+
+ private uint[] DecryptionKey;
+ private string FilePath;
+
///
- /// Main UpdateList file class
+ /// Constructor for the UpdateList class
///
- public class UpdateList
+ /// Path to the updatelist file
+ public UpdateList(string filePath)
{
- public string Document;
-
- private uint[] DecryptionKey;
- private string FilePath;
+ FilePath = filePath;
+ }
- ///
- /// Constructor for the UpdateList class
- ///
- /// Path to the updatelist file
- public UpdateList(string filePath)
+ ///
+ /// Decrypts and parses the updatelist file
+ ///
+ /// Saves the parsed updatelist in the Document instance attribute
+ ///
+ public void Parse()
+ {
+ if (DecryptionKey == null)
{
- FilePath = filePath;
+ throw new NullReferenceException("DecryptionKey needs to be set using the SetDecryptionKey instance method!");
}
- ///
- /// Decrypts and parses the updatelist file
- ///
- /// Saves the parsed updatelist in the Document instance attribute
- ///
- public void Parse()
- {
- if (DecryptionKey == null)
- {
- throw new NullReferenceException("DecryptionKey needs to be set using the SetDecryptionKey instance method!");
- }
-
- Span updateList = File.ReadAllBytes(FilePath);
-
- for (int i = 0; i < updateList.Length; i += 8)
- {
- Span chunk = updateList.Slice(i, 8);
- Span decrypted = XTEA.Decipher(16, MemoryMarshal.Cast(chunk).ToArray(), DecryptionKey);
- Span resource = MemoryMarshal.AsBytes(decrypted);
- resource.CopyTo(chunk);
- }
-
- Document = Encoding.UTF8.GetString(updateList.ToArray());
- }
+ Span updateList = File.ReadAllBytes(FilePath);
- ///
- /// Sets the decryption key for the updatelist decryption
- ///
- /// Decryption key
- public void SetDecryptionKey(uint[] key)
+ for (int i = 0; i < updateList.Length; i += 8)
{
- DecryptionKey = key;
+ Span chunk = updateList.Slice(i, 8);
+ Span decrypted = XTEA.Decipher(16, MemoryMarshal.Cast(chunk).ToArray(), DecryptionKey);
+ Span resource = MemoryMarshal.AsBytes(decrypted);
+ resource.CopyTo(chunk);
}
+
+ Document = Encoding.UTF8.GetString(updateList.ToArray());
+ }
+
+ ///
+ /// Sets the decryption key for the updatelist decryption
+ ///
+ /// Decryption key
+ public void SetDecryptionKey(uint[] key)
+ {
+ DecryptionKey = key;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.Utilities/Compression/LZ77.cs b/PangLib.Utilities/Compression/LZ77.cs
index 510f613..2430b8c 100644
--- a/PangLib.Utilities/Compression/LZ77.cs
+++ b/PangLib.Utilities/Compression/LZ77.cs
@@ -1,80 +1,79 @@
using System;
-namespace PangLib.Utilities.Compression
+namespace PangLib.Utilities.Compression;
+
+///
+/// Main LZ77 compression class
+///
+public static class LZ77
{
///
- /// Main LZ77 compression class
+ /// This method decompresses a given bytearray from LZ77
+ ///
+ /// It also includes the handling of a custom implementation
+ /// which just XORs certain values as an added security mechanism
+ ///
+ /// This implementation is based on the C++ code of DaveDevils/PangTools:
+ /// https://github.com/davedevils/PangTools/blob/master/Tools/PAK%20-%20Unpack-Pack/Pak-Pangya/Pak-Pangya.cpp
///
- public static class LZ77
+ /// Compressed data
+ /// Size of compressed data
+ /// Size of the uncompressed data
+ /// Compression type, valid types are 1 (regular) and 3 (custom)
+ /// Uncompressed data
+ public static byte[] Decompress (byte[] data, uint dataSize, uint realDataSize, byte type)
{
- ///
- /// This method decompresses a given bytearray from LZ77
- ///
- /// It also includes the handling of a custom implementation
- /// which just XORs certain values as an added security mechanism
- ///
- /// This implementation is based on the C++ code of DaveDevils/PangTools:
- /// https://github.com/davedevils/PangTools/blob/master/Tools/PAK%20-%20Unpack-Pack/Pak-Pangya/Pak-Pangya.cpp
- ///
- /// Compressed data
- /// Size of compressed data
- /// Size of the uncompressed data
- /// Compression type, valid types are 1 (regular) and 3 (custom)
- /// Uncompressed data
- public static byte[] Decompress (byte[] data, uint dataSize, uint realDataSize, byte type)
- {
- ushort[] LZ77Masks = new ushort[] { 65313, 33615, 26463, 52, 62007, 33119, 18277, 563};
+ ushort[] LZ77Masks = new ushort[] { 65313, 33615, 26463, 52, 62007, 33119, 18277, 563};
- byte OriginalMask = 0;
- byte Mask = 0;
- int CountByte = 0;
- int Size = 0;
- int Offset, OffsetSize;
+ byte OriginalMask = 0;
+ byte Mask = 0;
+ int CountByte = 0;
+ int Size = 0;
+ int Offset, OffsetSize;
- byte[] dataDestination = new byte[realDataSize];
+ byte[] dataDestination = new byte[realDataSize];
- for (int i = 0; i < dataSize;)
+ for (int i = 0; i < dataSize;)
+ {
+ if (CountByte == 0)
{
- if (CountByte == 0)
- {
- Mask = data[i++];
- OriginalMask = Mask;
+ Mask = data[i++];
+ OriginalMask = Mask;
- if (type == 3) {
- Mask ^= 0xC8;
- }
- }
- else
- {
- Mask >>= 1;
+ if (type == 3) {
+ Mask ^= 0xC8;
}
+ }
+ else
+ {
+ Mask >>= 1;
+ }
- if ((Mask & 1) == 1)
- {
- ushort tmpShort = BitConverter.ToUInt16(data, i);
- i += 2;
-
- if (type == 3)
- {
- tmpShort ^= LZ77Masks[(OriginalMask >> 3) & 7];
- }
-
- Offset = tmpShort & 0x0FFF;
- OffsetSize = (tmpShort >> 0x0C) + 2;
-
- Array.Copy(dataDestination, Size - Offset, dataDestination, Size, OffsetSize);
+ if ((Mask & 1) == 1)
+ {
+ ushort tmpShort = BitConverter.ToUInt16(data, i);
+ i += 2;
- Size += OffsetSize;
- }
- else
+ if (type == 3)
{
- dataDestination[Size++] = data[i++];
+ tmpShort ^= LZ77Masks[(OriginalMask >> 3) & 7];
}
- CountByte = (CountByte + 1) & 7;
+ Offset = tmpShort & 0x0FFF;
+ OffsetSize = (tmpShort >> 0x0C) + 2;
+
+ Array.Copy(dataDestination, Size - Offset, dataDestination, Size, OffsetSize);
+
+ Size += OffsetSize;
+ }
+ else
+ {
+ dataDestination[Size++] = data[i++];
}
- return dataDestination;
+ CountByte = (CountByte + 1) & 7;
}
+
+ return dataDestination;
}
}
\ No newline at end of file
diff --git a/PangLib.Utilities/Cryptography/XOR.cs b/PangLib.Utilities/Cryptography/XOR.cs
index 829cf9b..6f7bc6b 100644
--- a/PangLib.Utilities/Cryptography/XOR.cs
+++ b/PangLib.Utilities/Cryptography/XOR.cs
@@ -1,26 +1,25 @@
using System;
-namespace PangLib.Utilities.Cryptography
+namespace PangLib.Utilities.Cryptography;
+
+///
+/// Main XOR cipher class
+///
+public static class XOR
{
///
- /// Main XOR cipher class
+ /// XORs the given bytes with the given key
///
- public static class XOR
+ /// Data to be ciphered
+ /// Key to cipher the data with
+ /// Cuphered data
+ public static byte[] Cipher(byte[] data, uint key)
{
- ///
- /// XORs the given bytes with the given key
- ///
- /// Data to be ciphered
- /// Key to cipher the data with
- /// Cuphered data
- public static byte[] Cipher(byte[] data, uint key)
+ for (int i = 0; i < data.Length; i++)
{
- for (int i = 0; i < data.Length; i++)
- {
- data[i] ^= (byte)key;
- }
-
- return data;
+ data[i] ^= (byte)key;
}
+
+ return data;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.Utilities/Cryptography/XTEA.cs b/PangLib.Utilities/Cryptography/XTEA.cs
index 815ed6d..6209b0f 100644
--- a/PangLib.Utilities/Cryptography/XTEA.cs
+++ b/PangLib.Utilities/Cryptography/XTEA.cs
@@ -1,62 +1,61 @@
-namespace PangLib.Utilities.Cryptography
+namespace PangLib.Utilities.Cryptography;
+
+///
+/// Main XTEA cipher class
+///
+public static class XTEA
{
///
- /// Main XTEA cipher class
+ /// Enciphers the given data with the given key with given rounds
///
- public static class XTEA
+ /// Number of rounds the data should be enciphered
+ /// Array of 2 32-bit sized data blocks to be enciphered
+ /// Array of 4 32-bit sized key blocks to encipher the data with
+ /// Enciphered data
+ public static uint[] Encipher(int rounds, uint[] data, uint[] key)
{
- ///
- /// Enciphers the given data with the given key with given rounds
- ///
- /// Number of rounds the data should be enciphered
- /// Array of 2 32-bit sized data blocks to be enciphered
- /// Array of 4 32-bit sized key blocks to encipher the data with
- /// Enciphered data
- public static uint[] Encipher(int rounds, uint[] data, uint[] key)
+ uint delta = 0x61C88647;
+ uint sum = 0;
+ uint data0 = data[0];
+ uint data1 = data[1];
+
+ for (int i = 0; i < rounds; i++)
{
- uint delta = 0x61C88647;
- uint sum = 0;
- uint data0 = data[0];
- uint data1 = data[1];
-
- for (int i = 0; i < rounds; i++)
- {
- data0 += (((data1 << 4) ^ (data1 >> 5)) + data1) ^ (sum + key[sum & 3]);
- sum -= delta;
- data1 += (((data0 << 4) ^ (data0 >> 5)) + data0) ^ (sum + key[(sum >> 11) & 3]);
- }
-
- data[0] = data0;
- data[1] = data1;
-
- return data;
+ data0 += (((data1 << 4) ^ (data1 >> 5)) + data1) ^ (sum + key[sum & 3]);
+ sum -= delta;
+ data1 += (((data0 << 4) ^ (data0 >> 5)) + data0) ^ (sum + key[(sum >> 11) & 3]);
}
- ///
- /// Deciphers the given data with the given key with given rounds
- ///
- /// Number of rounds the data should be deciphered
- /// Array of 2 32-bit sized data blocks to be deciphered
- /// Array of 4 32-bit sized key blocks to decipher the data with
- /// Deciphered data
- public static uint[] Decipher(int rounds, uint[] data, uint[] key)
+ data[0] = data0;
+ data[1] = data1;
+
+ return data;
+ }
+
+ ///
+ /// Deciphers the given data with the given key with given rounds
+ ///
+ /// Number of rounds the data should be deciphered
+ /// Array of 2 32-bit sized data blocks to be deciphered
+ /// Array of 4 32-bit sized key blocks to decipher the data with
+ /// Deciphered data
+ public static uint[] Decipher(int rounds, uint[] data, uint[] key)
+ {
+ uint delta = 0x61C88647;
+ uint sum = 0xE3779B90;
+ uint data0 = data[0];
+ uint data1 = data[1];
+
+ for (int i = 0; i < rounds; i++)
{
- uint delta = 0x61C88647;
- uint sum = 0xE3779B90;
- uint data0 = data[0];
- uint data1 = data[1];
-
- for (int i = 0; i < rounds; i++)
- {
- data1 -= (((data0 << 4) ^ (data0 >> 5)) + data0) ^ (sum + key[(sum >> 11) & 3]);
- sum += delta;
- data0 -= (((data1 << 4) ^ (data1 >> 5)) + data1) ^ (sum + key[sum & 3]);
- }
-
- data[0] = data0;
- data[1] = data1;
-
- return data;
+ data1 -= (((data0 << 4) ^ (data0 >> 5)) + data0) ^ (sum + key[(sum >> 11) & 3]);
+ sum += delta;
+ data0 -= (((data1 << 4) ^ (data1 >> 5)) + data1) ^ (sum + key[sum & 3]);
}
+
+ data[0] = data0;
+ data[1] = data1;
+
+ return data;
}
-}
+}
\ No newline at end of file
diff --git a/PangLib.Utilities/PangLib.Utilities.csproj b/PangLib.Utilities/PangLib.Utilities.csproj
index 5f01b30..157f5a0 100644
--- a/PangLib.Utilities/PangLib.Utilities.csproj
+++ b/PangLib.Utilities/PangLib.Utilities.csproj
@@ -13,6 +13,8 @@
https://raw.githubusercontent.com/pangyatools/PangLib/master/.github/Images/pang.png
netstandard2.0
+
+ 12
diff --git a/PangLib.WEP/ExtensionMethods.cs b/PangLib.WEP/ExtensionMethods.cs
index defd0b2..a2d0bbe 100644
--- a/PangLib.WEP/ExtensionMethods.cs
+++ b/PangLib.WEP/ExtensionMethods.cs
@@ -3,113 +3,112 @@
using System.Text;
using PangLib.WEP.Models;
-namespace PangLib.WEP
+namespace PangLib.WEP;
+
+public static class ExtensionMethods
{
- public static class ExtensionMethods
+ ///
+ /// Read a string from a fixed amount of bytes
+ ///
+ /// BinaryReader instance
+ /// String length
+ /// String encoding
+ /// The read string
+ public static string ReadFixedString(this BinaryReader reader, int length, Encoding encoding = null)
{
- ///
- /// Read a string from a fixed amount of bytes
- ///
- /// BinaryReader instance
- /// String length
- /// String encoding
- /// The read string
- public static string ReadFixedString(this BinaryReader reader, int length, Encoding encoding = null)
+ if (encoding == null)
{
- if (encoding == null)
- {
- encoding = Encoding.GetEncoding(51949);
- }
+ encoding = Encoding.GetEncoding(51949);
+ }
- char[] chars = reader.ReadChars(length).TakeWhile(c => c != 0x00).ToArray();
- byte[] bytes = encoding.GetBytes(chars);
+ char[] chars = reader.ReadChars(length).TakeWhile(c => c != 0x00).ToArray();
+ byte[] bytes = encoding.GetBytes(chars);
- return encoding.GetString(bytes);
- }
+ return encoding.GetString(bytes);
+ }
- ///
- /// Read a pascal-style string
- ///
- /// BinaryReader instance
- /// String encoding
- /// The read string
- public static string ReadPascalString(this BinaryReader reader, Encoding encoding = null)
- {
- int length = reader.ReadInt32();
- return ReadFixedString(reader, length, encoding);
- }
+ ///
+ /// Read a pascal-style string
+ ///
+ /// BinaryReader instance
+ /// String encoding
+ /// The read string
+ public static string ReadPascalString(this BinaryReader reader, Encoding encoding = null)
+ {
+ int length = reader.ReadInt32();
+ return ReadFixedString(reader, length, encoding);
+ }
- ///
- /// Read a vector from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Vector structure
- public static Vector3 ReadVector3(this BinaryReader reader)
+ ///
+ /// Read a vector from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Vector structure
+ public static Vector3 ReadVector3(this BinaryReader reader)
+ {
+ return new Vector3
{
- return new Vector3
- {
- X = reader.ReadSingle(),
- Y = reader.ReadSingle(),
- Z = reader.ReadSingle()
- };
- }
+ X = reader.ReadSingle(),
+ Y = reader.ReadSingle(),
+ Z = reader.ReadSingle()
+ };
+ }
- ///
- /// Read extra values from the current stream
- ///
- /// BinaryReader instance
- /// The parsed extra values
- public static ExtraValues ReadExtraValues(this BinaryReader reader)
+ ///
+ /// Read extra values from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed extra values
+ public static ExtraValues ReadExtraValues(this BinaryReader reader)
+ {
+ return new ExtraValues
{
- return new ExtraValues
- {
- GUID = reader.ReadInt32(),
- Unknown = reader.ReadInt32()
- };
- }
+ GUID = reader.ReadInt32(),
+ Unknown = reader.ReadInt32()
+ };
+ }
- ///
- /// Read an area from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Area structure
- public static Area ReadArea(this BinaryReader reader)
+ ///
+ /// Read an area from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Area structure
+ public static Area ReadArea(this BinaryReader reader)
+ {
+ return new Area
{
- return new Area
- {
- Min = reader.ReadVector3(),
- Max = reader.ReadVector3()
- };
- }
+ Min = reader.ReadVector3(),
+ Max = reader.ReadVector3()
+ };
+ }
- ///
- /// Read a matrix from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Matrix structure
- public static Matrix ReadMatrix(this BinaryReader reader)
+ ///
+ /// Read a matrix from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Matrix structure
+ public static Matrix ReadMatrix(this BinaryReader reader)
+ {
+ return new Matrix
{
- return new Matrix
- {
- Column1 = reader.ReadVector3(),
- Column2 = reader.ReadVector3(),
- Column3 = reader.ReadVector3(),
- Column4 = reader.ReadVector3()
- };
- }
+ Column1 = reader.ReadVector3(),
+ Column2 = reader.ReadVector3(),
+ Column3 = reader.ReadVector3(),
+ Column4 = reader.ReadVector3()
+ };
+ }
- ///
- /// Read a point from the current stream
- ///
- /// BinaryReader instance
- /// The parsed Point structure
- public static Point ReadPoint(this BinaryReader reader)
+ ///
+ /// Read a point from the current stream
+ ///
+ /// BinaryReader instance
+ /// The parsed Point structure
+ public static Point ReadPoint(this BinaryReader reader)
+ {
+ return new Point
{
- return new Point
- {
- X = reader.ReadSingle(),
- Z = reader.ReadSingle()
- };
- }
+ X = reader.ReadSingle(),
+ Z = reader.ReadSingle()
+ };
}
}
\ No newline at end of file
diff --git a/PangLib.WEP/Helpers/AreaNodeReader.cs b/PangLib.WEP/Helpers/AreaNodeReader.cs
index 2abd018..9f2213f 100644
--- a/PangLib.WEP/Helpers/AreaNodeReader.cs
+++ b/PangLib.WEP/Helpers/AreaNodeReader.cs
@@ -2,41 +2,40 @@
using System.IO;
using PangLib.WEP.Models;
-namespace PangLib.WEP.Helpers
+namespace PangLib.WEP.Helpers;
+
+///
+/// Helper class to read structures from WEP files
+///
+public class AreaNodeReader
{
///
- /// Helper class to read structures from WEP files
+ /// Helper method to read all area nodes from a WEP file and return a list of them
///
- public class AreaNodeReader
+ /// BinaryReader instance
+ /// Version of the WEP file
+ /// Count of area nodes
+ /// List of area nodes from the WEP file
+ public static List ReadAllAreaNodes(BinaryReader reader, int version, int count)
{
- ///
- /// Helper method to read all area nodes from a WEP file and return a list of them
- ///
- /// BinaryReader instance
- /// Version of the WEP file
- /// Count of area nodes
- /// List of area nodes from the WEP file
- public static List ReadAllAreaNodes(BinaryReader reader, int version, int count)
- {
- List areaNodes = new List();
+ List