mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[HA] Implement Identify and GetInformation.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
xml:space="preserve">
|
xml:space="preserve">
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=amg/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=amg/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=arc/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=arc/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ha/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=stfs/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=stfs/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=symbian/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=symbian/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|||||||
6
Aaru.Archives/Ha/Consts.cs
Normal file
6
Aaru.Archives/Ha/Consts.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Aaru.Archives;
|
||||||
|
|
||||||
|
public sealed partial class Ha
|
||||||
|
{
|
||||||
|
const ushort HA_MAGIC = 0x4148;
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ public sealed partial class Ha : IArchive
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name => "HA";
|
public string Name => "HA";
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Guid Id { get; }
|
public Guid Id => new("2FB42964-82A0-4819-9C2D-CC2F24E35526");
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Author => Authors.NataliaPortillo;
|
public string Author => Authors.NataliaPortillo;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
62
Aaru.Archives/Ha/Info.cs
Normal file
62
Aaru.Archives/Ha/Info.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
|
using Aaru.Helpers;
|
||||||
|
|
||||||
|
namespace Aaru.Archives;
|
||||||
|
|
||||||
|
public sealed partial class Ha
|
||||||
|
{
|
||||||
|
#region IArchive Members
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Identify(IFilter filter)
|
||||||
|
{
|
||||||
|
if(filter.DataForkLength < Marshal.SizeOf<HaHeader>()) return false;
|
||||||
|
|
||||||
|
Stream stream = filter.GetDataForkStream();
|
||||||
|
stream.Position = 0;
|
||||||
|
|
||||||
|
byte[] hdr = new byte[Marshal.SizeOf<HaHeader>()];
|
||||||
|
|
||||||
|
stream.ReadExactly(hdr, 0, hdr.Length);
|
||||||
|
|
||||||
|
HaHeader header = Marshal.ByteArrayToStructureLittleEndian<HaHeader>(hdr);
|
||||||
|
|
||||||
|
// Not a valid magic
|
||||||
|
return header.magic == HA_MAGIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void GetInformation(IFilter filter, Encoding encoding, out string information)
|
||||||
|
{
|
||||||
|
information = "";
|
||||||
|
|
||||||
|
if(filter.DataForkLength < Marshal.SizeOf<HaHeader>()) return;
|
||||||
|
|
||||||
|
Stream stream = filter.GetDataForkStream();
|
||||||
|
stream.Position = 0;
|
||||||
|
|
||||||
|
byte[] hdr = new byte[Marshal.SizeOf<HaHeader>()];
|
||||||
|
|
||||||
|
stream.ReadExactly(hdr, 0, hdr.Length);
|
||||||
|
|
||||||
|
HaHeader header = Marshal.ByteArrayToStructureLittleEndian<HaHeader>(hdr);
|
||||||
|
|
||||||
|
// Not a valid magic
|
||||||
|
if(header.magic != HA_MAGIC) return;
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine(Localization.HA_archive);
|
||||||
|
|
||||||
|
int vertype = stream.ReadByte();
|
||||||
|
|
||||||
|
sb.AppendFormat(Localization.Created_with_HA_version_0, vertype >> 4).AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat(Localization.Archive_contains_0_files, header.count).AppendLine();
|
||||||
|
|
||||||
|
information = sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
47
Aaru.Archives/Ha/Structs.cs
Normal file
47
Aaru.Archives/Ha/Structs.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Aaru.Archives;
|
||||||
|
|
||||||
|
public sealed partial class Ha
|
||||||
|
{
|
||||||
|
#region Nested type: FHeader
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
readonly struct FHeader
|
||||||
|
{
|
||||||
|
// First nibble is archive version, second nibble is compression type
|
||||||
|
public readonly byte VerType;
|
||||||
|
|
||||||
|
// Compressed length
|
||||||
|
public readonly ushort clen;
|
||||||
|
|
||||||
|
// Original length
|
||||||
|
public readonly ushort olen;
|
||||||
|
|
||||||
|
// Unclear if DOS packed date or what
|
||||||
|
public readonly ushort date;
|
||||||
|
public readonly ushort time;
|
||||||
|
|
||||||
|
// CRC32
|
||||||
|
public readonly uint crc;
|
||||||
|
|
||||||
|
// Follows null-terminated path
|
||||||
|
// Follows null-terminated filename
|
||||||
|
// Follows 1-byte machine dependent information length
|
||||||
|
// Follows machine dependent information
|
||||||
|
// Follows compressed data
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Nested type: HaHeader
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
readonly struct HaHeader
|
||||||
|
{
|
||||||
|
public readonly ushort magic;
|
||||||
|
public readonly ushort count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -12,9 +12,6 @@ public sealed partial class Ha
|
|||||||
{
|
{
|
||||||
#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();
|
||||||
|
|
||||||
@@ -54,11 +51,5 @@ public sealed partial class Ha
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ErrorNumber GetEntry(int entryNumber, out IFilter filter) => throw new NotImplementedException();
|
public ErrorNumber GetEntry(int entryNumber, out IFilter filter) => throw new NotImplementedException();
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void GetInformation(IFilter filter, Encoding encoding, out string information)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
18
Aaru.Archives/Localization/Localization.Designer.cs
generated
18
Aaru.Archives/Localization/Localization.Designer.cs
generated
@@ -680,5 +680,23 @@ namespace Aaru.Archives {
|
|||||||
return ResourceManager.GetString("Archive_comment", resourceCulture);
|
return ResourceManager.GetString("Archive_comment", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string HA_archive {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("HA_archive", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string Created_with_HA_version_0 {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Created_with_HA_version_0", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string Archive_contains_0_files {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Archive_contains_0_files", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -333,4 +333,13 @@
|
|||||||
<data name="ARC_archive" xml:space="preserve">
|
<data name="ARC_archive" xml:space="preserve">
|
||||||
<value>[bold][blue]Archivo ARC[/][/]</value>
|
<value>[bold][blue]Archivo ARC[/][/]</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="HA_archive" xml:space="preserve">
|
||||||
|
<value>[bold][blue]Archivo HA[/][/]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Created_with_HA_version_0" xml:space="preserve">
|
||||||
|
<value>[slateblue1]Creado con HA versión [green]{0}[/][/]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Archive_contains_0_files" xml:space="preserve">
|
||||||
|
<value>[slateblue1]El archivo contiene [green]{0}[/] ficheros[/]</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -341,4 +341,13 @@
|
|||||||
<data name="Archive_comment" xml:space="preserve">
|
<data name="Archive_comment" xml:space="preserve">
|
||||||
<value>[bold][slateblue1]Archive comment:[/][/]</value>
|
<value>[bold][slateblue1]Archive comment:[/][/]</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="HA_archive" xml:space="preserve">
|
||||||
|
<value>[bold][blue]HA archive[/][/]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Created_with_HA_version_0" xml:space="preserve">
|
||||||
|
<value>[slateblue1]Created with HA version [green]{0}[/][/]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Archive_contains_0_files" xml:space="preserve">
|
||||||
|
<value>[slateblue1]Archive contains [green]{0}[/] files[/]</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user