diff --git a/BinaryObjectScanner.Printing/BDPlusSVM.cs b/BinaryObjectScanner.Printing/BDPlusSVM.cs new file mode 100644 index 00000000..8ebadc49 --- /dev/null +++ b/BinaryObjectScanner.Printing/BDPlusSVM.cs @@ -0,0 +1,24 @@ +using System; +using System.Text; +using SabreTools.Models.BDPlus; + +namespace BinaryObjectScanner.Printing +{ + public static class BDPlusSVM + { + public static void Print(StringBuilder builder, SVM svm) + { + builder.AppendLine("BD+ SVM Information:"); + builder.AppendLine("-------------------------"); + builder.AppendLine($"Signature: {svm.Signature}"); + builder.AppendLine($"Unknown 1: {(svm.Unknown1 == null ? "[NULL]" : BitConverter.ToString(svm.Unknown1).Replace('-', ' '))}"); + builder.AppendLine($"Year: {svm.Year} (0x{svm.Year:X})"); + builder.AppendLine($"Month: {svm.Month} (0x{svm.Month:X})"); + builder.AppendLine($"Day: {svm.Day} (0x{svm.Day:X})"); + builder.AppendLine($"Unknown 2: {(svm.Unknown2 == null ? "[NULL]" : BitConverter.ToString(svm.Unknown2).Replace('-', ' '))}"); + builder.AppendLine($"Length: {svm.Length} (0x{svm.Length:X})"); + //builder.AppendLine($" Data: {(svm.Data == null ? "[NULL]" : BitConverter.ToString(svm.Data).Replace('-', ' '))}"); + builder.AppendLine(); + } + } +} \ No newline at end of file diff --git a/BinaryObjectScanner.Wrappers/BDPlusSVM.cs b/BinaryObjectScanner.Wrappers/BDPlusSVM.cs index c49c55e0..755526c9 100644 --- a/BinaryObjectScanner.Wrappers/BDPlusSVM.cs +++ b/BinaryObjectScanner.Wrappers/BDPlusSVM.cs @@ -1,10 +1,10 @@ -using System; using System.IO; using System.Text; +using SabreTools.Models.BDPlus; namespace BinaryObjectScanner.Wrappers { - public class BDPlusSVM : WrapperBase + public class BDPlusSVM : WrapperBase { #region Descriptive Properties @@ -61,9 +61,9 @@ namespace BinaryObjectScanner.Wrappers /// #if NET48 - public BDPlusSVM(SabreTools.Models.BDPlus.SVM model, byte[] data, int offset) + public BDPlusSVM(SVM model, byte[] data, int offset) #else - public BDPlusSVM(SabreTools.Models.BDPlus.SVM? model, byte[]? data, int offset) + public BDPlusSVM(SVM? model, byte[]? data, int offset) #endif : base(model, data, offset) { @@ -72,9 +72,9 @@ namespace BinaryObjectScanner.Wrappers /// #if NET48 - public BDPlusSVM(SabreTools.Models.BDPlus.SVM model, Stream data) + public BDPlusSVM(SVM model, Stream data) #else - public BDPlusSVM(SabreTools.Models.BDPlus.SVM? model, Stream? data) + public BDPlusSVM(SVM? model, Stream? data) #endif : base(model, data) { @@ -143,35 +143,10 @@ namespace BinaryObjectScanner.Wrappers public override StringBuilder PrettyPrint() { StringBuilder builder = new StringBuilder(); - - builder.AppendLine("BD+ Information:"); - builder.AppendLine("-------------------------"); - builder.AppendLine(); - - PrintSVM(builder); - + Printing.BDPlusSVM.Print(builder, _model); return builder; } - /// - /// Print SVM information - /// - /// StringBuilder to append information to - private void PrintSVM(StringBuilder builder) - { - builder.AppendLine(" SVM Information:"); - builder.AppendLine(" -------------------------"); - builder.AppendLine($" Signature: {Signature}"); - builder.AppendLine($" Unknown 1: {(Unknown1 == null ? "[NULL]" : BitConverter.ToString(Unknown1).Replace('-', ' '))}"); - builder.AppendLine($" Year: {Year} (0x{Year:X})"); - builder.AppendLine($" Month: {Month} (0x{Month:X})"); - builder.AppendLine($" Day: {Day} (0x{Day:X})"); - builder.AppendLine($" Unknown 2: {(Unknown2 == null ? "[NULL]" : BitConverter.ToString(Unknown2).Replace('-', ' '))}"); - builder.AppendLine($" Length: {Length} (0x{Length:X})"); - //builder.AppendLine($" Data: {(Data == null ? "[NULL]" : BitConverter.ToString(Data).Replace('-', ' '))}"); - builder.AppendLine(); - } - #if NET6_0_OR_GREATER ///