diff --git a/Aaru.Archives/Stfs/Info.cs b/Aaru.Archives/Stfs/Info.cs new file mode 100644 index 000000000..af73d6abc --- /dev/null +++ b/Aaru.Archives/Stfs/Info.cs @@ -0,0 +1,26 @@ +using System; +using System.IO; +using Aaru.CommonTypes.Interfaces; +using Aaru.Helpers; + +namespace Aaru.Archives; + +public sealed partial class Stfs +{ + /// + public bool Identify(IFilter filter) + { + if(filter.DataForkLength < Marshal.SizeOf()) return false; + + Stream stream = filter.GetDataForkStream(); + stream.Position = 0; + + byte[] hdr = new byte[Marshal.SizeOf()]; + + stream.ReadExactly(hdr, 0, hdr.Length); + + RemotePackage header = Marshal.ByteArrayToStructureBigEndian(hdr); + + return header.Magic is PackageMagic.Console or PackageMagic.Live or PackageMagic.Microsoft; + } +} \ No newline at end of file diff --git a/Aaru.Archives/Stfs/Unimplemented.cs b/Aaru.Archives/Stfs/Unimplemented.cs index 39096e3e7..3cd4440a0 100644 --- a/Aaru.Archives/Stfs/Unimplemented.cs +++ b/Aaru.Archives/Stfs/Unimplemented.cs @@ -12,8 +12,6 @@ public sealed partial class Stfs { #region IArchive Members - /// - public bool Identify(IFilter filter) => throw new NotImplementedException(); /// public ErrorNumber Open(IFilter filter, Encoding encoding) => throw new NotImplementedException();