[OfflineMerge, SabreTools] Integrate OfflineMerge

Along with this change are miscellaneous fixes to make it more useful.
This commit is contained in:
Matt Nadareski
2016-06-12 21:00:05 -07:00
parent a42d1f5793
commit 8bd52f1348
11 changed files with 101 additions and 290 deletions

3
.gitignore vendored
View File

@@ -2,9 +2,6 @@
/Deheader/obj /Deheader/obj
/Deheader/obj/Debug /Deheader/obj/Debug
/Deheader/obj/Release /Deheader/obj/Release
/OfflineMerge/obj
/OfflineMerge/obj/Debug
/OfflineMerge/obj/Release
/SabreTools/obj /SabreTools/obj
/SabreTools/obj/Debug /SabreTools/obj/Debug
/SabreTools/obj/Release /SabreTools/obj/Release

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{88310DB9-3B64-4268-AD48-2E0358D4CA5F}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OfflineMerge</RootNamespace>
<AssemblyName>OfflineMerge</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Debug-x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\..\Release-x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</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="OfflineMerge.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreTools.Helper\SabreTools.Helper.csproj">
<Project>{225a1afd-0890-44e8-b779-7502665c23a5}</Project>
<Name>SabreTools.Helper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,36 +0,0 @@
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("OfflineMerge")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OfflineMerge")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("88310db9-3b64-4268-ad48-2e0358d4ca5f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -68,18 +68,18 @@ namespace SabreTools.Helper
switch (className) switch (className)
{ {
case "DATabase": case "SabreTools":
Console.Write(@" Console.Write(@"
DATabase - Import and Generate DAT files SabreTools - Import, generate, manipulate DAT files
----------------------------------------- -----------------------------------------
Usage: DATabase [option] [filename|dirname] ... Usage: SabreTools [option] [filename|dirname] ...
Options: Options:
-?, -h, --help Show this help -?, -h, --help Show this help
-a, --add Add a new system or source to the database -a, --add Add a new system or source to the database
-manu= Manufacturer name (system only) -manu= Manufacturer name (system only)
-system= System name (system only) -system= System name (system only)
-source= Source name (source only) -source= Source name (source only)
-url= URL (source only) -url= URL (source only)
-d, --dfd Enable Dir2DAT mode -d, --dfd Enable Dir2DAT mode
-nm, --noMD5 Don't include MD5 in output -nm, --noMD5 Don't include MD5 in output
@@ -88,22 +88,22 @@ Options:
-u, --unzip Force unzipping in created DAT -u, --unzip Force unzipping in created DAT
-f, --files Treat archives as files -f, --files Treat archives as files
-o, --old Output DAT in CMP format instead of XML -o, --old Output DAT in CMP format instead of XML
-gz, --gz-files Allow reading of GZIP files as archives -gz, --gz-files Allow reading of GZIP files as archives
-ro, --romba Read files from a Romba input -ro, --romba Read files from a Romba input
-f=, --filename= Set the external name of the DAT -f=, --filename= Set the external name of the DAT
-n=, --name= Set the internal name of the DAT -n=, --name= Set the internal name of the DAT
-d=, --desc= Set the description of the DAT -d=, --desc= Set the description of the DAT
-c=, --cat= Set the category of the DAT -c=, --cat= Set the category of the DAT
-v=, --version= Set the version of the DAT -v=, --version= Set the version of the DAT
-au=, --author= Set the author of the DAT -au=, --author= Set the author of the DAT
-sd, --superdat Enable SuperDAT creation -sd, --superdat Enable SuperDAT creation
-t=, --temp= Set the temporary directory to use -t=, --temp= Set the temporary directory to use
-es, --ext-split Split a DAT by two file extensions -es, --ext-split Split a DAT by two file extensions
-exta= First set of extensions (comma-separated) -exta= First set of extensions (comma-separated)
-extb= Second set of extensions (comma-separated) -extb= Second set of extensions (comma-separated)
-out= Output directory -out= Output directory
-g, --generate Start tool in generate mode -g, --generate Start tool in generate mode
-system= System ID to generate from -system= System ID to generate from
-nr, --no-rename Don't auto-rename games -nr, --no-rename Don't auto-rename games
-o, --old Output DAT in CMP format instead of XML -o, --old Output DAT in CMP format instead of XML
-ga, --generate-all Start tool in generate all mode -ga, --generate-all Start tool in generate all mode
@@ -118,7 +118,7 @@ Options:
-m, --merge Merge one or more DATs -m, --merge Merge one or more DATs
-di, --diff Output all diffdats (merge flag not required) -di, --diff Output all diffdats (merge flag not required)
-c, --cascade Enable cascaded diffing -c, --cascade Enable cascaded diffing
-ip, --inplace Enable inplace, cascaded diffing -ip, --inplace Enable inplace, cascaded diff
-dd, --dedup Enable deduping in the created DAT -dd, --dedup Enable deduping in the created DAT
-b, --bare Don't include date in file name -b, --bare Don't include date in file name
-u, --unzip Force unzipping in created DAT -u, --unzip Force unzipping in created DAT
@@ -131,6 +131,11 @@ Options:
-ca=, --category= Set the category of the DAT -ca=, --category= Set the category of the DAT
-v=, --version= Set the version of the DAT -v=, --version= Set the version of the DAT
-au=, --author= Set the author of the DAT -au=, --author= Set the author of the DAT
-ol, --offmerge Update DATS for offline arrays (see notes)
-com= Complete current DAT
-fix= Complete current Missing
-new= New Complete DAT
-fk, --fake Replace all hashes and sizes by the default
-rm, --remove Remove a system or source from the database -rm, --remove Remove a system or source from the database
-system= System ID -system= System ID
-source= Source ID -source= Source ID
@@ -144,9 +149,9 @@ Options:
-oc, --output-cmp Output in CMP format -oc, --output-cmp Output in CMP format
-om, --output-miss Output in Missfile format -om, --output-miss Output in Missfile format
-r, --roms Output roms to miss instead of sets -r, --roms Output roms to miss instead of sets
-gp, --game-prefix Add game name as a prefix to each item -gp, --game-prefix Add game name as a prefix
-pre=, --prefix= Set prefix for all lines -pre=, --prefix= Set prefix for all lines
-post=, --postfix= Set postfix for all lines -post=, --postfix= Set postfix for all lines
-q, --quotes Put double-quotes around each item -q, --quotes Put double-quotes around each item
-ae=, --add-ext= Add an extension to each item -ae=, --add-ext= Add an extension to each item
-re=, --rep-ext= Replace all extensions with specified -re=, --rep-ext= Replace all extensions with specified
@@ -170,13 +175,13 @@ Options:
-sd=, --superdat Set SuperDAT type -sd=, --superdat Set SuperDAT type
-fm=, --forcemerge= Set force merging -fm=, --forcemerge= Set force merging
Supported values are: Supported values are:
None, Split, Full None, Split, Full
-fn=, --forcend= Set force nodump -fn=, --forcend= Set force nodump
Supported values are: Supported values are:
None, Obsolete, Required, Ignore None, Obsolete, Required, Ignore
-fp=, --forcepack= Set force packing -fp=, --forcepack= Set force packing
Supported values are: Supported values are:
None, Zip, Unzip None, Zip, Unzip
-clean Clean game names according to WoD standards -clean Clean game names according to WoD standards
-dd, --dedup Enable deduping in the created DAT -dd, --dedup Enable deduping in the created DAT
-gn=, --game-name= Filter by game name -gn=, --game-name= Filter by game name
@@ -200,7 +205,16 @@ do partial matches using asterisks as follows (case insensitive):
*00 means ends with '00' *00 means ends with '00'
00* means starts with '00' 00* means starts with '00'
*00* means contains '00' *00* means contains '00'
00 means exactly equals '00'"); 00 means exactly equals '00'
Offline merge mode notes:
This program will output the following DATs:
(a) Net New - (NewComplete)-(Complete)
(b) Unneeded - (Complete)-(NewComplete)
(c) New Missing - (Net New)+(Missing-(Unneeded))
(d) Have - (NewComplete)-(New Missing)
OR (Complete or NewComplete)-(Missing) if one is missing
");
break; break;
case "Headerer": case "Headerer":
Console.WriteLine(@"Headerer - Remove and restore rom headers Console.WriteLine(@"Headerer - Remove and restore rom headers
@@ -211,27 +225,6 @@ Options:
-e Detect and remove mode -e Detect and remove mode
-r Restore header to file based on SHA-1"); -r Restore header to file based on SHA-1");
break; break;
case "OfflineMerge":
Console.WriteLine(@"OfflineMerge - Update DATS for offline arrays
-----------------------------------------
Usage: OfflineMerge [options] [inputs]
Options:
-h, -?, --help Show this help dialog
-f, --fake Replace all hashes and sizes by the default
Inputs:
-com= Complete current DAT
-fix= Complete current Missing
-new= New Complete DAT
This program will output the following DATs:
(a) Net New - (NewComplete)-(Complete)
(b) Unneeded - (Complete)-(NewComplete)
(c) New Missing - (Net New)+(Missing-(Unneeded))
(d) Have - (NewComplete)-(New Missing)
OR (Complete or NewComplete)-(Missing) if one is missing");
break;
default: default:
Console.Write("This is the default help output"); Console.Write("This is the default help output");
break; break;

View File

@@ -8,7 +8,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SabreTools.Helper</RootNamespace> <RootNamespace>SabreTools.Helper</RootNamespace>
<AssemblyName>SabreTools</AssemblyName> <AssemblyName>SabreTools.Helper</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>

View File

@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreToolsUI", "SabreToolsU
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Helper", "SabreTools.Helper\SabreTools.Helper.csproj", "{225A1AFD-0890-44E8-B779-7502665C23A5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Helper", "SabreTools.Helper\SabreTools.Helper.csproj", "{225A1AFD-0890-44E8-B779-7502665C23A5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfflineMerge", "OfflineMerge\OfflineMerge.csproj", "{88310DB9-3B64-4268-AD48-2E0358D4CA5F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -50,14 +48,6 @@ Global
{225A1AFD-0890-44E8-B779-7502665C23A5}.Release|Any CPU.Build.0 = Release|Any CPU {225A1AFD-0890-44E8-B779-7502665C23A5}.Release|Any CPU.Build.0 = Release|Any CPU
{225A1AFD-0890-44E8-B779-7502665C23A5}.Release|x64.ActiveCfg = Release|x64 {225A1AFD-0890-44E8-B779-7502665C23A5}.Release|x64.ActiveCfg = Release|x64
{225A1AFD-0890-44E8-B779-7502665C23A5}.Release|x64.Build.0 = Release|x64 {225A1AFD-0890-44E8-B779-7502665C23A5}.Release|x64.Build.0 = Release|x64
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Debug|x64.ActiveCfg = Debug|x64
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Debug|x64.Build.0 = Debug|x64
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|Any CPU.Build.0 = Release|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.ActiveCfg = Release|x64
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -33,113 +33,6 @@ namespace SabreTools
_logger = logger; _logger = logger;
} }
public static void Main(string[] args)
{
// Perform initial setup and verification
Logger logger = new Logger(true, "offlinemerge.log");
logger.Start();
// If output is being redirected, don't allow clear screens
if (!Console.IsOutputRedirected)
{
Console.Clear();
}
// Credits take precidence over all
if ((new List<string>(args)).Contains("--credits"))
{
Build.Credits();
logger.Close();
return;
}
// If there's no arguments, show the help
if (args.Length == 0)
{
Build.Help();
logger.Close();
return;
}
// Set all default values
bool help = false, fake = false, offlineMerge = true;
string currentAllMerged = "", currentMissingMerged = "", currentNewMerged = "";
// Determine which switches are enabled (with values if necessary)
foreach (string arg in args)
{
switch (arg)
{
case "-?":
case "-h":
case "--help":
help = true;
break;
case "-f":
case "--fake":
fake = true;
break;
default:
string temparg = arg.Replace("\"", "");
if (temparg.StartsWith("-com="))
{
currentAllMerged = temparg.Split('=')[1];
}
else if (temparg.StartsWith("-fix="))
{
currentMissingMerged = temparg.Split('=')[1];
}
else if (temparg.StartsWith("-new="))
{
currentNewMerged = temparg.Split('=')[1];
}
else
{
logger.Warning("Invalid input detected: " + arg);
Console.WriteLine();
Build.Help();
logger.Close();
return;
}
break;
}
}
// If help is set, show help
if (help)
{
Build.Help();
logger.Close();
return;
}
// Otherwise, run the program
if (offlineMerge)
{
if (!(currentAllMerged == "" && currentMissingMerged == "" && currentNewMerged == ""))
{
InitOfflineMerge(currentAllMerged, currentMissingMerged, currentNewMerged, fake, logger);
}
else
{
logger.User("All inputs were empty! At least one input is required...");
Build.Help();
logger.Close();
return;
}
}
}
private static void InitOfflineMerge(string currentAllMerged, string currentMissingMerged, string currentNewMerged, bool fake, Logger logger)
{
OfflineMerge om = new OfflineMerge(currentAllMerged, currentMissingMerged, currentNewMerged, fake, logger);
bool success = om.Process();
if (!success)
{
logger.Warning("At least one complete DAT and the fixdat is needed to run!");
}
}
/// <summary> /// <summary>
/// Process the supplied inputs and create the four outputs /// Process the supplied inputs and create the four outputs
/// </summary> /// </summary>

View File

@@ -503,6 +503,29 @@ namespace SabreTools
hs.Process(); hs.Process();
} }
/// <summary>
/// Wrap creating an Offline merged DAT set
/// </summary>
/// <param name="currentAllMerged">Old-current DAT with merged and deduped values</param>
/// <param name="currentMissingMerged">Old-current missing DAT with merged and deduped values</param>
/// <param name="currentNewMerged">New-current DAT with merged and deduped values</param>
/// <param name="fake">True if all values should be replaced with default 0-byte values, false otherwise</param>
/// <param name="logger"></param>
private static void InitOfflineMerge(string currentAllMerged, string currentMissingMerged, string currentNewMerged, bool fake)
{
// Sanitize the inputs
currentAllMerged = currentAllMerged.Replace("\"", "");
currentMissingMerged = currentMissingMerged.Replace("\"", "");
currentNewMerged = currentNewMerged.Replace("\"", "");
OfflineMerge om = new OfflineMerge(currentAllMerged, currentMissingMerged, currentNewMerged, fake, _logger);
bool success = om.Process();
if (!success)
{
_logger.Warning("At least one complete DAT and the fixdat is needed to run!");
}
}
/// <summary> /// <summary>
/// Wrap getting statistics on a DAT or folder of DATs /// Wrap getting statistics on a DAT or folder of DATs
/// </summary> /// </summary>

View File

@@ -91,6 +91,7 @@ namespace SabreTools
disableForce = false, disableForce = false,
enableGzip = false, enableGzip = false,
extsplit = false, extsplit = false,
fake = false,
forceunpack = false, forceunpack = false,
generate = false, generate = false,
genall = false, genall = false,
@@ -104,6 +105,7 @@ namespace SabreTools
noMD5 = false, noMD5 = false,
norename = false, norename = false,
noSHA1 = false, noSHA1 = false,
offlineMerge = false,
old = false, old = false,
outputCMP = false, outputCMP = false,
outputMiss = false, outputMiss = false,
@@ -130,6 +132,9 @@ namespace SabreTools
category = "", category = "",
comment = "", comment = "",
crc = "", crc = "",
currentAllMerged = "",
currentMissingMerged = "",
currentNewMerged = "",
date = "", date = "",
description = "", description = "",
email = "", email = "",
@@ -230,6 +235,10 @@ namespace SabreTools
case "--files": case "--files":
archivesAsFiles = true; archivesAsFiles = true;
break; break;
case "-fk":
case "--fake":
fake = true;
break;
case "-g": case "-g":
case "--generate": case "--generate":
generate = true; generate = true;
@@ -302,6 +311,10 @@ namespace SabreTools
case "--output-cmp": case "--output-cmp":
outputCMP = true; outputCMP = true;
break; break;
case "-ol":
case "--offmerge":
offlineMerge = true;
break;
case "-om": case "-om":
case "--output-miss": case "--output-miss":
outputMiss = true; outputMiss = true;
@@ -382,6 +395,10 @@ namespace SabreTools
{ {
comment = arg.Split('=')[1]; comment = arg.Split('=')[1];
} }
else if (arg.StartsWith("-com=") || arg.StartsWith("--com="))
{
currentAllMerged = arg.Split('=')[1];
}
else if (arg.StartsWith("-crc=") || arg.StartsWith("--crc=")) else if (arg.StartsWith("-crc=") || arg.StartsWith("--crc="))
{ {
crc = arg.Split('=')[1]; crc = arg.Split('=')[1];
@@ -410,6 +427,10 @@ namespace SabreTools
{ {
filename = arg.Split('=')[1]; filename = arg.Split('=')[1];
} }
else if (arg.StartsWith("-fix=") || arg.StartsWith("--fix="))
{
currentMissingMerged = arg.Split('=')[1];
}
else if (arg.StartsWith("-fm=") || arg.StartsWith("--forcemerge=")) else if (arg.StartsWith("-fm=") || arg.StartsWith("--forcemerge="))
{ {
forcemerge = arg.Split('=')[1]; forcemerge = arg.Split('=')[1];
@@ -450,6 +471,10 @@ namespace SabreTools
{ {
name = arg.Split('=')[1]; name = arg.Split('=')[1];
} }
else if (arg.StartsWith("-new=") || arg.StartsWith("--new="))
{
currentNewMerged = arg.Split('=')[1];
}
else if (arg.StartsWith("-out=") && outdir == "") else if (arg.StartsWith("-out=") && outdir == "")
{ {
outdir = arg.Split('=')[1]; outdir = arg.Split('=')[1];
@@ -558,8 +583,9 @@ namespace SabreTools
} }
// If more than one switch is enabled, show the help screen // If more than one switch is enabled, show the help screen
if (!(add ^ datfromdir ^ extsplit ^ generate ^ genall ^ hashsplit ^ import ^ listsrc ^ listsys ^ (merge || diff) ^ if (!(add ^ datfromdir ^ extsplit ^ generate ^ genall ^ hashsplit ^ import ^ listsrc ^ listsys ^
(update || outputCMP || outputRC || outputSD || outputXML || outputMiss || romba) ^ rem ^ stats ^ trim)) (merge || diff) ^ (update || outputCMP || outputRC || outputSD || outputXML || outputMiss || romba) ^
offlineMerge ^ rem ^ stats ^ trim))
{ {
_logger.Error("Only one feature switch is allowed at a time"); _logger.Error("Only one feature switch is allowed at a time");
Build.Help(); Build.Help();
@@ -696,6 +722,22 @@ namespace SabreTools
InitDatFromDir(inputs, filename, name, description, category, version, author, forceunpack, old, romba, superdat, noMD5, noSHA1, bare, archivesAsFiles, enableGzip, tempdir); InitDatFromDir(inputs, filename, name, description, category, version, author, forceunpack, old, romba, superdat, noMD5, noSHA1, bare, archivesAsFiles, enableGzip, tempdir);
} }
// If we want to run Offline merging mode
else if (offlineMerge)
{
if (!(currentAllMerged == "" && currentMissingMerged == "" && currentNewMerged == ""))
{
InitOfflineMerge(currentAllMerged, currentMissingMerged, currentNewMerged, fake);
}
else
{
_logger.User("All inputs were empty! At least one input is required...");
Build.Help();
_logger.Close();
return;
}
}
// If nothing is set, show the help // If nothing is set, show the help
else else
{ {

View File

@@ -109,6 +109,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DATFromDir.cs" /> <Compile Include="DATFromDir.cs" />
<Compile Include="OfflineMerge.cs" />
<Compile Include="Split.cs" /> <Compile Include="Split.cs" />
<Compile Include="ImportExport\Generate.cs" /> <Compile Include="ImportExport\Generate.cs" />
<Compile Include="ImportExport\GenerateTwo.cs" /> <Compile Include="ImportExport\GenerateTwo.cs" />