From 7de296a9fbda9d34cc81b9319688606b755a4b26 Mon Sep 17 00:00:00 2001 From: VollRahm Date: Tue, 16 Feb 2021 10:15:22 +0100 Subject: [PATCH] - Converted to .NET 5 --- .gitignore | 1 + .../apphost-extract/AppHostFile.cs | 16 ++++-- .../apphost-extract/AppHostFileHeader.cs | 2 +- .../apphost-extract/apphost-extract.csproj | 54 ++----------------- 4 files changed, 18 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 4ba92b0..95636c8 100644 --- a/.gitignore +++ b/.gitignore @@ -336,3 +336,4 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ +src/apphost-extract/apphost-extract/apphost-extract.csproj.old diff --git a/src/apphost-extract/apphost-extract/AppHostFile.cs b/src/apphost-extract/apphost-extract/AppHostFile.cs index 65d811d..ea96e5d 100644 --- a/src/apphost-extract/apphost-extract/AppHostFile.cs +++ b/src/apphost-extract/apphost-extract/AppHostFile.cs @@ -18,12 +18,18 @@ namespace apphost_extract public AppHostFile(FileStream fileStream) { FileStream = fileStream; - - var buffer = new byte[sizeof(int)]; - FileStream.Seek(HEADER_OFFSET_PTR, SeekOrigin.Begin); - FileStream.Read(buffer, 0, buffer.Length); - Header = new AppHostFileHeader(FileStream, BitConverter.ToInt32(buffer, 0)); + var headerVA = GetHeaderAddress(HEADER_OFFSET_PTR); + + Header = new AppHostFileHeader(FileStream, headerVA); + } + + public int GetHeaderAddress(int offset) + { + var buffer = new byte[16]; + FileStream.Seek(offset, SeekOrigin.Begin); + FileStream.Read(buffer, 0, buffer.Length); + return BitConverter.ToInt32(buffer, 0); } diff --git a/src/apphost-extract/apphost-extract/AppHostFileHeader.cs b/src/apphost-extract/apphost-extract/AppHostFileHeader.cs index b910e33..8dc41c9 100644 --- a/src/apphost-extract/apphost-extract/AppHostFileHeader.cs +++ b/src/apphost-extract/apphost-extract/AppHostFileHeader.cs @@ -17,7 +17,7 @@ namespace apphost_extract public AppHostManifest Manifest { get; set; } - public AppHostFileHeader(FileStream File, int HeaderOffset) + public AppHostFileHeader(FileStream File, long HeaderOffset) { File.Seek(HeaderOffset, SeekOrigin.Begin); byte[] headerBuffer = new byte[HEADER_SIZE]; diff --git a/src/apphost-extract/apphost-extract/apphost-extract.csproj b/src/apphost-extract/apphost-extract/apphost-extract.csproj index c8197cd..306585f 100644 --- a/src/apphost-extract/apphost-extract/apphost-extract.csproj +++ b/src/apphost-extract/apphost-extract/apphost-extract.csproj @@ -1,59 +1,15 @@ - - - + - Debug - AnyCPU - {150E6D0D-598E-40E7-B7DD-3941F31E5C63} + net5.0 Exe apphost_extract - apphost-extract - v4.8 - 512 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + false - AnyCPU none - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - + + - \ No newline at end of file