Hi @Dani_S , sorry I misunderstood at 7z file, here is my implement code:
private static string[] EnsureDebugArgs(string[] args)
{
#if DEBUG
if (args != null && args.Length >= MIN_REQUIRED_ARGS)
return args;
var baseDir = Environment.GetEnvironmentVariable("GISCONVERTER_TEST_BASE")
?? @"D:\GisConverter\Tests";
var scenarios = BuildDebugScenarios(baseDir);
var debugTarget = Environment.GetEnvironmentVariable("GISCONVERTER_DEBUG_TARGET")?.Trim().ToLowerInvariant();
// Special case: run all scenarios in sequence
if (debugTarget == "all")
{
Console.WriteLine("Running all debug scenarios:");
Console.WriteLine();
foreach (var kvp in scenarios.OrderBy(s => s.Key))
{
Console.WriteLine($"Executing scenario: {kvp.Key}");
Console.WriteLine(new string('-', 60));
var exitCode = Run(kvp.Value);
Console.WriteLine($"Result: {(ExitCode)exitCode}");
Console.WriteLine();
}
Environment.Exit(0);
}
// Try to return the requested single scenario
if (!string.IsNullOrWhiteSpace(debugTarget) && scenarios.TryGetValue(debugTarget, out var selectedArgs))
{
Console.WriteLine($"Debug mode: using scenario '{debugTarget}'");
Console.WriteLine();
return selectedArgs;
}
// If no valid scenario was specified, show available options
if (!string.IsNullOrWhiteSpace(debugTarget))
{
Console.WriteLine($"Warning: Unknown scenario: '{debugTarget}'");
}
Console.WriteLine("Available scenarios (set GISCONVERTER_DEBUG_TARGET):");
foreach (var key in scenarios.Keys.OrderBy(k => k))
{
Console.WriteLine($" - {key}");
}
Console.WriteLine(" - all (runs all scenarios)");
Console.WriteLine();
return Array.Empty<string>();
#else
return args ?? Array.Empty<string>();
#endif
}
/// <summary>
/// Builds a dictionary of all debug scenarios with correct file extensions.
/// </summary>
private static Dictionary<string, string[]> BuildDebugScenarios(string baseDir)
{
var scenarios = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
void AddScenario(string scenarioKey, string format, string inputFileName)
{
var formatFolder = format;
scenarios[scenarioKey] = new[]
{
"gis_convert",
Path.Combine(baseDir, formatFolder, "Input", inputFileName),
format,
Path.Combine(baseDir, formatFolder, "Output", scenarioKey),
Path.Combine(baseDir, formatFolder, "Temp", scenarioKey),
"Log",
Path.Combine(baseDir, formatFolder, "Log", $"{scenarioKey.ToLowerInvariant()}_log.txt")
};
}
// Shapefile test cases
AddScenario("shapefile1", "Shapefile", "ShapeFiles.7z");
AddScenario("shapefile2", "Shapefile", "Vector.7z");
AddScenario("shapefile3", "Shapefile", "לא סטטוטורי - גבול מחוז מאוחד.7z");
AddScenario("shapefile4", "Shapefile", "שכבות מידע (Arc View).7z");
// Csv test cases - note the different extensions
AddScenario("csv1", "Csv", "features.7z");
AddScenario("csv2", "Csv", "features.csv");
AddScenario("csv3", "Csv", "features.zip");
// Gml test cases
AddScenario("gml1", "Gml", "gml_with_attribute_collection_schema.7z");
AddScenario("gml2", "Gml", "gml_with_attribute_collection_schema.zip");
AddScenario("gml3", "Gml", "gml_without_attribute_collection_schema.7z");
AddScenario("gml4", "Gml", "gml_without_attribute_collection_schema.gml");
AddScenario("gml5", "Gml", "gml_without_attribute_collection_schema.zip");
return scenarios;
}