implemented Manifest reading logic

master
VollRagm 4 years ago
parent 162e6dd552
commit 6aad238354

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +9,23 @@ namespace apphost_extract
{ {
public class AppHostFileEntry public class AppHostFileEntry
{ {
public int Offset { get; set; }
public int Size { get; set; }
public string RelativePath { get; set; }
private byte[] Raw;
private const int FILE_ENTRY_SIZE = 0x12;
public AppHostFileEntry(FileStream File)
{
byte[] entryBuffer = new byte[FILE_ENTRY_SIZE];
File.Read(entryBuffer, 0, entryBuffer.Length);
Raw = entryBuffer;
byte[] stringBuffer = new byte[Raw[0x11]];
File.Read(stringBuffer, 0, stringBuffer.Length);
RelativePath = Encoding.UTF8.GetString(stringBuffer);
}
} }
} }

@ -14,7 +14,6 @@ namespace apphost_extract
private byte[] Raw; private byte[] Raw;
public byte PathLength { get; set; }
public string Path { get; set; } public string Path { get; set; }
public int EmbeddedFilesCount { get; set; } public int EmbeddedFilesCount { get; set; }
@ -26,9 +25,8 @@ namespace apphost_extract
byte[] headerBuffer = new byte[HEADER_SIZE]; byte[] headerBuffer = new byte[HEADER_SIZE];
File.Read(headerBuffer, 0, HEADER_SIZE); File.Read(headerBuffer, 0, HEADER_SIZE);
Raw = headerBuffer; Raw = headerBuffer;
PathLength = Raw[0xC];
byte[] stringBuffer = new byte[PathLength]; byte[] stringBuffer = new byte[Raw[0xC]];
File.Read(stringBuffer, 0, stringBuffer.Length); File.Read(stringBuffer, 0, stringBuffer.Length);
Path = Encoding.UTF8.GetString(stringBuffer); Path = Encoding.UTF8.GetString(stringBuffer);

@ -13,7 +13,13 @@ namespace apphost_extract
public AppHostManifest(FileStream File, int embeddedFileCount) public AppHostManifest(FileStream File, int embeddedFileCount)
{ {
List<AppHostFileEntry> entries = new List<AppHostFileEntry>();
for(int i = 0; i < embeddedFileCount; i++)
{
AppHostFileEntry entry = new AppHostFileEntry(File);
entries.Add(entry);
}
} }
} }
} }

@ -44,6 +44,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AppHostFile.cs" /> <Compile Include="AppHostFile.cs" />
<Compile Include="AppHostFileEntry.cs" />
<Compile Include="AppHostFileHeader.cs" /> <Compile Include="AppHostFileHeader.cs" />
<Compile Include="AppHostManifest.cs" /> <Compile Include="AppHostManifest.cs" />
<Compile Include="Log.cs" /> <Compile Include="Log.cs" />

Loading…
Cancel
Save