From c051eff0b968864c53c4a34c58c0d32237e25d12 Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Tue, 21 Nov 2023 20:49:06 -0500 Subject: [PATCH] All - Update Aura --- .config/dotnet-tools.json | 2 +- .../NickvisionTagger.GNOME.csproj | 2 +- NickvisionTagger.GNOME/Views/MainWindow.cs | 2 +- NickvisionTagger.GNOME/nuget-sources.json | 12 +-- .../Controllers/MainWindowController.cs | 75 ++++++++----------- .../Controllers/PreferencesViewController.cs | 2 +- .../Models/Configuration.cs | 3 +- .../NickvisionTagger.Shared.csproj | 2 +- .../NickvisionTagger.WinUI.csproj | 2 +- .../Views/MainWindow.xaml.cs | 4 +- 10 files changed, 47 insertions(+), 59 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c33ff7cb..da200cda 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "cake.tool": { - "version": "3.2.0", + "version": "4.0.0", "commands": [ "dotnet-cake" ] diff --git a/NickvisionTagger.GNOME/NickvisionTagger.GNOME.csproj b/NickvisionTagger.GNOME/NickvisionTagger.GNOME.csproj index 5b5dc527..83ec1ad0 100644 --- a/NickvisionTagger.GNOME/NickvisionTagger.GNOME.csproj +++ b/NickvisionTagger.GNOME/NickvisionTagger.GNOME.csproj @@ -9,7 +9,7 @@ - + diff --git a/NickvisionTagger.GNOME/Views/MainWindow.cs b/NickvisionTagger.GNOME/Views/MainWindow.cs index 5f283d96..4fe7efb4 100644 --- a/NickvisionTagger.GNOME/Views/MainWindow.cs +++ b/NickvisionTagger.GNOME/Views/MainWindow.cs @@ -676,7 +676,7 @@ private bool OnCloseRequested(Gtk.Window sender, EventArgs e) _controller.WindowWidth = width; _controller.WindowHeight = height; _controller.WindowMaximized = IsMaximized(); - _controller.SaveConfig(); + _controller.SaveConfiguration(); if (!_controller.CanClose) { var dialog = Adw.MessageDialog.New(this, _("Apply Changes?"), _("Some music files still have changes waiting to be applied. What would you like to do?")); diff --git a/NickvisionTagger.GNOME/nuget-sources.json b/NickvisionTagger.GNOME/nuget-sources.json index f3b25ee5..b063c14a 100644 --- a/NickvisionTagger.GNOME/nuget-sources.json +++ b/NickvisionTagger.GNOME/nuget-sources.json @@ -211,10 +211,10 @@ }, { "type": "file", - "url": "https://api.nuget.org/v3-flatcontainer/nickvision.aura/2023.11.3/nickvision.aura.2023.11.3.nupkg", - "sha512": "80a7d1514433de2b08fce0f5315b722b1b3f8bda679ed38654ad1a14af065d5e31d284a19c975e208cd8a27aec5af52db644969fff3243334749a236cfc1ecfc", + "url": "https://api.nuget.org/v3-flatcontainer/nickvision.aura/2023.11.4/nickvision.aura.2023.11.4.nupkg", + "sha512": "ddf2502d83d4957ef4acecfb472f697360daa487d4c721969e94741bed24087f107478618b717209bd4c35186f0666cffbcf64dc240785dae7b21180dc2b0bcb", "dest": "nuget-sources", - "dest-filename": "nickvision.aura.2023.11.3.nupkg" + "dest-filename": "nickvision.aura.2023.11.4.nupkg" }, { "type": "file", @@ -701,10 +701,10 @@ }, { "type": "file", - "url": "https://api.nuget.org/v3-flatcontainer/cake.tool/3.2.0/cake.tool.3.2.0.nupkg", - "sha512": "d83ba507bf930833817462e20f1413dfbd88b7c6c15876e774641aed08deeb15e39db17bc931248510e833823b4a833faaaee8c138a055a109273d1c368bf77a", + "url": "https://api.nuget.org/v3-flatcontainer/cake.tool/4.0.0/cake.tool.4.0.0.nupkg", + "sha512": "63b5049577afda8b70f7586582a1971452d767b2f771f2f3d1c0e4367ca3d6406a1b7e3a6ee81c7392e7b1a0ce98eb1f6494de9b7539a75fa9327140685b2b7d", "dest": "nuget-sources", - "dest-filename": "cake.tool.3.2.0.nupkg" + "dest-filename": "cake.tool.4.0.0.nupkg" }, { "type": "file", diff --git a/NickvisionTagger.Shared/Controllers/MainWindowController.cs b/NickvisionTagger.Shared/Controllers/MainWindowController.cs index bc275e76..b0cb8410 100644 --- a/NickvisionTagger.Shared/Controllers/MainWindowController.cs +++ b/NickvisionTagger.Shared/Controllers/MainWindowController.cs @@ -134,6 +134,9 @@ public class MainWindowController : IDisposable /// Command-line arguments public MainWindowController(string[] args) { + Aura.Init("org.nickvision.tagger", "Nickvision Tagger"); + AppInfo.EnglishShortName = "Tagger"; + //Vars _disposed = false; if (args.Length > 0) { @@ -147,53 +150,22 @@ public MainWindowController(string[] args) _libraryToLaunch = path; } } - Aura.Init("org.nickvision.tagger", "Nickvision Tagger"); - AppInfo.EnglishShortName = "Tagger"; - if (Directory.Exists($"{UserDirectories.Config}{Path.DirectorySeparatorChar}Nickvision{Path.DirectorySeparatorChar}{AppInfo.Name}")) - { - // Move config files from older versions and delete old directory - try - { - foreach (var file in Directory.GetFiles($"{UserDirectories.Config}{Path.DirectorySeparatorChar}Nickvision{Path.DirectorySeparatorChar}{AppInfo.Name}")) - { - File.Move(file, $"{UserDirectories.ApplicationConfig}{Path.DirectorySeparatorChar}{Path.GetFileName(file)}"); - } - } - catch (IOException) { } - Directory.Delete($"{UserDirectories.Config}{Path.DirectorySeparatorChar}Nickvision{Path.DirectorySeparatorChar}{AppInfo.Name}", true); - } - Aura.Active.SetConfig("config"); - Configuration.Current.Saved += ConfigurationSaved; - AppInfo.Version = "2023.11.3"; - AppInfo.ShortName = _("Tagger"); - AppInfo.Description = _("Tag your music"); - AppInfo.SourceRepo = new Uri("https://github.com/NickvisionApps/Tagger"); - AppInfo.IssueTracker = new Uri("https://github.com/NickvisionApps/Tagger/issues/new"); - AppInfo.SupportUrl = new Uri("https://github.com/NickvisionApps/Tagger/discussions"); - AppInfo.ExtraLinks[_("Matrix Chat")] = new Uri("https://matrix.to/#/#nickvision:matrix.org"); - AppInfo.Developers[_("Nicholas Logozzo")] = new Uri("https://github.com/nlogozzo"); - AppInfo.Developers[_("Contributors on GitHub ❤️")] = new Uri("https://github.com/NickvisionApps/Tagger/graphs/contributors"); - AppInfo.Designers[_("Nicholas Logozzo")] = new Uri("https://github.com/nlogozzo"); - AppInfo.Designers[_("Fyodor Sobolev")] = new Uri("https://github.com/fsobolev"); - AppInfo.Designers[_("DaPigGuy")] = new Uri("https://github.com/DaPigGuy"); - AppInfo.Artists[_("David Lapshin")] = new Uri("https://github.com/daudix-UFO"); - AppInfo.TranslatorCredits = _("translator-credits"); _forceAllowClose = false; _musicLibrary = null; _musicFileChangedFromUpdate = new List(); _filesBeingEditedOriginals = new Dictionary(); _hadUserFilenameChange = false; - _validSearchProperties = new string[] - { + _validSearchProperties = + [ "filename", _("filename"), "title", _("title"), "artist", _("artist"), "album", _("album"), "year", _("year"), "track", _("track"), "tracktotal", _("tracktotal"), "albumartist", _("albumartist"), "genre", _("genre"), "comment", _("comment"), "beatsperminute", _("beatsperminute"), "bpm", _("bpm"), "composer", _("composer"), "description", _("description"), "discnumber", _("discnumber"), "disctotal", _("disctotal"), "publisher", _("publisher"), "publishingdate", _("publishingdate"), "custom", _("custom") - }; - _genreSuggestions = new string[] - { + ]; + _genreSuggestions = + [ "Blues", "Classic rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-hop", "Jazz", "Metal", "New age", "Oldies", "Other", "Pop", "Rhythm and blues", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", "Death metal", "Pranks", "Soundtrack", "Euro-techno", "Ambient", "Trip-hop", "Vocal", @@ -204,11 +176,28 @@ public MainWindowController(string[] args) "Trailer", "Low-fi", "Tribal", "Polka", "Retro", "Musical", "Rock 'n' roll", "Hard rock", "Folk", "Swing", "Latin", "Chorus", "Acoustic", "Opera", "Club", "Tango", "Samba", "Freestyle", "A cappella", "Dance hall", "Indie", "Merengue", "Salsa", "Bachata", "Christmas", "EDM" - }; - FormatStrings = new string[] { _("%artist%- %title%"), _("%title%- %artist%"), _("%track%- %title%"), _("%title%") }; + ]; + FormatStrings = [_("%artist%- %title%"), _("%title%- %artist%"), _("%track%- %title%"), _("%title%")]; MusicFileSaveStates = new List(); SelectedMusicFiles = new Dictionary(); SelectedPropertyMap = new PropertyMap(); + //AppInfo + AppInfo.Version = "2023.11.3"; + AppInfo.ShortName = _("Tagger"); + AppInfo.Description = _("Tag your music"); + AppInfo.SourceRepo = new Uri("https://github.com/NickvisionApps/Tagger"); + AppInfo.IssueTracker = new Uri("https://github.com/NickvisionApps/Tagger/issues/new"); + AppInfo.SupportUrl = new Uri("https://github.com/NickvisionApps/Tagger/discussions"); + AppInfo.ExtraLinks[_("Matrix Chat")] = new Uri("https://matrix.to/#/#nickvision:matrix.org"); + AppInfo.Developers[_("Nicholas Logozzo")] = new Uri("https://github.com/nlogozzo"); + AppInfo.Developers[_("Contributors on GitHub ❤️")] = new Uri("https://github.com/NickvisionApps/Tagger/graphs/contributors"); + AppInfo.Designers[_("Nicholas Logozzo")] = new Uri("https://github.com/nlogozzo"); + AppInfo.Designers[_("Fyodor Sobolev")] = new Uri("https://github.com/fsobolev"); + AppInfo.Designers[_("DaPigGuy")] = new Uri("https://github.com/DaPigGuy"); + AppInfo.Artists[_("David Lapshin")] = new Uri("https://github.com/daudix-UFO"); + AppInfo.TranslatorCredits = _("translator-credits"); + //Events + Configuration.Current.Saved += ConfigurationSaved; } /// @@ -409,7 +398,7 @@ public async Task StartupAsync() /// /// Saves the app's configuration file to disk /// - public void SaveConfig() => Aura.Active.SaveConfig("config"); + public void SaveConfiguration() => Configuration.Current.Save(); /// /// Checks for an application update and notifies the user if one is available @@ -473,7 +462,7 @@ public async Task OpenLibraryAsync(string path) if (Configuration.Current.RememberLastOpenedFolder) { Configuration.Current.LastOpenedFolder = _musicLibrary.Path; - Aura.Active.SaveConfig("config"); + Configuration.Current.Save(); } await ReloadLibraryAsync(); } @@ -492,7 +481,7 @@ public void CloseLibrary() if (Configuration.Current.RememberLastOpenedFolder) { Configuration.Current.LastOpenedFolder = ""; - Aura.Active.SaveConfig("config"); + Configuration.Current.Save(); } MusicLibraryUpdated?.Invoke(this, EventArgs.Empty); } @@ -975,7 +964,7 @@ await Task.Run(() => { UpdateSelectedMusicFilesProperties(); Configuration.Current.PreviousFTTFormatString = formatString; - Aura.Active.SaveConfig("config"); + Configuration.Current.Save(); } MusicFileSaveStatesChanged?.Invoke(this, MusicFileSaveStates.Any(x => !x)); NotificationSent?.Invoke(this, new NotificationSentEventArgs(_n("Converted {0} file name to tag successfully", "Converted {0} file names to tags successfully", success, success), NotificationSeverity.Success, "format")); @@ -1011,7 +1000,7 @@ await Task.Run(() => { UpdateSelectedMusicFilesProperties(); Configuration.Current.PreviousTTFFormatString = formatString; - Aura.Active.SaveConfig("config"); + Configuration.Current.Save(); } MusicFileSaveStatesChanged?.Invoke(this, MusicFileSaveStates.Any(x => !x)); NotificationSent?.Invoke(this, new NotificationSentEventArgs(_n("Converted {0} tag to file name successfully", "Converted {0} tags to file names successfully", success, success), NotificationSeverity.Success, "format")); diff --git a/NickvisionTagger.Shared/Controllers/PreferencesViewController.cs b/NickvisionTagger.Shared/Controllers/PreferencesViewController.cs index 93ae9acd..a0cd2ad4 100644 --- a/NickvisionTagger.Shared/Controllers/PreferencesViewController.cs +++ b/NickvisionTagger.Shared/Controllers/PreferencesViewController.cs @@ -138,5 +138,5 @@ public string AcoustIdUserAPIKey /// /// Saves the configuration to disk /// - public void SaveConfiguration() => Aura.Active.SaveConfig("config"); + public void SaveConfiguration() => Configuration.Current.Save(); } diff --git a/NickvisionTagger.Shared/Models/Configuration.cs b/NickvisionTagger.Shared/Models/Configuration.cs index 3d1e2663..bcca58c3 100644 --- a/NickvisionTagger.Shared/Models/Configuration.cs +++ b/NickvisionTagger.Shared/Models/Configuration.cs @@ -1,5 +1,4 @@ using Nickvision.Aura; -using Nickvision.Aura.Configuration; using System.Runtime.InteropServices; namespace NickvisionTagger.Shared.Models; @@ -126,5 +125,5 @@ public Configuration() /// /// Gets the singleton object /// - internal static Configuration Current => (Configuration)Aura.Active.ConfigFiles["config"]; + internal static Configuration Current => Aura.Active.GetConfig("config"); } diff --git a/NickvisionTagger.Shared/NickvisionTagger.Shared.csproj b/NickvisionTagger.Shared/NickvisionTagger.Shared.csproj index 732d98ba..3b59a7e8 100644 --- a/NickvisionTagger.Shared/NickvisionTagger.Shared.csproj +++ b/NickvisionTagger.Shared/NickvisionTagger.Shared.csproj @@ -23,7 +23,7 @@ - + diff --git a/NickvisionTagger.WinUI/NickvisionTagger.WinUI.csproj b/NickvisionTagger.WinUI/NickvisionTagger.WinUI.csproj index 87231d9a..5cf8d9c7 100644 --- a/NickvisionTagger.WinUI/NickvisionTagger.WinUI.csproj +++ b/NickvisionTagger.WinUI/NickvisionTagger.WinUI.csproj @@ -37,7 +37,7 @@ - + diff --git a/NickvisionTagger.WinUI/Views/MainWindow.xaml.cs b/NickvisionTagger.WinUI/Views/MainWindow.xaml.cs index 1d4b1776..2ca3d0d6 100644 --- a/NickvisionTagger.WinUI/Views/MainWindow.xaml.cs +++ b/NickvisionTagger.WinUI/Views/MainWindow.xaml.cs @@ -678,7 +678,7 @@ private void SortFilesBy(object sender, RoutedEventArgs e) sortBy = SortBy.Genre; } _controller.SortFilesBy = sortBy; - _controller.SaveConfig(); + _controller.SaveConfiguration(); //Update sort file by menu MenuSortFilesFileName.IsChecked = _controller.SortFilesBy == SortBy.Filename; MenuSortFilesFilePath.IsChecked = _controller.SortFilesBy == SortBy.Path; @@ -765,7 +765,7 @@ private void ExtrasPaneToggle(object sender, RoutedEventArgs e) CmdBtnExtrasPane.Icon = new SymbolIcon(Symbol.ClosePane); _controller.ExtrasPane = true; } - _controller.SaveConfig(); + _controller.SaveConfiguration(); } ///