diff --git a/SabreTools.Serialization/Models/GZIP/Archive.cs b/SabreTools.Serialization/Models/GZIP/Archive.cs
index 5048bd6c..8c994ce9 100644
--- a/SabreTools.Serialization/Models/GZIP/Archive.cs
+++ b/SabreTools.Serialization/Models/GZIP/Archive.cs
@@ -1,18 +1,18 @@
namespace SabreTools.Data.Models.GZIP
{
- ///
+ ///
public sealed class Archive
{
///
/// Header including optional fields
///
- public Header? Header { get; set; }
+ public Header Header { get; set; }
// Compressed blocks live here
///
/// Trailer
///
- public Trailer? Trailer { get; set; }
+ public Trailer Trailer { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/GZIP/Constants.cs b/SabreTools.Serialization/Models/GZIP/Constants.cs
index 59809828..682535c5 100644
--- a/SabreTools.Serialization/Models/GZIP/Constants.cs
+++ b/SabreTools.Serialization/Models/GZIP/Constants.cs
@@ -1,6 +1,6 @@
namespace SabreTools.Data.Models.GZIP
{
- ///
+ ///
public static class Constants
{
public const byte ID1 = 0x1F;
@@ -11,4 +11,4 @@ namespace SabreTools.Data.Models.GZIP
public static readonly byte[] TorrentGZHeader = [0x1F, 0x8B, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00];
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/GZIP/Enums.cs b/SabreTools.Serialization/Models/GZIP/Enums.cs
index cb7c81d0..b3c7048a 100644
--- a/SabreTools.Serialization/Models/GZIP/Enums.cs
+++ b/SabreTools.Serialization/Models/GZIP/Enums.cs
@@ -2,7 +2,7 @@ using System;
namespace SabreTools.Data.Models.GZIP
{
- ///
+ ///
public enum CompressionMethod : byte
{
RESERVED0 = 0,
@@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.GZIP
Deflate = 8,
}
- ///
+ ///
[Flags]
public enum ExtraFlags : byte
{
@@ -32,7 +32,7 @@ namespace SabreTools.Data.Models.GZIP
FastestAlgorithm = 0x04,
}
- ///
+ ///
[Flags]
public enum Flags : byte
{
@@ -66,7 +66,7 @@ namespace SabreTools.Data.Models.GZIP
RESERVED7 = 0x80,
}
- ///
+ ///
public enum OperatingSystem : byte
{
///
@@ -144,4 +144,4 @@ namespace SabreTools.Data.Models.GZIP
///
Unknown = 255,
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/GZIP/Header.cs b/SabreTools.Serialization/Models/GZIP/Header.cs
index 84e8a9bf..83fdfa11 100644
--- a/SabreTools.Serialization/Models/GZIP/Header.cs
+++ b/SabreTools.Serialization/Models/GZIP/Header.cs
@@ -1,6 +1,6 @@
namespace SabreTools.Data.Models.GZIP
{
- ///
+ ///
public sealed class Header
{
///
@@ -25,7 +25,7 @@ namespace SabreTools.Data.Models.GZIP
///
/// Modification TIME
- ///
+ ///
/// This gives the most recent modification time of the original
/// file being compressed. The time is in Unix format, i.e.,
/// seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this
@@ -44,7 +44,7 @@ namespace SabreTools.Data.Models.GZIP
///
/// Operating System
- ///
+ ///
/// This identifies the type of file system on which compression
/// took place. This may be useful in determining end-of-line
/// convention for text files.
@@ -53,7 +53,7 @@ namespace SabreTools.Data.Models.GZIP
///
/// eXtra LENgth
- ///
+ ///
/// If FLG.FEXTRA is set, this gives the length of the optional
/// extra field.
///
@@ -61,7 +61,7 @@ namespace SabreTools.Data.Models.GZIP
///
/// Extra field
- ///
+ ///
/// If the FLG.FEXTRA bit is set, an "extra field" is present in
/// the header, with total length XLEN bytes. It consists of a
/// series of subfields, each of the form .
@@ -71,7 +71,7 @@ namespace SabreTools.Data.Models.GZIP
///
/// Extra field
- ///
+ ///
/// If the FLG.FEXTRA bit is set, an "extra field" is present in
/// the header, with total length XLEN bytes. It consists of a
/// series of subfields, each of the form .
@@ -96,4 +96,4 @@ namespace SabreTools.Data.Models.GZIP
///
public ushort? CRC16 { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/GZIP/Trailer.cs b/SabreTools.Serialization/Models/GZIP/Trailer.cs
index bfc4b17f..b85e127f 100644
--- a/SabreTools.Serialization/Models/GZIP/Trailer.cs
+++ b/SabreTools.Serialization/Models/GZIP/Trailer.cs
@@ -1,11 +1,11 @@
namespace SabreTools.Data.Models.GZIP
{
- ///
+ ///
public sealed class Trailer
{
///
/// CRC-32
- ///
+ ///
/// This contains a Cyclic Redundancy Check value of the
/// uncompressed data computed according to CRC-32 algorithm
/// used in the ISO 3309 standard and in section 8.1.1.6.2 of
@@ -17,10 +17,10 @@ namespace SabreTools.Data.Models.GZIP
///
/// Input SIZE
- ///
+ ///
/// This contains the size of the original (uncompressed) input
/// data modulo 2^32.
///
public uint InputSize { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Wrappers/GZip.Printing.cs b/SabreTools.Serialization/Wrappers/GZip.Printing.cs
index 6ace9da1..57ec33f0 100644
--- a/SabreTools.Serialization/Wrappers/GZip.Printing.cs
+++ b/SabreTools.Serialization/Wrappers/GZip.Printing.cs
@@ -22,17 +22,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.Trailer);
}
- private static void Print(StringBuilder builder, Header? header)
+ private static void Print(StringBuilder builder, Header header)
{
builder.AppendLine(" Header:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No header");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(header.ID1, " ID1");
builder.AppendLine(header.ID2, " ID1");
builder.AppendLine($" Compression method: {header.CompressionMethod} (0x{(byte)header.CompressionMethod:X2})");
@@ -71,17 +64,10 @@ namespace SabreTools.Serialization.Wrappers
}
}
- private static void Print(StringBuilder builder, Trailer? trailer)
+ private static void Print(StringBuilder builder, Trailer trailer)
{
builder.AppendLine(" Trailer:");
builder.AppendLine(" -------------------------");
- if (trailer == null)
- {
- builder.AppendLine(" No trailer");
- builder.AppendLine();
- return;
- }
-
builder.AppendLine(trailer.CRC32, " CRC-32");
builder.AppendLine(trailer.InputSize, " Input size");
builder.AppendLine();
diff --git a/SabreTools.Serialization/Wrappers/GZip.cs b/SabreTools.Serialization/Wrappers/GZip.cs
index c21d10cc..d7e81289 100644
--- a/SabreTools.Serialization/Wrappers/GZip.cs
+++ b/SabreTools.Serialization/Wrappers/GZip.cs
@@ -24,7 +24,7 @@ namespace SabreTools.Serialization.Wrappers
get
{
// Only valid for Torrent GZip
- if (Header == null || !IsTorrentGZip)
+ if (!IsTorrentGZip)
return null;
// CRC-32 is the second packed field
@@ -42,7 +42,7 @@ namespace SabreTools.Serialization.Wrappers
get
{
// Only valid for Torrent GZip
- if (Header == null || !IsTorrentGZip)
+ if (!IsTorrentGZip)
return null;
// MD5 is the first packed field
@@ -60,7 +60,7 @@ namespace SabreTools.Serialization.Wrappers
get
{
// Only valid for Torrent GZip
- if (Header == null || !IsTorrentGZip)
+ if (!IsTorrentGZip)
return 0;
// MD5 is the first packed field
@@ -80,9 +80,6 @@ namespace SabreTools.Serialization.Wrappers
if (_dataOffset > -1)
return _dataOffset;
- if (Header == null)
- return -1;
-
// Minimum offset is 10 bytes:
// - ID1 (1)
// - ID2 (1)
@@ -107,7 +104,7 @@ namespace SabreTools.Serialization.Wrappers
}
///
- public Header? Header => Model.Header;
+ public Header Header => Model.Header;
///
/// Indicates if the archive is in the standard
@@ -119,10 +116,6 @@ namespace SabreTools.Serialization.Wrappers
{
get
{
- // If the header is invalid
- if (Header == null)
- return false;
-
// Torrent GZip uses normal deflate, not GZIP deflate
if (Header.CompressionMethod != CompressionMethod.Deflate)
return false;
@@ -155,7 +148,7 @@ namespace SabreTools.Serialization.Wrappers
}
///
- public Trailer? Trailer => Model.Trailer;
+ public Trailer Trailer => Model.Trailer;
#endregion