mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[STFS] Implement Identify.
This commit is contained in:
26
Aaru.Archives/Stfs/Info.cs
Normal file
26
Aaru.Archives/Stfs/Info.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ public sealed partial class Stfs
|
||||
{
|
||||
#region IArchive Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IFilter filter) => throw new NotImplementedException();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(IFilter filter, Encoding encoding) => throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user