Add files via upload

This commit is contained in:
NintenHero 2024-03-18 12:05:12 -05:00 committed by GitHub
parent f8b5df82f7
commit 10d7cce51f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Linkrealms_Extractor</RootNamespace>
</PropertyGroup>
</Project>

25
Linkrealms-Extractor.sln Normal file
View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34407.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linkrealms-Extractor", "Linkrealms-Extractor.csproj", "{417A4153-4192-426C-8543-123A4A18D22F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{417A4153-4192-426C-8543-123A4A18D22F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{417A4153-4192-426C-8543-123A4A18D22F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{417A4153-4192-426C-8543-123A4A18D22F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{417A4153-4192-426C-8543-123A4A18D22F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C763ABE9-83D5-4CF0-9F51-30A7A2B2D99F}
EndGlobalSection
EndGlobal

53
Program.cs Normal file
View file

@ -0,0 +1,53 @@
using System;
using System.IO;
namespace Linkrealms_Extractor
{
class Program
{
static void Main(string[] args)
{
string path = Path.GetDirectoryName(args[0]);
path = path.Remove(path.IndexOf("\\resources"));
BinaryReader br = new(File.OpenRead(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".idx"));
System.Collections.Generic.List<Subfile> data = new();
while (br.BaseStream.Position < br.BaseStream.Length)
{
string name = br.ReadString();
br.BaseStream.Position += 0xA4 - name.Length - 1;
data.Add(new()
{
name = name,
start = br.ReadInt32(),
size = br.ReadInt32()
});
}
foreach (Subfile file in data)
{
br.BaseStream.Position = file.start;
try
{
Directory.CreateDirectory(path + "//" + Path.GetDirectoryName(file.name));
using FileStream FS = File.Create(path + "//" + file.name);
BinaryWriter bw = new(FS);
bw.Write(br.ReadBytes(file.size));
bw.Close();
}
catch(DirectoryNotFoundException)//"particles.idx" has an empty spot where a file's data should be at 0x84FD4
{
continue;
}
}
}
class Subfile
{
public string name;
public int start;
public int size;
}
}
}