Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LandonAndEmma committed Aug 25, 2024
1 parent 6ee77de commit b6db82f
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 48 deletions.
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
</configuration>
98 changes: 98 additions & 0 deletions CandyTool.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4585A548-C269-4E2F-9D93-C8395D9373D3}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CandyTool</RootNamespace>
<AssemblyName>CandyTool</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<StartupObject>FileExtractor.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
13 changes: 13 additions & 0 deletions CandyTool.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions CandyTool.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35219.272
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CandyTool", "CandyTool.csproj", "{4585A548-C269-4E2F-9D93-C8395D9373D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4585A548-C269-4E2F-9D93-C8395D9373D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4585A548-C269-4E2F-9D93-C8395D9373D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4585A548-C269-4E2F-9D93-C8395D9373D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4585A548-C269-4E2F-9D93-C8395D9373D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17B435F7-9B7E-4F59-BFF5-C491AB8A7D13}
EndGlobalSection
EndGlobal
86 changes: 86 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using System.IO;
namespace FileExtractor
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine(
"Drag and drop a file onto this exe to extract embedded SWAR and SBNK files.");
return;
}
foreach (string inputFile in args)
{
if (File.Exists(inputFile))
{
ExtractFiles(inputFile);
}
else
{
Console.WriteLine($"File not found: {inputFile}");
}
}
Console.WriteLine("Extraction completed successfully.");
}
static void ExtractFiles(string inputFile)
{
byte[] data = File.ReadAllBytes(inputFile);
int index = 0;
while (index < data.Length)
{
string fileType = null;
int fileSize = 0;
int headerStartIndex = 0;
if (IsMatch(data, index, "SWAR"))
{
fileType = ".swar";
fileSize = BitConverter.ToInt32(data, index + 8);
headerStartIndex = index;
index += 12;
}
else if (IsMatch(data, index, "SBNK"))
{
fileType = ".sbnk";
fileSize = BitConverter.ToInt32(data, index + 8);
headerStartIndex = index;
index += 12;
}
else
{
index++;
continue;
}
if (!Directory.Exists("extracted"))
{
Directory.CreateDirectory("extracted");
}
string outputFilename = $"extracted/extracted_{index}_{fileType}";
using (var outputFile = new FileStream(outputFilename, FileMode.Create,
FileAccess.Write))
{
outputFile.Write(data, headerStartIndex, fileSize + 8);
}
while (index < data.Length && data[index] != 0xDD)
{
index++;
}

if (index < data.Length)
{
index++;
}
}
}
static bool IsMatch(byte[] data, int index, string marker)
{
for (int i = 0; i < marker.Length; i++)
{
if (data[index + i] != marker[i]) return false;
}
return true;
}
}
}
35 changes: 35 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CandyTool")]
[assembly: AssemblyDescription("Extract sounds from Mysims DS games .urf files.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Landon & Emma")]
[assembly: AssemblyProduct("CandyTool")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4585a548-c269-4e2f-9d93-c8395d9373d3")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-AE")]
Binary file added icon.ico
Binary file not shown.
48 changes: 0 additions & 48 deletions src/extractor.py

This file was deleted.

0 comments on commit b6db82f

Please sign in to comment.