Add new project for Offline Merging

The outputs from this program help with organizing roms that are in hard drives that are disconnected from the computer. This is mainly for people with disconnected arrays, but can be used to maintain a "best missing" list at all times as well.
This commit is contained in:
Matt Nadareski
2016-04-28 14:08:06 -07:00
parent 0897f39c52
commit 27aea4a443
6 changed files with 201 additions and 0 deletions

3
.gitignore vendored
View File

@@ -8,6 +8,9 @@
/Deheader/obj
/Deheader/obj/Debug
/Deheader/obj/Release
/OfflineMerge/obj
/OfflineMerge/obj/Debug
/OfflineMerge/obj/Release
/SabreHelper/obj
/SabreHelper/obj/Debug
/SabreHelper/obj/Release

6
OfflineMerge/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>

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SabreTools.Helper;
namespace SabreTools
{
/*
"Special Merge" by Obiwantje
------------------------
Inputs:
(1) All - Current all merged
(2) Missing - Current all missing
(3) Add - Current to add
(4) All-New - Current with replaced DATs (some add/remove)
(5) [Flag] Set all roms to have 0-byte values; if set, prepend "Offline" to DAT name/desc
0-byte Values:
CRC - 00000000
MD5 - d41d8cd98f00b204e9800998ecf8427e
SHA-1 - da39a3ee5e6b4b0d3255bfef95601890afd80709
*/
public class OfflineMerge
{
// Instance variables
private string _currentAllMerged;
private string _currentAllMissing;
private List<String> _toAdd;
private string _currentWithReplaced;
private bool _fake;
private Logger _logger;
/// <summary>
/// Instantiate an OfflineMerge object
/// </summary>
/// <param name="currentAllMerged">Old-current DAT with merged values</param>
/// <param name="currentAllMissing">Old-current missing DAT with merged values</param>
/// <param name="toAdd">List of new files to merge in</param>
/// <param name="currentWithReplaced">New-current DAT with merged values</param>
/// <param name="fake">True if all values should be replaced with default 0-byte values, false otherwise</param>
/// <param name="logger">Logger object for console and file output</param>
public OfflineMerge (string currentAllMerged, string currentAllMissing, string toAdd, string currentWithReplaced, bool fake, Logger logger)
{
_currentAllMerged = currentAllMerged.Replace("\"", "");
_currentAllMissing = currentAllMissing.Replace("\"", "");
_toAdd = new List<String>();
if (File.Exists(toAdd.Replace("\"", "")))
{
_toAdd.Add(toAdd.Replace("\"", ""));
}
else if (Directory.Exists(toAdd.Replace("\"", "")))
{
foreach (string file in Directory.EnumerateFiles(toAdd, "*", SearchOption.AllDirectories))
{
_toAdd.Add(file);
}
}
_currentWithReplaced = currentWithReplaced;
_fake = fake;
_logger = logger;
}
public static void Main(string[] args)
{
// Read in inputs and start the processing
}
/// <summary>
/// Process the supplied inputs and create the three required outputs:
/// (a) Net-New - (currentWithReplaced)-(currentAllMerged)
/// (b) New Missing - (a)+(currentAllMissing)
/// (c) Unneeded - (currentAllMerged)-(currentWithReplaced)
/// </summary>
/// <returns>True if the files were created properly, false otherwise</returns>
public bool Process()
{
return true;
}
}
}

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>{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>
<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="..\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("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

@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreHelper", "SabreHelper\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATFromDir", "DATFromDir\DATFromDir.csproj", "{382B75D3-079E-49D5-A830-54DD6EB5A02D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfflineMerge", "OfflineMerge\OfflineMerge.csproj", "{88310DB9-3B64-4268-AD48-2E0358D4CA5F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -40,6 +42,10 @@ Global
{382B75D3-079E-49D5-A830-54DD6EB5A02D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{382B75D3-079E-49D5-A830-54DD6EB5A02D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{382B75D3-079E-49D5-A830-54DD6EB5A02D}.Release|Any CPU.Build.0 = Release|Any CPU
{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}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE