diff --git a/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj b/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj
index f761c11..ff8ec88 100644
--- a/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj
+++ b/BatchOszExtractor.CLI/BatchOszExtractor.CLI.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net7.0
enable
enable
diff --git a/BatchOszExtractor.CLI/Program.cs b/BatchOszExtractor.CLI/Program.cs
index 61e06bf..ac052d9 100644
--- a/BatchOszExtractor.CLI/Program.cs
+++ b/BatchOszExtractor.CLI/Program.cs
@@ -2,4 +2,4 @@
using System.Collections.Immutable;
using BatchOszExtractor.Core;
-Extract.SelectMaps(SelectionType.Single,ImmutableList.Create("/home/gwargoomba/Downloads/osuextract/740535 Cartoon & Futuristik Feat. Mikk Mae - C U Again.osz"),"/home/gwargoomba/Downloads/osuextract");
+Extract.SelectMaps(SelectionType.Selection,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 3a63532..0542335 100644
--- a/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj
+++ b/BatchOszExtractor.Core/BatchOszExtractor.Core.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net7.0
enable
enable
diff --git a/BatchOszExtractor.Core/Extract.cs b/BatchOszExtractor.Core/Extract.cs
index 3d8a8b7..a1a8eba 100644
--- a/BatchOszExtractor.Core/Extract.cs
+++ b/BatchOszExtractor.Core/Extract.cs
@@ -3,18 +3,18 @@ using System.IO.Compression;
namespace BatchOszExtractor.Core;
-public class Extract
+public static class Extract
{
public static void SelectMaps(SelectionType type, ImmutableList maps, string extractPath)
{
// both are immutable lists of strings
- if (type is SelectionType.Multiple or SelectionType.Single)
+ if (type == SelectionType.Selection)
{
- foreach (string map in maps)
+ foreach (var map in maps)
{
- using (ZipArchive archive = ZipFile.Open(map, ZipArchiveMode.Update))
+ using (var archive = ZipFile.Open(map, ZipArchiveMode.Update))
{
- string file = Path.GetFileName(map);
+ var file = Path.GetFileName(map);
archive.ExtractToDirectory(Path.GetFullPath(Path.Combine(extractPath, file.Remove(file.Length - 4))));
}
}
diff --git a/BatchOszExtractor.Core/SelectionType.cs b/BatchOszExtractor.Core/SelectionType.cs
index 8d0358f..19965d9 100644
--- a/BatchOszExtractor.Core/SelectionType.cs
+++ b/BatchOszExtractor.Core/SelectionType.cs
@@ -2,7 +2,6 @@ namespace BatchOszExtractor.Core;
public enum SelectionType
{
- Single,
- Multiple,
+ Selection,
Range
}
\ No newline at end of file
diff --git a/BatchOszExtractor.UI/MainWindow.axaml b/BatchOszExtractor.UI/MainWindow.axaml
deleted file mode 100644
index 4bc0f20..0000000
--- a/BatchOszExtractor.UI/MainWindow.axaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
- Welcome to Avalonia!
-
diff --git a/BatchOszExtractor.sln b/BatchOszExtractor.sln
index c9a90bf..c687063 100644
--- a/BatchOszExtractor.sln
+++ b/BatchOszExtractor.sln
@@ -4,7 +4,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.Core", "B
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}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToDoList", "ToDoList\ToDoList.csproj", "{A7C2BD74-8C51-463A-9535-3E0F63CEC757}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -20,9 +20,9 @@ Global
{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
+ {A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/BatchOszExtractor.UI/App.axaml b/ToDoList/App.axaml
similarity index 68%
rename from BatchOszExtractor.UI/App.axaml
rename to ToDoList/App.axaml
index 1bcb928..1c25b1f 100644
--- a/BatchOszExtractor.UI/App.axaml
+++ b/ToDoList/App.axaml
@@ -1,9 +1,14 @@
+
+
+
+
diff --git a/BatchOszExtractor.UI/App.axaml.cs b/ToDoList/App.axaml.cs
similarity index 69%
rename from BatchOszExtractor.UI/App.axaml.cs
rename to ToDoList/App.axaml.cs
index dc4c901..807b332 100644
--- a/BatchOszExtractor.UI/App.axaml.cs
+++ b/ToDoList/App.axaml.cs
@@ -1,8 +1,10 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
+using ToDoList.ViewModels;
+using ToDoList.Views;
-namespace BatchOszExtractor.UI;
+namespace ToDoList;
public partial class App : Application
{
@@ -15,7 +17,10 @@ public partial class App : Application
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
- desktop.MainWindow = new MainWindow();
+ desktop.MainWindow = new MainWindow
+ {
+ DataContext = new MainWindowViewModel(),
+ };
}
base.OnFrameworkInitializationCompleted();
diff --git a/ToDoList/Assets/avalonia-logo.ico b/ToDoList/Assets/avalonia-logo.ico
new file mode 100644
index 0000000..da8d49f
Binary files /dev/null and b/ToDoList/Assets/avalonia-logo.ico differ
diff --git a/ToDoList/DataModel/ToDoItem.cs b/ToDoList/DataModel/ToDoItem.cs
new file mode 100644
index 0000000..0b15ae1
--- /dev/null
+++ b/ToDoList/DataModel/ToDoItem.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace ToDoList.DataModel;
+
+public class ToDoItem
+{
+ public string Description { get; set; } = String.Empty;
+ public bool IsChecked { get; set; }
+}
\ No newline at end of file
diff --git a/BatchOszExtractor.UI/Program.cs b/ToDoList/Program.cs
similarity index 85%
rename from BatchOszExtractor.UI/Program.cs
rename to ToDoList/Program.cs
index 237e9ab..31b6b41 100644
--- a/BatchOszExtractor.UI/Program.cs
+++ b/ToDoList/Program.cs
@@ -1,7 +1,8 @@
using Avalonia;
+using Avalonia.ReactiveUI;
using System;
-namespace BatchOszExtractor.UI;
+namespace ToDoList;
class Program
{
@@ -17,5 +18,6 @@ class Program
=> AppBuilder.Configure()
.UsePlatformDetect()
.WithInterFont()
- .LogToTrace();
+ .LogToTrace()
+ .UseReactiveUI();
}
\ No newline at end of file
diff --git a/ToDoList/Services/ToDoListService.cs b/ToDoList/Services/ToDoListService.cs
new file mode 100644
index 0000000..44d3ac6
--- /dev/null
+++ b/ToDoList/Services/ToDoListService.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using ToDoList.DataModel;
+
+namespace ToDoList.Services;
+
+public class ToDoListService
+{
+ public IEnumerable GetItems() => new[]
+ {
+ new ToDoItem { Description = "Walk the dog" },
+ new ToDoItem { Description = "Buy some milk" },
+ new ToDoItem { Description = "Learn Avalonia", IsChecked = true },
+ };
+}
\ No newline at end of file
diff --git a/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj b/ToDoList/ToDoList.csproj
similarity index 73%
rename from BatchOszExtractor.UI/BatchOszExtractor.UI.csproj
rename to ToDoList/ToDoList.csproj
index f93581d..2d951f6 100644
--- a/BatchOszExtractor.UI/BatchOszExtractor.UI.csproj
+++ b/ToDoList/ToDoList.csproj
@@ -1,13 +1,17 @@
WinExe
- net8.0
+ net7.0
enable
true
app.manifest
true
+
+
+
+
@@ -16,5 +20,11 @@
+
+
+
+
+
+
diff --git a/ToDoList/ViewLocator.cs b/ToDoList/ViewLocator.cs
new file mode 100644
index 0000000..27b65bb
--- /dev/null
+++ b/ToDoList/ViewLocator.cs
@@ -0,0 +1,27 @@
+using System;
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using ToDoList.ViewModels;
+
+namespace ToDoList;
+
+public class ViewLocator : IDataTemplate
+{
+ public Control Build(object data)
+ {
+ var name = data.GetType().FullName!.Replace("ViewModel", "View");
+ var type = Type.GetType(name);
+
+ if (type != null)
+ {
+ return (Control)Activator.CreateInstance(type)!;
+ }
+
+ return new TextBlock { Text = "Not Found: " + name };
+ }
+
+ public bool Match(object data)
+ {
+ return data is ViewModelBase;
+ }
+}
\ No newline at end of file
diff --git a/ToDoList/ViewModels/AddItemViewModel.cs b/ToDoList/ViewModels/AddItemViewModel.cs
new file mode 100644
index 0000000..e32c75a
--- /dev/null
+++ b/ToDoList/ViewModels/AddItemViewModel.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace ToDoList.ViewModels
+{
+ public class AddItemViewModel : ViewModelBase
+ {
+ public string Description { get; set; } = String.Empty;
+ }
+}
\ No newline at end of file
diff --git a/ToDoList/ViewModels/MainWindowViewModel.cs b/ToDoList/ViewModels/MainWindowViewModel.cs
new file mode 100644
index 0000000..e260f78
--- /dev/null
+++ b/ToDoList/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,32 @@
+using ReactiveUI;
+using ToDoList.Services;
+
+namespace ToDoList.ViewModels
+{
+ public class MainWindowViewModel : ViewModelBase
+ {
+ private ViewModelBase _contentViewModel;
+
+ //this has a dependency on the ToDoListService
+
+ public MainWindowViewModel()
+ {
+ var service = new ToDoListService();
+ ToDoList = new ToDoListViewModel(service.GetItems());
+ _contentViewModel = ToDoList;
+ }
+
+ public ToDoListViewModel ToDoList { get; }
+
+ public ViewModelBase ContentViewModel
+ {
+ get => _contentViewModel;
+ private set => this.RaiseAndSetIfChanged(ref _contentViewModel, value);
+ }
+
+ public void AddItem()
+ {
+ ContentViewModel = new AddItemViewModel();
+ }
+ }
+}
diff --git a/ToDoList/ViewModels/ToDoListViewModel.cs b/ToDoList/ViewModels/ToDoListViewModel.cs
new file mode 100644
index 0000000..a805601
--- /dev/null
+++ b/ToDoList/ViewModels/ToDoListViewModel.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using ToDoList.DataModel;
+
+namespace ToDoList.ViewModels
+{
+ public class ToDoListViewModel : ViewModelBase
+ {
+ public ToDoListViewModel(IEnumerable items)
+ {
+ ListItems = new ObservableCollection(items);
+ }
+
+ public ObservableCollection ListItems { get; }
+ }
+}
\ No newline at end of file
diff --git a/ToDoList/ViewModels/ViewModelBase.cs b/ToDoList/ViewModels/ViewModelBase.cs
new file mode 100644
index 0000000..7295eda
--- /dev/null
+++ b/ToDoList/ViewModels/ViewModelBase.cs
@@ -0,0 +1,7 @@
+using ReactiveUI;
+
+namespace ToDoList.ViewModels;
+
+public class ViewModelBase : ReactiveObject
+{
+}
\ No newline at end of file
diff --git a/ToDoList/Views/AddItemView.axaml b/ToDoList/Views/AddItemView.axaml
new file mode 100644
index 0000000..79a36c4
--- /dev/null
+++ b/ToDoList/Views/AddItemView.axaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
diff --git a/ToDoList/Views/AddItemView.axaml.cs b/ToDoList/Views/AddItemView.axaml.cs
new file mode 100644
index 0000000..5b26e35
--- /dev/null
+++ b/ToDoList/Views/AddItemView.axaml.cs
@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace ToDoList.Views;
+
+public partial class AddItemView : UserControl
+{
+ public AddItemView()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/ToDoList/Views/MainWindow.axaml b/ToDoList/Views/MainWindow.axaml
new file mode 100644
index 0000000..5357c9e
--- /dev/null
+++ b/ToDoList/Views/MainWindow.axaml
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/BatchOszExtractor.UI/MainWindow.axaml.cs b/ToDoList/Views/MainWindow.axaml.cs
similarity index 81%
rename from BatchOszExtractor.UI/MainWindow.axaml.cs
rename to ToDoList/Views/MainWindow.axaml.cs
index cba6053..bdebb65 100644
--- a/BatchOszExtractor.UI/MainWindow.axaml.cs
+++ b/ToDoList/Views/MainWindow.axaml.cs
@@ -1,6 +1,6 @@
using Avalonia.Controls;
-namespace BatchOszExtractor.UI;
+namespace ToDoList.Views;
public partial class MainWindow : Window
{
diff --git a/ToDoList/Views/ToDoListView.axaml b/ToDoList/Views/ToDoListView.axaml
new file mode 100644
index 0000000..988dd9b
--- /dev/null
+++ b/ToDoList/Views/ToDoListView.axaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ToDoList/Views/ToDoListView.axaml.cs b/ToDoList/Views/ToDoListView.axaml.cs
new file mode 100644
index 0000000..99412e1
--- /dev/null
+++ b/ToDoList/Views/ToDoListView.axaml.cs
@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace ToDoList.Views;
+
+public partial class ToDoListView : UserControl
+{
+ public ToDoListView()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/BatchOszExtractor.UI/app.manifest b/ToDoList/app.manifest
similarity index 100%
rename from BatchOszExtractor.UI/app.manifest
rename to ToDoList/app.manifest