[STFS] Implement Identify.

This commit is contained in:
2025-09-02 14:46:43 +01:00
parent 6ba1e584f4
commit d58bcc6522
2 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.IO;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
namespace Aaru.Archives;
public sealed partial class Stfs
{
/// <inheritdoc />
public bool Identify(IFilter filter)
{
if(filter.DataForkLength < Marshal.SizeOf<RemotePackage>()) return false;
Stream stream = filter.GetDataForkStream();
stream.Position = 0;
byte[] hdr = new byte[Marshal.SizeOf<RemotePackage>()];
stream.ReadExactly(hdr, 0, hdr.Length);
RemotePackage header = Marshal.ByteArrayToStructureBigEndian<RemotePackage>(hdr);
return header.Magic is PackageMagic.Console or PackageMagic.Live or PackageMagic.Microsoft;
}
}

View File

@@ -12,8 +12,6 @@ public sealed partial class Stfs
{ {
#region IArchive Members #region IArchive Members
/// <inheritdoc />
public bool Identify(IFilter filter) => throw new NotImplementedException();
/// <inheritdoc /> /// <inheritdoc />
public ErrorNumber Open(IFilter filter, Encoding encoding) => throw new NotImplementedException(); public ErrorNumber Open(IFilter filter, Encoding encoding) => throw new NotImplementedException();