From 4844f7c3576ce7c33336604ec13e3a97fb9134ff Mon Sep 17 00:00:00 2001 From: hinuiiik Date: Sat, 18 May 2024 02:13:13 -0400 Subject: [PATCH] immutable list --- .../.idea/avalonia.xml | 10 -------- .../BatchOszExtractor.CLI.csproj | 4 ++++ BatchOszExtractor.CLI/Program.cs | 4 +++- .../BatchOszExtractor.Core.csproj | 4 ---- BatchOszExtractor.Core/Extract.cs | 24 ++++++++++++++++--- .../BatchOszExtractor.UI.csproj | 11 +++++---- BatchOszExtractor.UI/app.manifest | 2 +- BatchOszExtractor.sln | 12 +++++----- 8 files changed, 41 insertions(+), 30 deletions(-) delete mode 100644 .idea/.idea.BatchOszExtractor/.idea/avalonia.xml diff --git a/.idea/.idea.BatchOszExtractor/.idea/avalonia.xml b/.idea/.idea.BatchOszExtractor/.idea/avalonia.xml deleted file mode 100644 index d7ac65f..0000000 --- a/.idea/.idea.BatchOszExtractor/.idea/avalonia.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj b/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj index 2f4fc77..f761c11 100644 --- a/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj +++ b/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj @@ -7,4 +7,8 @@ enable + + + + diff --git a/BatchOszExtractor.CLI/Program.cs b/BatchOszExtractor.CLI/Program.cs index e5dff12..61e06bf 100644 --- a/BatchOszExtractor.CLI/Program.cs +++ b/BatchOszExtractor.CLI/Program.cs @@ -1,3 +1,5 @@ // See https://aka.ms/new-console-template for more information +using System.Collections.Immutable; +using BatchOszExtractor.Core; -Console.WriteLine("Hello, World!"); \ No newline at end of file +Extract.SelectMaps(SelectionType.Single,ImmutableList.Create("/home/gwargoomba/Downloads/osuextract/740535 Cartoon & Futuristik Feat. Mikk Mae - C U Again.osz"),"/home/gwargoomba/Downloads/osuextract"); diff --git a/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj b/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj index fc78449..3a63532 100644 --- a/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj +++ b/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj @@ -6,8 +6,4 @@ enable - - - - diff --git a/BatchOszExtractor.Core/Extract.cs b/BatchOszExtractor.Core/Extract.cs index 2e10631..3d8a8b7 100644 --- a/BatchOszExtractor.Core/Extract.cs +++ b/BatchOszExtractor.Core/Extract.cs @@ -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 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 + { + + } } } \ No newline at end of file diff --git a/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj b/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj index 7c0b57f..f93581d 100644 --- a/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj +++ b/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj @@ -8,12 +8,13 @@ true + - - - - + + + + - + diff --git a/BatchOszExtractor.UI/app.manifest b/BatchOszExtractor.UI/app.manifest index 5ba2f6e..784371e 100644 --- a/BatchOszExtractor.UI/app.manifest +++ b/BatchOszExtractor.UI/app.manifest @@ -1,7 +1,7 @@  diff --git a/BatchOszExtractor.sln b/BatchOszExtractor.sln index d0a7aae..c9a90bf 100644 --- a/BatchOszExtractor.sln +++ b/BatchOszExtractor.sln @@ -2,10 +2,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.Core", "BatchOszExtractor.Core\BatchOszExtractor.Core.csproj", "{050177E4-F282-44B7-ADEB-D75C71E590B4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.UI", "BatchOszExtractor.UI\BatchOszExtractor.UI.csproj", "{7E1F2A49-4445-4699-A3CF-F02CA6E32FF8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.CLI", "BatchOszExtractor.CLI\BatchOszExtractor.CLI.csproj", "{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.UI", "BatchOszExtractor.UI\BatchOszExtractor.UI.csproj", "{7549EED7-5008-43AE-AC5A-4000863E4DA5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -16,13 +16,13 @@ Global {050177E4-F282-44B7-ADEB-D75C71E590B4}.Debug|Any CPU.Build.0 = Debug|Any CPU {050177E4-F282-44B7-ADEB-D75C71E590B4}.Release|Any CPU.ActiveCfg = Release|Any CPU {050177E4-F282-44B7-ADEB-D75C71E590B4}.Release|Any CPU.Build.0 = Release|Any CPU - {7E1F2A49-4445-4699-A3CF-F02CA6E32FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E1F2A49-4445-4699-A3CF-F02CA6E32FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E1F2A49-4445-4699-A3CF-F02CA6E32FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E1F2A49-4445-4699-A3CF-F02CA6E32FF8}.Release|Any CPU.Build.0 = Release|Any CPU {5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Debug|Any CPU.Build.0 = Debug|Any CPU {5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.Build.0 = Release|Any CPU + {7549EED7-5008-43AE-AC5A-4000863E4DA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7549EED7-5008-43AE-AC5A-4000863E4DA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7549EED7-5008-43AE-AC5A-4000863E4DA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7549EED7-5008-43AE-AC5A-4000863E4DA5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal