Skip to content

Commit ac1a44d

Browse files
authored
Add files via upload
1 parent 34970f6 commit ac1a44d

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

BFSAR_Split.csproj

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1477008E-9A66-4E3E-9CDD-CB6509C51027}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>BFSAR_Split</RootNamespace>
10+
<AssemblyName>BFSAR_Split</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>none</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<Compile Include="Program.cs" />
39+
<Compile Include="Properties\AssemblyInfo.cs" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<None Include="App.config" />
43+
</ItemGroup>
44+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
45+
</Project>

Program.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using System.IO;
3+
using System.Linq;
4+
5+
namespace BFSAR_Split
6+
{
7+
internal class Program
8+
{
9+
private static void Main(string[] args)
10+
{
11+
if (args.Length != 1)
12+
{
13+
Console.WriteLine("\a\nUsage: BFSAR_Split.exe <Input.bfsar>");
14+
}
15+
else
16+
{
17+
var Strm = File.OpenRead(args[0]);
18+
var Reader = new BinaryReader(Strm);
19+
20+
Directory.CreateDirectory($@"{args[0]}_Extracted");
21+
try
22+
{
23+
foreach (int Block in Enumerable.Range(0, (int)Reader.BaseStream.Length / 4))
24+
{
25+
int TryRdMagic = Reader.ReadInt32();
26+
27+
void Extract(string Extension)
28+
{
29+
long PosOffs = Reader.ReadInt64();
30+
int SizeOf = Reader.ReadInt32();
31+
byte[] Data = Reader.ReadBytes(SizeOf - 0x10);
32+
33+
int RelPos = (int)Strm.Position - SizeOf;
34+
35+
string Range = $"0x{RelPos:x}-0x{RelPos + SizeOf:x}";
36+
37+
Console.WriteLine($"Extracting {Extension} at {Range}...");
38+
39+
var WrtStrm = File.OpenWrite($@"{args[0]}_Extracted/{Range}.{Extension}");
40+
var Writer = new BinaryWriter(WrtStrm);
41+
42+
Writer.Write(TryRdMagic);
43+
Writer.Write(PosOffs);
44+
Writer.Write(SizeOf);
45+
Writer.Write(Data);
46+
47+
Writer.Dispose();
48+
WrtStrm.Dispose();
49+
50+
Strm.Position -= Strm.Position % 4;
51+
}
52+
53+
if (TryRdMagic == 0x56415746)
54+
{
55+
Extract("bfwav");
56+
}
57+
else if (TryRdMagic == 0x50545346)
58+
{
59+
Extract("bfstp");
60+
}
61+
else if (TryRdMagic == 0x51455346)
62+
{
63+
Extract("bfseq");
64+
}
65+
}
66+
}
67+
catch (EndOfStreamException)
68+
{
69+
Console.WriteLine("\nDone!");
70+
}
71+
}
72+
}
73+
}
74+
}

Properties/AssemblyInfo.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("BFSAR_Split")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("BFSAR_Split")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("1477008e-9a66-4e3e-9cdd-cb6509c51027")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)