Files
SabreTools/SabreTools/Features/Restore.cs

48 lines
1.7 KiB
C#
Raw Normal View History

2020-07-31 23:17:12 -07:00
using System.Collections.Generic;
2020-12-07 13:57:26 -08:00
using SabreTools.Help;
2020-12-07 15:08:57 -08:00
using SabreTools.IO;
2020-08-01 23:04:11 -07:00
using SabreTools.Library.IO;
2020-07-31 23:17:12 -07:00
namespace SabreTools.Features
{
internal class Restore : BaseFeature
{
public const string Value = "Restore";
public Restore()
{
Name = Value;
Flags = new List<string>() { "-re", "--restore" };
Description = "Restore header to file based on SHA-1";
2020-12-07 13:57:26 -08:00
_featureType = ParameterType.Flag;
2020-09-04 23:17:27 -07:00
LongDescription = @"This will make use of stored copier headers and reapply them to files if they match the included hash. More than one header can be applied to a file, so they will be output to new files, suffixed with .newX, where X is a number. No input files are altered in the process. Only uncompressed files will be processed.
2020-07-31 23:17:12 -07:00
The following systems have headers that this program can work with:
- Atari 7800
- Atari Lynx
- Commodore PSID Music
- NEC PC - Engine / TurboGrafx 16
- Nintendo Famicom / Nintendo Entertainment System
- Nintendo Famicom Disk System
- Nintendo Super Famicom / Super Nintendo Entertainment System
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC";
Features = new Dictionary<string, Feature>();
AddFeature(OutputDirStringInput);
}
public override void ProcessFeatures(Dictionary<string, Feature> features)
{
base.ProcessFeatures(features);
// Get only files from the inputs
List<ParentablePath> files = DirectoryExtensions.GetFilesOnly(Inputs);
foreach (ParentablePath file in files)
{
Transform.RestoreHeader(file.CurrentPath, OutputDir);
}
}
}
}