Files
2026-05-18 10:24:30 -04:00

50 lines
1.8 KiB
C#

using System.Text;
using SabreTools.Data.Models.XboxISO;
using SabreTools.Text.Extensions;
namespace SabreTools.Wrappers
{
public partial class XboxISO : IPrintable
{
#if NETCOREAPP
/// <inheritdoc/>
public string ExportJSON(bool recursive) => System.Text.Json.JsonSerializer.Serialize(Model, _jsonSerializerOptions);
#else
/// <inheritdoc/>
public string ExportJSON(bool recursive) => Newtonsoft.Json.JsonConvert.SerializeObject(Model, _jsonSerializerOptions);
#endif
/// <inheritdoc/>
public void PrintInformation(StringBuilder builder, bool recursive)
{
builder.AppendLine("Xbox / Xbox 360 Disc Image Information:");
builder.AppendLine("-------------------------");
builder.AppendLine();
// Custom XGD type string
string xgdType = "XGD?";
if (XGDType == 0)
xgdType = "XGD1 (Xbox)";
else if (XGDType == 1)
xgdType = "XGD2 (Xbox 360)";
else if (XGDType == 2)
xgdType = "XGD2 (Xbox 360 / DVD-Video Hybrid)";
else if (XGDType == 3)
xgdType = "XGD3 (Xbox 360)";
builder.AppendLine(xgdType, "XGD Type");
builder.AppendLine();
long initialOffset = _dataSource.Position;
// Print all information of video partition model
var videoWrapper = new ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length);
videoWrapper?.PrintInformation(builder, recursive);
// Print all information of game partition model
var gameWrapper = new XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]);
gameWrapper?.PrintInformation(builder, recursive);
}
}
}