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

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AvaloniaProject">
<option name="projectPerEditor">
<map>
<entry key="BatchOszExtractor.UI/MainWindow.axaml" value="BatchOszExtractor.UI/BatchOszExtractor.UI.csproj" />
</map>
</option>
</component>
</project>

View File

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

View File

@@ -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!");
Extract.SelectMaps(SelectionType.Single,ImmutableList.Create("/home/gwargoomba/Downloads/osuextract/740535 Cartoon & Futuristik Feat. Mikk Mae - C U Again.osz"),"/home/gwargoomba/Downloads/osuextract");

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
{
}
}
}

View File

@@ -8,12 +8,13 @@
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10"/>
<PackageReference Include="Avalonia.Desktop" Version="11.0.10"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.10"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10"/>
<PackageReference Include="Avalonia" Version="11.0.0"/>
<PackageReference Include="Avalonia.Desktop" Version="11.0.0"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10"/>
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0"/>
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
Don't remove it as it might cause problems with window transparency and embeded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="BatchOszExtractor.UI.Desktop"/>

View File

@@ -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