diff --git a/SabreTools.Serialization/Wrappers/GCF.cs b/SabreTools.Serialization/Wrappers/GCF.cs
index 598e9f83..323fae83 100644
--- a/SabreTools.Serialization/Wrappers/GCF.cs
+++ b/SabreTools.Serialization/Wrappers/GCF.cs
@@ -1,7 +1,5 @@
using System.Collections.Generic;
using System.IO;
-using SabreTools.Models.CHD;
-using SabreTools.Models.CueSheets;
namespace SabreTools.Serialization.Wrappers
{
diff --git a/SabreTools.Serialization/Wrappers/LinearExecutable.cs b/SabreTools.Serialization/Wrappers/LinearExecutable.cs
index 78e439ec..0f057e35 100644
--- a/SabreTools.Serialization/Wrappers/LinearExecutable.cs
+++ b/SabreTools.Serialization/Wrappers/LinearExecutable.cs
@@ -26,12 +26,14 @@ namespace SabreTools.Serialization.Wrappers
: base(model, data)
{
// All logic is handled by the base class
- }///
- /// Create an LE/LX executable from a byte array and offset
- ///
- /// Byte array representing the executable
- /// Offset within the array to parse
- /// An LE/LX executable wrapper on success, null on failure
+ }
+
+ ///
+ /// Create an LE/LX executable from a byte array and offset
+ ///
+ /// Byte array representing the executable
+ /// Offset within the array to parse
+ /// An LE/LX executable wrapper on success, null on failure
public static LinearExecutable? Create(byte[]? data, int offset)
{
// If the data is invalid
diff --git a/SabreTools.Serialization/Wrappers/MSDOS.cs b/SabreTools.Serialization/Wrappers/MSDOS.cs
index e70b8ccf..b275439e 100644
--- a/SabreTools.Serialization/Wrappers/MSDOS.cs
+++ b/SabreTools.Serialization/Wrappers/MSDOS.cs
@@ -25,12 +25,14 @@ namespace SabreTools.Serialization.Wrappers
: base(model, data)
{
// All logic is handled by the base class
- }///
- /// Create an MS-DOS executable from a byte array and offset
- ///
- /// Byte array representing the executable
- /// Offset within the array to parse
- /// An MS-DOS executable wrapper on success, null on failure
+ }
+
+ ///
+ /// Create an MS-DOS executable from a byte array and offset
+ ///
+ /// Byte array representing the executable
+ /// Offset within the array to parse
+ /// An MS-DOS executable wrapper on success, null on failure
public static MSDOS? Create(byte[]? data, int offset)
{
// If the data is invalid
diff --git a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
index a021e4a4..af874b2f 100644
--- a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
+++ b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
@@ -27,13 +27,13 @@ namespace SabreTools.Serialization.Wrappers
{
// All logic is handled by the base class
}
-
+
///
- /// Create a Microsoft Cabinet from a byte array and offset
- ///
- /// Byte array representing the cabinet
- /// Offset within the array to parse
- /// A cabinet wrapper on success, null on failure
+ /// Create a Microsoft Cabinet from a byte array and offset
+ ///
+ /// Byte array representing the cabinet
+ /// Offset within the array to parse
+ /// A cabinet wrapper on success, null on failure
public static MicrosoftCabinet? Create(byte[]? data, int offset)
{
// If the data is invalid
diff --git a/SabreTools.Serialization/Wrappers/MoPaQ.cs b/SabreTools.Serialization/Wrappers/MoPaQ.cs
index 43cf9990..89a9822f 100644
--- a/SabreTools.Serialization/Wrappers/MoPaQ.cs
+++ b/SabreTools.Serialization/Wrappers/MoPaQ.cs
@@ -27,13 +27,13 @@ namespace SabreTools.Serialization.Wrappers
{
// All logic is handled by the base class
}
-
+
///
- /// Create a Microsoft Cabinet from a byte array and offset
- ///
- /// Byte array representing the cabinet
- /// Offset within the array to parse
- /// A cabinet wrapper on success, null on failure
+ /// Create a MoPaQ archive from a byte array and offset
+ ///
+ /// Byte array representing the archive
+ /// Offset within the array to parse
+ /// A MoPaQ archive wrapper on success, null on failure
public static MoPaQ? Create(byte[]? data, int offset)
{
// If the data is invalid
@@ -50,10 +50,10 @@ namespace SabreTools.Serialization.Wrappers
}
///
- /// Create a Microsoft Cabinet from a Stream
+ /// Create a MoPaQ archive from a Stream
///
- /// Stream representing the cabinet
- /// A cabinet wrapper on success, null on failure
+ /// Stream representing the archive
+ /// A MoPaQ archive wrapper on success, null on failure
public static MoPaQ? Create(Stream? data)
{
// If the data is invalid
diff --git a/SabreTools.Serialization/Wrappers/PFF.cs b/SabreTools.Serialization/Wrappers/PFF.cs
index 0f0d2c1f..736b952a 100644
--- a/SabreTools.Serialization/Wrappers/PFF.cs
+++ b/SabreTools.Serialization/Wrappers/PFF.cs
@@ -1,5 +1,4 @@
using System.IO;
-using System.Text;
namespace SabreTools.Serialization.Wrappers
{
@@ -26,12 +25,14 @@ namespace SabreTools.Serialization.Wrappers
: base(model, data)
{
// All logic is handled by the base class
- }///
- /// Create a PFF archive from a byte array and offset
- ///
- /// Byte array representing the archive
- /// Offset within the array to parse
- /// A PFF archive wrapper on success, null on failure
+ }
+
+ ///
+ /// Create a PFF archive from a byte array and offset
+ ///
+ /// Byte array representing the archive
+ /// Offset within the array to parse
+ /// A PFF archive wrapper on success, null on failure
public static PFF? Create(byte[]? data, int offset)
{
// If the data is invalid
diff --git a/SabreTools.Serialization/Wrappers/PIC.cs b/SabreTools.Serialization/Wrappers/PIC.cs
new file mode 100644
index 00000000..c9669fc9
--- /dev/null
+++ b/SabreTools.Serialization/Wrappers/PIC.cs
@@ -0,0 +1,79 @@
+using System.IO;
+
+namespace SabreTools.Serialization.Wrappers
+{
+ // TODO: Figure out extension properties
+ public class PIC : WrapperBase
+ {
+ #region Descriptive Properties
+
+ ///
+ public override string DescriptionString => "Disc Information";
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ public PIC(Models.PIC.DiscInformation? model, byte[]? data, int offset)
+ : base(model, data, offset)
+ {
+ // All logic is handled by the base class
+ }
+
+ ///
+ public PIC(Models.PIC.DiscInformation? model, Stream? data)
+ : base(model, data)
+ {
+ // All logic is handled by the base class
+ }
+
+ ///
+ /// Create a PIC disc information object from a byte array and offset
+ ///
+ /// Byte array representing the information
+ /// Offset within the array to parse
+ /// A PIC disc information wrapper on success, null on failure
+ public static PIC? Create(byte[]? data, int offset)
+ {
+ // If the data is invalid
+ if (data == null)
+ return null;
+
+ // If the offset is out of bounds
+ if (offset < 0 || offset >= data.Length)
+ return null;
+
+ // Create a memory stream and use that
+ var dataStream = new MemoryStream(data, offset, data.Length - offset);
+ return Create(dataStream);
+ }
+
+ ///
+ /// Create a PIC disc information object from a Stream
+ ///
+ /// Stream representing the information
+ /// A PIC disc information wrapper on success, null on failure
+ public static PIC? Create(Stream? data)
+ {
+ // If the data is invalid
+ if (data == null || data.Length == 0 || !data.CanSeek || !data.CanRead)
+ return null;
+
+ var archive = Deserializers.PIC.DeserializeStream(data);
+ if (archive == null)
+ return null;
+
+ try
+ {
+ return new PIC(archive, data);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file