immutable list

This commit is contained in:
2024-05-18 02:13:13 -04:00
parent 1bb652f01c
commit 4844f7c357
8 changed files with 41 additions and 30 deletions

View File

@@ -6,8 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BatchOszExtractor.CLI\BatchOszExtractor.CLI.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,11 +1,29 @@
using System.ComponentModel.Design;
using System.Collections.Immutable;
using System.IO.Compression;
namespace BatchOszExtractor.Core;
public class Extract
{
private void SelectMaps(SelectionType type, string MapRange)
public static void SelectMaps(SelectionType type, ImmutableList<string> maps, string extractPath)
{
// both are immutable lists of strings
if (type is SelectionType.Multiple or SelectionType.Single)
{
foreach (string map in maps)
{
using (ZipArchive archive = ZipFile.Open(map, ZipArchiveMode.Update))
{
string file = Path.GetFileName(map);
archive.ExtractToDirectory(Path.GetFullPath(Path.Combine(extractPath, file.Remove(file.Length - 4))));
}
}
}
// for a range of beatmaps
// TBD
else
{
}
}
}