Add DatToMiss as requested; minor update to DiffDat wording

This commit is contained in:
Matt Nadareski
2016-04-19 17:25:30 -07:00
parent 04b7809e7e
commit 8762324033
9 changed files with 220 additions and 3 deletions

3
.gitignore vendored
View File

@@ -8,6 +8,9 @@
/DatSplit/obj
/DatSplit/obj/Debug
/DatSplit/obj/Release
/DatToMiss/obj
/DatToMiss/obj/Debug
/DatToMiss/obj/Release
/Deheader/obj
/Deheader/obj/Debug
/Deheader/obj/Release

6
DatToMiss/App.config Normal file
View File

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

88
DatToMiss/DatToMiss.cs Normal file
View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.IO;
using SabreTools.Helper;
namespace SabreTools
{
public class DatToMiss
{
private static Logger logger;
public static void Main(string[] args)
{
Console.Clear();
// Credits take precidence over all
if ((new List<string>(args)).Contains("--credits"))
{
Build.Credits();
return;
}
if (args.Length == 0)
{
Build.Help();
return;
}
logger = new Logger(false, "dattomiss.log");
logger.Start();
// Output the title
Build.Start("DatToMiss");
string prefix = "", postfix = "", input = "";
bool tofile = false, help = false, usegame = true;
foreach (string arg in args)
{
switch (arg)
{
case "-h":
case "-?":
case "--help":
help = true;
break;
case "-l":
case "--log":
tofile = true;
break;
case "-r":
case "--roms":
usegame = false;
break;
default:
if ((arg.StartsWith("-pre=") || arg.StartsWith("--prefix=")) && prefix == "")
{
prefix = arg.Split('=')[1];
}
else if ((arg.StartsWith("-post=") || arg.StartsWith("--postfix=")) && postfix == "")
{
postfix = arg.Split('=')[1];
}
else if (input == "" && File.Exists(arg.Replace("\"", "")))
{
input = arg.Replace("\"", "");
}
break;
}
}
// Set the possibly new value for logger
logger.ToFile = tofile;
// Show help if explicitly asked for it or if not enough files are supplied
if (help || input == "")
{
Build.Help();
logger.Close();
return;
}
// Read in the roms from the DAT and then write them to the file
Output.WriteToText(Path.GetDirectoryName(input) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(input) + "-miss.txt",
RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix);
}
}
}

View File

@@ -0,0 +1,66 @@
<?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>{5AB8A989-21FC-4491-B8DB-E0C5B3983896}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DatToMiss</RootNamespace>
<AssemblyName>DatToMiss</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>
<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="DatToMiss.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreHelper\SabreHelper.csproj">
<Project>{225a1afd-0890-44e8-b779-7502665c23a5}</Project>
<Name>SabreHelper</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

@@ -0,0 +1,36 @@
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("DatToMiss")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DatToMiss")]
[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("5ab8a989-21fc-4491-b8db-e0c5b3983896")]
// 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

@@ -80,11 +80,11 @@ namespace SabreTools
return;
}
// Otherwise, read in the two files, diff them, and write the result to the file type that the first one is
// Otherwise, read in the files, diff them, and write the result to the file type that the first one is
List<RomData> A = new List<RomData>();
foreach (string input in inputs)
{
logger.Log("Merging in DAT: " + input);
logger.Log("Adding DAT: " + input);
List<RomData> B = RomManipulation.Parse(input, 0, 0, logger);
A = RomManipulation.Diff(A, B);
}

View File

@@ -79,7 +79,7 @@ A program to create a DAT based on the differences between two or more input DAT
<b>DatToMiss</b>
<p/>
CURRENTLY UNCODED - A program to convert a DAT to a miss file either for the games or the roms with the option to add a generic preface or postface to all of the outputted lines.
A program to convert a DAT to a miss file either for the games or the roms with the option to add a generic preface and postface to all of the outputted lines.
<b>MergeDAT</b>
<p/>

View File

@@ -166,6 +166,18 @@ Options:
-l, --log Enable log to file
-m, --merge Enable merging in the created DAT");
break;
case "DatToMiss":
Console.WriteLine(@"DatToMiss - Generate a miss file from a DAT
-----------------------------------------
Usage: DatToMiss [options] [filename]
Options:
-h, -?, --help Show this help dialog
-l, --log Enable log to file
-r, --roms Output roms to miss instead of sets
-pre=, --prefix= Set prefix to be printed in front of all lines
-post=, --postfix= Set postfix to be printed behind all lines");
break;
default:
Console.Write("This is the default help output");
break;

View File

@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATFromDir", "DATFromDir\DA
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiffDat", "DiffDat\DiffDat.csproj", "{785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatToMiss", "DatToMiss\DatToMiss.csproj", "{5AB8A989-21FC-4491-B8DB-E0C5B3983896}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -58,6 +60,10 @@ Global
{785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{785A4E9E-0DC1-4FAD-AA3A-57B5B122CD8E}.Release|Any CPU.Build.0 = Release|Any CPU
{5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AB8A989-21FC-4491-B8DB-E0C5B3983896}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE