Files
BinaryObjectScanner/BinaryObjectScanner/FileType/SGA.cs
Matt Nadareski f9b4e262f2 Update packages
2024-12-13 11:56:31 -05:00

37 lines
1021 B
C#

using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// SGA game archive
/// </summary>
public class SGA : IExtractable
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var sga = SabreTools.Serialization.Wrappers.SGA.Create(stream);
if (sga == null)
return false;
// Loop through and extract all files
Directory.CreateDirectory(outDir);
sga.ExtractAll(outDir);
return true;
}
}
}