Skip to content

Commit 2781f2d

Browse files
committed
header
1 parent c0450c8 commit 2781f2d

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.gitmodules

Whitespace-only changes.

GFS.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<ItemGroup>
3+
<ProjectReference Include="IO\IO.csproj" />
4+
</ItemGroup>
5+
<PropertyGroup>
6+
<TargetFramework>net8.0</TargetFramework>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
<AssemblyName>ThemModdingHerds.$(MSBuildProjectName)</AssemblyName>
10+
</PropertyGroup>
11+
</Project>

GFS.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GFS", "GFS.csproj", "{7906E5CF-8A30-4D37-B609-B3A0FA92BD21}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7906E5CF-8A30-4D37-B609-B3A0FA92BD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7906E5CF-8A30-4D37-B609-B3A0FA92BD21}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7906E5CF-8A30-4D37-B609-B3A0FA92BD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7906E5CF-8A30-4D37-B609-B3A0FA92BD21}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {9CC573F3-F460-40CE-8C90-9548402EB3DB}
24+
EndGlobalSection
25+
EndGlobal

Header.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using ThemModdingHerds.IO;
2+
using BinaryReader = ThemModdingHerds.IO.BinaryReader;
3+
4+
namespace ThemModdingHerds.GFS;
5+
public class Header(uint offset,ulong entryCount)
6+
{
7+
public readonly static string IDENTIFIER = "Reverge Package File";
8+
public readonly static string VERSION = "1.1";
9+
public uint DataOffset = offset;
10+
public string Identifier = IDENTIFIER;
11+
public string Version = VERSION;
12+
public ulong EntryCount = entryCount;
13+
}
14+
public static class HeaderExt
15+
{
16+
public static Header ReadHeader(this BinaryReader reader)
17+
{
18+
uint offset = reader.ReadUInt();
19+
string id = reader.ReadPascal64String();
20+
if(id != Header.IDENTIFIER)
21+
throw new Exception("Header identifier mismatch");
22+
string version = reader.ReadPascal64String();
23+
if(version != Header.VERSION)
24+
throw new Exception("Header version mismatch");
25+
ulong entryCount = reader.ReadULong();
26+
return new Header(offset,entryCount);
27+
}
28+
}

0 commit comments

Comments
 (0)