Add files via upload
This commit is contained in:
parent
3cbd43e424
commit
4d360cc484
|
@ -0,0 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>Avem33_Unpacker</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -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}") = "Avem33-Unpacker", "Avem33-Unpacker.csproj", "{5BE8CE3A-BFBF-4A8A-A12B-0E677DFF3BD5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5BE8CE3A-BFBF-4A8A-A12B-0E677DFF3BD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5BE8CE3A-BFBF-4A8A-A12B-0E677DFF3BD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5BE8CE3A-BFBF-4A8A-A12B-0E677DFF3BD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5BE8CE3A-BFBF-4A8A-A12B-0E677DFF3BD5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {664B2A89-AB00-431B-81A2-8032D2AFE1F7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,45 @@
|
|||
//Written for Avem33. https://store.steampowered.com/app/673900/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Avem33_Unpacker
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static BinaryReader br;
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
br = new BinaryReader(File.OpenRead(args[0]));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]));
|
||||
while (br.BaseStream.Position < br.BaseStream.Length)
|
||||
{
|
||||
string name = NullTerminatedString();
|
||||
|
||||
byte readbyte = 0xFE;
|
||||
while (readbyte == 0xFE)
|
||||
readbyte = br.ReadByte();//padding
|
||||
br.BaseStream.Position--;
|
||||
using FileStream FS = File.Create(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + "//" + name);
|
||||
BinaryWriter bw = new(FS);
|
||||
bw.Write(br.ReadBytes(br.ReadInt32()));
|
||||
bw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static string NullTerminatedString()
|
||||
{
|
||||
char[] fileName = Array.Empty<char>();
|
||||
char readchar = (char)1;
|
||||
while (readchar > 0)
|
||||
{
|
||||
readchar = br.ReadChar();
|
||||
Array.Resize(ref fileName, fileName.Length + 1);
|
||||
fileName[^1] = readchar;
|
||||
}
|
||||
Array.Resize(ref fileName, fileName.Length - 1);
|
||||
string name = new(fileName);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue