mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Symbian Installation File] Decode requisites.
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Aaru.Archives;
|
||||
|
||||
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public partial class Symbian
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
// Magics
|
||||
const uint SYMBIAN_MAGIC = 0x10000419;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Aaru.Archives;
|
||||
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
||||
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public partial class Symbian
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
#region Nested type: Attribute
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.Archives;
|
||||
|
||||
public partial class Symbian
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
#region IArchive Members
|
||||
|
||||
@@ -72,14 +72,12 @@ public partial class Symbian
|
||||
|
||||
public void GetInformation(IFilter filter, Encoding encoding, out string information)
|
||||
{
|
||||
_encoding= encoding ?? Encoding.GetEncoding("windows-1252");
|
||||
information = "";
|
||||
var description = new StringBuilder();
|
||||
var languages = new List<string>();
|
||||
var capabilities = new Dictionary<uint, uint>();
|
||||
var en_Pos = 0;
|
||||
var componentName = "";
|
||||
Stream stream = filter.GetDataForkStream();
|
||||
_encoding = encoding ?? Encoding.GetEncoding("windows-1252");
|
||||
information = "";
|
||||
var description = new StringBuilder();
|
||||
var languages = new List<string>();
|
||||
var capabilities = new Dictionary<uint, uint>();
|
||||
Stream stream = filter.GetDataForkStream();
|
||||
|
||||
if(stream.Length < Marshal.SizeOf<SymbianHeader>())
|
||||
return;
|
||||
@@ -237,15 +235,59 @@ public partial class Symbian
|
||||
description.AppendFormat(Localization.File_contains_0_files_pointer_1, sh.files, sh.files_ptr).AppendLine();
|
||||
description.AppendFormat(Localization.File_contains_0_requisites, sh.requisites).AppendLine();
|
||||
|
||||
uint offset = sh.reqs_ptr;
|
||||
|
||||
if(sh.requisites > 0)
|
||||
{
|
||||
for(var r = 0; r < sh.requisites; r++)
|
||||
{
|
||||
br.BaseStream.Seek(offset, SeekOrigin.Begin);
|
||||
var requisiteRecord = new RequisiteRecord
|
||||
{
|
||||
uid = br.ReadUInt32(),
|
||||
majorVersion = br.ReadUInt16(),
|
||||
minorVersion = br.ReadUInt16(),
|
||||
variant = br.ReadUInt32()
|
||||
};
|
||||
|
||||
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||
span = buffer;
|
||||
requisiteRecord.namesLengths = MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
|
||||
|
||||
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||
span = buffer;
|
||||
requisiteRecord.namesPointers = MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
|
||||
|
||||
description.AppendFormat(Localization.Requisite_0, r).AppendLine();
|
||||
description.AppendFormat("\t" + Localization.Required_UID_0_version_1_2, requisiteRecord.uid,
|
||||
requisiteRecord.majorVersion, requisiteRecord.minorVersion).
|
||||
AppendLine();
|
||||
description.AppendFormat("\t" + Localization.Required_variant_0, requisiteRecord.variant).AppendLine();
|
||||
|
||||
offset = (uint)br.BaseStream.Position;
|
||||
|
||||
for(var i = 0; i < languages.Count; i++)
|
||||
{
|
||||
br.BaseStream.Seek(requisiteRecord.namesPointers[i], SeekOrigin.Begin);
|
||||
buffer = br.ReadBytes((int)requisiteRecord.namesLengths[i]);
|
||||
description.AppendFormat("\t" + Localization.Requisite_for_language_0_1, languages[i],
|
||||
_encoding.GetString(buffer)).
|
||||
AppendLine();
|
||||
}
|
||||
|
||||
description.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
// description.AppendLine(Localization.Capabilities);
|
||||
// foreach(KeyValuePair<uint, uint> kvp in capabilities)
|
||||
// description.AppendFormat("{0} = {1}", kvp.Key, kvp.Value).AppendLine();
|
||||
|
||||
// Set instance values
|
||||
_files = new List<DecodedFileRecord>();
|
||||
_files = new List<DecodedFileRecord>();
|
||||
|
||||
uint currentFile = 0;
|
||||
uint offset = sh.files_ptr;
|
||||
offset = sh.files_ptr;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.Archives;
|
||||
|
||||
public partial class Symbian
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
void Parse(BinaryReader br, ref uint offset, ref uint currentFile, uint maxFiles, List<string> languages)
|
||||
{
|
||||
@@ -58,8 +58,7 @@ public partial class Symbian
|
||||
|
||||
br.BaseStream.Seek(-sizeof(FileRecordType), SeekOrigin.Current);
|
||||
|
||||
byte[] buffer;
|
||||
ReadOnlySpan<byte> span;
|
||||
byte[] buffer;
|
||||
|
||||
switch(recordType)
|
||||
{
|
||||
@@ -112,8 +111,8 @@ public partial class Symbian
|
||||
buffer = br.ReadBytes(Marshal.SizeOf<BaseFileRecord>());
|
||||
multipleFileRecord.record = Marshal.ByteArrayToStructureLittleEndian<BaseFileRecord>(buffer);
|
||||
|
||||
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||
span = buffer;
|
||||
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||
ReadOnlySpan<byte> span = buffer;
|
||||
multipleFileRecord.lengths = MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
|
||||
|
||||
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace Aaru.Archives;
|
||||
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
[SuppressMessage("ReSharper", "InheritdocConsiderUsage")]
|
||||
public partial class Symbian
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
#region Nested type: AttributeConditionalExpression
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
namespace Aaru.Archives;
|
||||
|
||||
// Information from https://thoukydides.github.io/riscos-psifs/sis.html
|
||||
public partial class Symbian : IArchive
|
||||
public sealed partial class Symbian : IArchive
|
||||
{
|
||||
const string MODULE_NAME = "Symbian Installation File Plugin";
|
||||
Encoding _encoding;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Aaru.Archives;
|
||||
|
||||
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public partial class Symbian
|
||||
public sealed partial class Symbian
|
||||
{
|
||||
#region IArchive Members
|
||||
|
||||
|
||||
Reference in New Issue
Block a user