Files
SabreTools/RombaSharp/Features/Merge.cs

87 lines
2.7 KiB
C#
Raw Normal View History

2020-08-01 13:25:32 -07:00
using System.Collections.Generic;
using System.IO;
using System.Linq;
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 13:25:32 -07:00
namespace RombaSharp.Features
{
internal class Merge : BaseFeature
{
public const string Value = "Merge";
public Merge()
{
Name = Value;
Flags = ["merge"];
2020-08-01 13:25:32 -07:00
Description = "Merges depot";
2020-12-07 13:57:26 -08:00
_featureType = ParameterType.Flag;
2020-08-01 13:25:32 -07:00
LongDescription = "Merges specified depot into current depot.";
Features = [];
2020-08-01 13:25:32 -07:00
2021-02-03 11:10:19 -08:00
// Common Features
AddCommonFeatures();
2020-08-01 13:25:32 -07:00
AddFeature(OnlyNeededFlag);
AddFeature(ResumeStringInput);
AddFeature(WorkersInt32Input);
AddFeature(SkipInitialScanFlag);
}
// TODO: Add way of specifying "current depot" since that's what Romba relies on
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
2020-08-01 13:25:32 -07:00
{
2021-03-19 20:52:11 -07:00
// If the base fails, just fail out
if (!base.ProcessFeatures(features))
return false;
2020-08-01 13:25:32 -07:00
// Get feature flags
bool onlyNeeded = GetBoolean(features, OnlyNeededValue);
bool skipInitialscan = GetBoolean(features, SkipInitialScanValue);
int workers = GetInt32(features, WorkersInt32Value);
string? resume = GetString(features, ResumeStringValue);
2020-08-01 13:25:32 -07:00
logger.Error("This feature is not yet implemented: merge");
2020-08-01 13:25:32 -07:00
// Verify that the inputs are valid directories
2020-12-10 22:16:53 -08:00
Inputs = PathTool.GetDirectoriesOnly(Inputs).Select(p => p.CurrentPath).ToList();
2020-08-01 13:25:32 -07:00
// Loop over all input directories
foreach (string input in Inputs)
{
2024-02-29 00:14:16 -05:00
#if NET20 || NET35
List<string> depotFiles = Directory.GetFiles(input, "*.gz").ToList();
#else
2020-08-01 13:25:32 -07:00
List<string> depotFiles = Directory.EnumerateFiles(input, "*.gz", SearchOption.AllDirectories).ToList();
2024-02-29 00:14:16 -05:00
#endif
2020-08-01 13:25:32 -07:00
// If we are copying all that is possible but we want to scan first
if (!onlyNeeded && !skipInitialscan)
{
}
// If we are copying all that is possible but we don't care to scan first
else if (!onlyNeeded && skipInitialscan)
{
}
// If we are copying only what is needed but we want to scan first
else if (onlyNeeded && !skipInitialscan)
{
}
// If we are copying only what is needed but we don't care to scan first
else if (onlyNeeded && skipInitialscan)
{
}
}
2021-03-19 20:52:11 -07:00
return true;
2020-08-01 13:25:32 -07:00
}
}
}