diff --git a/Daybreak.Tests/Services/BuildTemplateManagerTests.cs b/Daybreak.Tests/Services/BuildTemplateManagerTests.cs index 44c3a6ea..6f702cdd 100644 --- a/Daybreak.Tests/Services/BuildTemplateManagerTests.cs +++ b/Daybreak.Tests/Services/BuildTemplateManagerTests.cs @@ -5,7 +5,6 @@ using FluentAssertions; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using NSubstitute; -using System.Collections.Generic; namespace Daybreak.Tests.Services; @@ -54,8 +53,8 @@ public class BuildTemplateManagerTests { Primary = Profession.Assassin, Secondary = Profession.None, - Attributes = new List - { + Attributes = + [ new AttributeEntry { Attribute = Attribute.DaggerMastery, @@ -76,9 +75,9 @@ public class BuildTemplateManagerTests Attribute = Attribute.CriticalStrikes, Points = 11 } - }, - Skills = new List - { + ], + Skills = + [ Skill.UnsuspectingStrike, Skill.WildStrike, Skill.CriticalStrike, @@ -87,7 +86,7 @@ public class BuildTemplateManagerTests Skill.CriticalEye, Skill.CriticalAgility, Skill.CriticalDefenses - } + ] }; var encoded = this.buildTemplateManager.EncodeTemplate(build); diff --git a/Daybreak/Configuration/Options/BackgroundProviderOptions.cs b/Daybreak/Configuration/Options/BackgroundProviderOptions.cs index dfe7d8cc..c9fce4ef 100644 --- a/Daybreak/Configuration/Options/BackgroundProviderOptions.cs +++ b/Daybreak/Configuration/Options/BackgroundProviderOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "Background Provider")] -public sealed class BackgroundProviderOptions +internal sealed class BackgroundProviderOptions { [OptionName(Name = "Bloogum Client Enabled", Description = "When enabled, Background Provider will make use of Bloogum to get background images")] [JsonProperty(nameof(BloogumEnabled))] diff --git a/Daybreak/Configuration/Options/BuildSynchronizationOptions.cs b/Daybreak/Configuration/Options/BuildSynchronizationOptions.cs index 9bbef372..f24c879c 100644 --- a/Daybreak/Configuration/Options/BuildSynchronizationOptions.cs +++ b/Daybreak/Configuration/Options/BuildSynchronizationOptions.cs @@ -5,7 +5,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Build Synchronization")] [OptionsIgnore] -public sealed class BuildSynchronizationOptions +internal sealed class BuildSynchronizationOptions { [JsonProperty(nameof(ProtectedGraphAccessToken))] public string? ProtectedGraphAccessToken { get; set; } diff --git a/Daybreak/Configuration/Options/CredentialManagerOptions.cs b/Daybreak/Configuration/Options/CredentialManagerOptions.cs index 01316fdd..87991dd5 100644 --- a/Daybreak/Configuration/Options/CredentialManagerOptions.cs +++ b/Daybreak/Configuration/Options/CredentialManagerOptions.cs @@ -6,8 +6,8 @@ using System.Collections.Generic; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class CredentialManagerOptions +internal sealed class CredentialManagerOptions { [JsonProperty(nameof(ProtectedLoginCredentials))] - public List ProtectedLoginCredentials { get; set; } = new(); + public List ProtectedLoginCredentials { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/DSOALOptions.cs b/Daybreak/Configuration/Options/DSOALOptions.cs index 3ce6c85c..0f2a57f0 100644 --- a/Daybreak/Configuration/Options/DSOALOptions.cs +++ b/Daybreak/Configuration/Options/DSOALOptions.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "DSOAL")] -public sealed class DSOALOptions +internal sealed class DSOALOptions { [JsonProperty(nameof(Path))] [OptionName(Name = "Path", Description = "The path to the DSOAL installation")] diff --git a/Daybreak/Configuration/Options/DirectSongOptions.cs b/Daybreak/Configuration/Options/DirectSongOptions.cs index 4815fc0f..7affb0b0 100644 --- a/Daybreak/Configuration/Options/DirectSongOptions.cs +++ b/Daybreak/Configuration/Options/DirectSongOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "DirectSong")] -public sealed class DirectSongOptions +internal sealed class DirectSongOptions { [JsonProperty(nameof(Path))] [OptionName(Name = "Path", Description = "Folder that contains the DirectSong files")] diff --git a/Daybreak/Configuration/Options/EventNotifierOptions.cs b/Daybreak/Configuration/Options/EventNotifierOptions.cs index fd63636d..9e27d1eb 100644 --- a/Daybreak/Configuration/Options/EventNotifierOptions.cs +++ b/Daybreak/Configuration/Options/EventNotifierOptions.cs @@ -3,7 +3,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Event Notifier")] -public sealed class EventNotifierOptions +internal sealed class EventNotifierOptions { [OptionName(Name = "Enabled", Description = "If set to true, Daybreak will notify the user of any event on startup")] public bool Enabled { get; set; } = true; diff --git a/Daybreak/Configuration/Options/GuildwarsExecutableOptions.cs b/Daybreak/Configuration/Options/GuildwarsExecutableOptions.cs index 8beaa4fa..d398306a 100644 --- a/Daybreak/Configuration/Options/GuildwarsExecutableOptions.cs +++ b/Daybreak/Configuration/Options/GuildwarsExecutableOptions.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class GuildwarsExecutableOptions +internal sealed class GuildwarsExecutableOptions { [JsonProperty(nameof(ExecutablePaths))] - public List ExecutablePaths { get; set; } = new(); + public List ExecutablePaths { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/ImageCacheOptions.cs b/Daybreak/Configuration/Options/ImageCacheOptions.cs index 821dd041..32add5b9 100644 --- a/Daybreak/Configuration/Options/ImageCacheOptions.cs +++ b/Daybreak/Configuration/Options/ImageCacheOptions.cs @@ -3,7 +3,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Memory Cache")] -public sealed class ImageCacheOptions +internal sealed class ImageCacheOptions { [OptionName(Name = "Image Cache Limit", Description = "The maximum number of MBs that will be used to cache images in memory")] [OptionRange(MinValue = 0d, MaxValue = 1000d)] diff --git a/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs b/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs index e48acce1..1d6fa5b5 100644 --- a/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs +++ b/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs @@ -6,8 +6,8 @@ using System.Collections.Generic; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class LaunchConfigurationServiceOptions +internal sealed class LaunchConfigurationServiceOptions { [JsonProperty(nameof(LaunchConfigurations))] - public List LaunchConfigurations { get; set; } = new(); + public List LaunchConfigurations { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/LauncherOptions.cs b/Daybreak/Configuration/Options/LauncherOptions.cs index 229c5f6d..1dc74617 100644 --- a/Daybreak/Configuration/Options/LauncherOptions.cs +++ b/Daybreak/Configuration/Options/LauncherOptions.cs @@ -2,7 +2,6 @@ using Daybreak.Views; using Newtonsoft.Json; using System; -using System.ComponentModel; namespace Daybreak.Configuration.Options; diff --git a/Daybreak/Configuration/Options/LoggingOptions.cs b/Daybreak/Configuration/Options/LoggingOptions.cs index 50706cd1..7cb8e444 100644 --- a/Daybreak/Configuration/Options/LoggingOptions.cs +++ b/Daybreak/Configuration/Options/LoggingOptions.cs @@ -4,7 +4,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Logging Options")] [OptionsIgnore] -public sealed class LoggingOptions : ILiteCollectionOptions +internal sealed class LoggingOptions : ILiteCollectionOptions { public string CollectionName => "logs"; } diff --git a/Daybreak/Configuration/Options/MemoryReaderOptions.cs b/Daybreak/Configuration/Options/MemoryReaderOptions.cs index 74284efd..53297f48 100644 --- a/Daybreak/Configuration/Options/MemoryReaderOptions.cs +++ b/Daybreak/Configuration/Options/MemoryReaderOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "Memory Reader")] -public sealed class MemoryReaderOptions +internal sealed class MemoryReaderOptions { [JsonProperty(nameof(MemoryReaderFrequency))] [OptionRange(MinValue = 0, MaxValue = 1000)] diff --git a/Daybreak/Configuration/Options/PathfindingOptions.cs b/Daybreak/Configuration/Options/PathfindingOptions.cs index c119d4a5..76461c6e 100644 --- a/Daybreak/Configuration/Options/PathfindingOptions.cs +++ b/Daybreak/Configuration/Options/PathfindingOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "Pathfinding")] -public sealed class PathfindingOptions +internal sealed class PathfindingOptions { [JsonProperty(nameof(EnablePathfinding))] [OptionName(Name = "Enable Pathfinding", Description = "If true, the pathfinder will attempt to produce paths from the player position to objectives")] diff --git a/Daybreak/Configuration/Options/PluginsServiceOptions.cs b/Daybreak/Configuration/Options/PluginsServiceOptions.cs index 0ffe16dc..b8a0e5f0 100644 --- a/Daybreak/Configuration/Options/PluginsServiceOptions.cs +++ b/Daybreak/Configuration/Options/PluginsServiceOptions.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class PluginsServiceOptions +internal sealed class PluginsServiceOptions { - public List EnabledPlugins { get; set; } = new(); + public List EnabledPlugins { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/PriceHistoryOptions.cs b/Daybreak/Configuration/Options/PriceHistoryOptions.cs index ff984d37..c6a90c02 100644 --- a/Daybreak/Configuration/Options/PriceHistoryOptions.cs +++ b/Daybreak/Configuration/Options/PriceHistoryOptions.cs @@ -7,7 +7,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Price History")] [OptionsIgnore] -public sealed class PriceHistoryOptions : ILiteCollectionOptions +internal sealed class PriceHistoryOptions : ILiteCollectionOptions { public string HttpsUri { get; set; } = "https://kamadan.gwtoolbox.com/"; @@ -15,5 +15,5 @@ public sealed class PriceHistoryOptions : ILiteCollectionOptions public TimeSpan UpdateInterval { get; set; } = TimeSpan.FromHours(1); - public Dictionary ItemHistoryMetadata { get; set; } = new(); + public Dictionary ItemHistoryMetadata { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/ReShadeOptions.cs b/Daybreak/Configuration/Options/ReShadeOptions.cs index de7b91bd..aafb3cfb 100644 --- a/Daybreak/Configuration/Options/ReShadeOptions.cs +++ b/Daybreak/Configuration/Options/ReShadeOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "ReShade")] -public sealed class ReShadeOptions +internal sealed class ReShadeOptions { [JsonProperty(nameof(Enabled))] [OptionName(Name = "Enabled", Description = "If true, Daybreak will attempt to inject ReShade into the starting Guild Wars executable")] diff --git a/Daybreak/Configuration/Options/ScreenManagerOptions.cs b/Daybreak/Configuration/Options/ScreenManagerOptions.cs index 915c7fcd..1d37d00e 100644 --- a/Daybreak/Configuration/Options/ScreenManagerOptions.cs +++ b/Daybreak/Configuration/Options/ScreenManagerOptions.cs @@ -4,7 +4,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Screen Manager")] [OptionsIgnore] -public sealed class ScreenManagerOptions +internal sealed class ScreenManagerOptions { public double X { get; set; } public double Y { get; set; } diff --git a/Daybreak/Configuration/Options/SoundOptions.cs b/Daybreak/Configuration/Options/SoundOptions.cs index 81ca0441..a5e6556b 100644 --- a/Daybreak/Configuration/Options/SoundOptions.cs +++ b/Daybreak/Configuration/Options/SoundOptions.cs @@ -3,7 +3,7 @@ namespace Daybreak.Configuration.Options; [OptionsName(Name = "Sounds")] -public sealed class SoundOptions +internal sealed class SoundOptions { [OptionName(Name = "Sounds Enabled", Description = "If enabled, the client will play sounds.")] public bool Enabled { get; set; } diff --git a/Daybreak/Configuration/Options/ToolboxOptions.cs b/Daybreak/Configuration/Options/ToolboxOptions.cs index 7d1f4a28..f78077b7 100644 --- a/Daybreak/Configuration/Options/ToolboxOptions.cs +++ b/Daybreak/Configuration/Options/ToolboxOptions.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace Daybreak.Configuration.Options; [OptionsName(Name = "GWToolbox")] -public sealed class ToolboxOptions +internal sealed class ToolboxOptions { [JsonProperty(nameof(DllPath))] [OptionName(Name = "DllPath", Description = "The path to GWToolboxdll.dll")] diff --git a/Daybreak/Configuration/Options/TradeAlertingOptions.cs b/Daybreak/Configuration/Options/TradeAlertingOptions.cs index b452c49a..d3137a10 100644 --- a/Daybreak/Configuration/Options/TradeAlertingOptions.cs +++ b/Daybreak/Configuration/Options/TradeAlertingOptions.cs @@ -6,9 +6,9 @@ using System.Collections.Generic; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class TradeAlertingOptions +internal sealed class TradeAlertingOptions { public TimeSpan MaxLookbackPeriod { get; set; } = TimeSpan.FromDays(31); public DateTime LastCheckTime { get; set; } = DateTime.MinValue; - public List Alerts { get; set; } = new(); + public List Alerts { get; set; } = []; } diff --git a/Daybreak/Configuration/Options/TraderMessagesOptions.cs b/Daybreak/Configuration/Options/TraderMessagesOptions.cs index 6556f79c..5074279c 100644 --- a/Daybreak/Configuration/Options/TraderMessagesOptions.cs +++ b/Daybreak/Configuration/Options/TraderMessagesOptions.cs @@ -4,7 +4,7 @@ using Daybreak.Services.TradeChat.Models; namespace Daybreak.Configuration.Options; [OptionsIgnore] -public sealed class TraderMessagesOptions : ILiteCollectionOptions +internal sealed class TraderMessagesOptions : ILiteCollectionOptions { public string CollectionName => "trader_messages"; } diff --git a/Daybreak/Configuration/Options/TraderQuotesOptions.cs b/Daybreak/Configuration/Options/TraderQuotesOptions.cs index 5948b7dc..3e421ca4 100644 --- a/Daybreak/Configuration/Options/TraderQuotesOptions.cs +++ b/Daybreak/Configuration/Options/TraderQuotesOptions.cs @@ -4,7 +4,7 @@ using System; namespace Daybreak.Configuration.Options; [OptionsName(Name = "Trader Quotes")] -public sealed class TraderQuotesOptions +internal sealed class TraderQuotesOptions { [OptionIgnore] public string HttpsUri { get; set; } = "https://kamadan.gwtoolbox.com/"; diff --git a/Daybreak/Configuration/Options/UModOptions.cs b/Daybreak/Configuration/Options/UModOptions.cs index a7973dab..160ee34e 100644 --- a/Daybreak/Configuration/Options/UModOptions.cs +++ b/Daybreak/Configuration/Options/UModOptions.cs @@ -18,5 +18,5 @@ public sealed class UModOptions [JsonProperty(nameof(Mods))] [OptionIgnore] - public List Mods { get; set; } = new(); + public List Mods { get; set; } = []; } diff --git a/Daybreak/Controls/ExpandableMenuSection.xaml.cs b/Daybreak/Controls/ExpandableMenuSection.xaml.cs index f91c83c6..5d49c722 100644 --- a/Daybreak/Controls/ExpandableMenuSection.xaml.cs +++ b/Daybreak/Controls/ExpandableMenuSection.xaml.cs @@ -20,7 +20,7 @@ public partial class ExpandableMenuSection : UserControl [GenerateDependencyProperty(InitialValue = false)] private bool expanded = false; - public ObservableCollection Children { get; } = new ObservableCollection(); + public ObservableCollection Children { get; } = []; public ExpandableMenuSection() { diff --git a/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs b/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs index ac72335e..00eca147 100644 --- a/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs +++ b/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs @@ -42,7 +42,7 @@ public partial class GuildwarsMinimap : UserControl private readonly Histogram drawingLatency; private readonly DispatcherTimer dispatcherTimer = new(DispatcherPriority.Render); - private readonly List mainPlayerPositionHistory = new(); + private readonly List mainPlayerPositionHistory = []; private readonly IPathfinder pathfinder; private readonly IDrawingService drawingService; private readonly IThemeManager themeManager; @@ -357,8 +357,8 @@ public partial class GuildwarsMinimap : UserControl this.drawingService.DrawEngagementArea(bitmap, this.GameData); this.drawingService.DrawMainPlayerPositionHistory(bitmap, this.mainPlayerPositionHistory); this.drawingService.DrawPaths(bitmap, this.pathfindingCache); - this.drawingService.DrawQuestObjectives(bitmap, this.GameData.MainPlayer?.QuestLog ?? new List()); - this.drawingService.DrawMapIcons(bitmap, this.GameData.MapIcons ?? new List()); + this.drawingService.DrawQuestObjectives(bitmap, this.GameData.MainPlayer?.QuestLog ?? []); + this.drawingService.DrawMapIcons(bitmap, this.GameData.MapIcons ?? []); this.drawingService.DrawEntities(bitmap, this.GameData, this.TargetEntityId); bitmap.Unlock(); this.drawingLatency.Record(sw.ElapsedMilliseconds); diff --git a/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs b/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs index 85092ce5..64ef834f 100644 --- a/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs +++ b/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs @@ -24,7 +24,7 @@ public partial class NotificationStackpanel : UserControl private readonly DispatcherTimer dispatcherTimer = new(); private CancellationTokenSource? cancellationToken; - public ObservableCollection Notifications { get; } = new(); + public ObservableCollection Notifications { get; } = []; public NotificationStackpanel() : this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), diff --git a/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs b/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs index 41803fe2..c9f87661 100644 --- a/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs +++ b/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs @@ -15,7 +15,7 @@ public partial class EnumOptionTemplate : UserControl { private OptionProperty optionProperty = default!; - public ObservableCollection PossibleEnumValues { get; } = new ObservableCollection(); + public ObservableCollection PossibleEnumValues { get; } = []; [GenerateDependencyProperty] private object value = default!; diff --git a/Daybreak/Controls/Options/OptionsSection.xaml.cs b/Daybreak/Controls/Options/OptionsSection.xaml.cs index 9f9db2ad..bcbfe823 100644 --- a/Daybreak/Controls/Options/OptionsSection.xaml.cs +++ b/Daybreak/Controls/Options/OptionsSection.xaml.cs @@ -23,7 +23,7 @@ public partial class OptionsSection : UserControl private readonly IOptionsProvider optionsProvider; private readonly IViewManager viewManager; - public ObservableCollection Options { get; } = new ObservableCollection(); + public ObservableCollection Options { get; } = []; public OptionsSection( IOptionsProvider optionsProvider, diff --git a/Daybreak/Controls/Templates/BuildTemplate.xaml.cs b/Daybreak/Controls/Templates/BuildTemplate.xaml.cs index e2cb03b9..bb7755cc 100644 --- a/Daybreak/Controls/Templates/BuildTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/BuildTemplate.xaml.cs @@ -56,11 +56,11 @@ public partial class BuildTemplate : UserControl private int attributePoints; [GenerateDependencyProperty] - private List availableSkills = new(); + private List availableSkills = []; public event EventHandler? BuildChanged; - public ObservableCollection PrimaryProfessions { get; } = new(); - public ObservableCollection SecondaryProfessions { get; } = new(); + public ObservableCollection PrimaryProfessions { get; } = []; + public ObservableCollection SecondaryProfessions { get; } = []; public BuildTemplate() : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), diff --git a/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs b/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs index 757a5ea4..482fcef9 100644 --- a/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs @@ -29,7 +29,7 @@ public partial class QuestLogTemplate : UserControl public QuestLogTemplate() { - this.quests = new List(); + this.quests = []; this.InitializeComponent(); } diff --git a/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs b/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs index fd6128a2..9b6ccde2 100644 --- a/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs @@ -49,7 +49,7 @@ public partial class TradeChatTemplate : UserControl [GenerateDependencyProperty] private TraderMessage selectedTraderMessage = default!; - public ObservableCollection TraderMessages { get; } = new(); + public ObservableCollection TraderMessages { get; } = []; public TradeChatTemplate() : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) diff --git a/Daybreak/Daybreak.csproj b/Daybreak/Daybreak.csproj index eed763c6..ca19e4dd 100644 --- a/Daybreak/Daybreak.csproj +++ b/Daybreak/Daybreak.csproj @@ -13,7 +13,7 @@ preview Daybreak.ico true - 0.9.8.151 + 0.9.8.152 true cfb2a489-db80-448d-a969-80270f314c46 True diff --git a/Daybreak/Launch/Launcher.cs b/Daybreak/Launch/Launcher.cs index 9158816f..ec8e2c20 100644 --- a/Daybreak/Launch/Launcher.cs +++ b/Daybreak/Launch/Launcher.cs @@ -16,11 +16,16 @@ using Microsoft.Extensions.Logging; using Slim; using Slim.Integration.ServiceCollection; using System; +using System.Runtime.CompilerServices; using System.Text; using System.Windows; using System.Windows.Extensions; using System.Windows.Media; +//The following lines are needed to expose internal objects to the test project +[assembly: InternalsVisibleTo("Daybreak.Tests")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] + namespace Daybreak.Launch; public sealed class Launcher : ExtendedApplication diff --git a/Daybreak/Launch/MainWindow.xaml.cs b/Daybreak/Launch/MainWindow.xaml.cs index da31f95b..0bd4cac1 100644 --- a/Daybreak/Launch/MainWindow.xaml.cs +++ b/Daybreak/Launch/MainWindow.xaml.cs @@ -153,69 +153,78 @@ public partial class MainWindow : MetroWindow private void OpenDropdownMenu() { - if (this.IsShowingDropdown) + this.Dispatcher.Invoke(() => { - return; - } + if (this.IsShowingDropdown) + { + return; + } - this.ToggleDropdownMenu(); + this.ToggleDropdownMenu(); + }); } private void CloseDropdownMenu() { - if (!this.IsShowingDropdown) + this.Dispatcher.Invoke(() => { - return; - } + if (!this.IsShowingDropdown) + { + return; + } - this.ToggleDropdownMenu(); + this.ToggleDropdownMenu(); + }); } private void ToggleDropdownMenu() { - var button = this.IsShowingDropdown ? + this.Dispatcher.Invoke(() => + { + var button = this.IsShowingDropdown ? this.ClosingSettingsButton : this.OpeningSettingsButton; - button.IsEnabled = false; - var widthAnimation = new DoubleAnimation - { - From = this.IsShowingDropdown ? - this.MenuContainer.ActualWidth : - 0, - To = this.IsShowingDropdown ? - 0 : - 300, - Duration = new Duration(TimeSpan.FromMilliseconds(200)), - DecelerationRatio = 0.7 - }; + button.IsEnabled = false; + var widthAnimation = new DoubleAnimation + { + From = this.IsShowingDropdown ? + this.MenuContainer.ActualWidth : + 0, + To = this.IsShowingDropdown ? + 0 : + 300, + Duration = new Duration(TimeSpan.FromMilliseconds(200)), + DecelerationRatio = 0.7 + }; - var opacityAnimation = new DoubleAnimation - { - From = this.IsShowingDropdown ? - this.MenuContainer.Opacity : - 0, - To = this.IsShowingDropdown ? - 0 : - 1, - Duration = new Duration(TimeSpan.FromMilliseconds(100)), - DecelerationRatio = 0.7 - }; + var opacityAnimation = new DoubleAnimation + { + From = this.IsShowingDropdown ? + this.MenuContainer.Opacity : + 0, + To = this.IsShowingDropdown ? + 0 : + 1, + Duration = new Duration(TimeSpan.FromMilliseconds(100)), + DecelerationRatio = 0.7 + }; - var storyBoard = new Storyboard(); - storyBoard.Children.Add(widthAnimation); - Storyboard.SetTarget(widthAnimation, this.MenuContainer); - Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(Grid.WidthProperty)); - storyBoard.Children.Add(opacityAnimation); - Storyboard.SetTarget(opacityAnimation, this.MenuContainer); - Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath(Grid.OpacityProperty)); + var storyBoard = new Storyboard(); + storyBoard.Children.Add(widthAnimation); + Storyboard.SetTarget(widthAnimation, this.MenuContainer); + Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(Grid.WidthProperty)); + storyBoard.Children.Add(opacityAnimation); + Storyboard.SetTarget(opacityAnimation, this.MenuContainer); + Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath(Grid.OpacityProperty)); - storyBoard.Completed += (_, _) => - { - button.IsEnabled = true; - this.IsShowingDropdown = !this.IsShowingDropdown; - }; + storyBoard.Completed += (_, _) => + { + button.IsEnabled = true; + this.IsShowingDropdown = !this.IsShowingDropdown; + }; - storyBoard.Begin(); + storyBoard.Begin(); + }); } private void CreditTextBox_MouseLeftButtonDown(object sender, EventArgs e) diff --git a/Daybreak/Models/ColorPalette.cs b/Daybreak/Models/ColorPalette.cs index e488bfd9..4de2c63c 100644 --- a/Daybreak/Models/ColorPalette.cs +++ b/Daybreak/Models/ColorPalette.cs @@ -24,8 +24,8 @@ public static class ColorPalette public readonly static Color BlueGrey = Color.FromArgb(255, 96, 125, 139); public readonly static Color Grey = Color.FromArgb(255, 158, 158, 158); - public readonly static List Colors = new() - { + public readonly static List Colors = + [ Pink, Amber, Purple, @@ -45,5 +45,5 @@ public static class ColorPalette Gold, BlueGrey, Grey - }; + ]; } diff --git a/Daybreak/Models/Guildwars/Build.cs b/Daybreak/Models/Guildwars/Build.cs index 5d3e4dc8..21bd1a4e 100644 --- a/Daybreak/Models/Guildwars/Build.cs +++ b/Daybreak/Models/Guildwars/Build.cs @@ -8,7 +8,7 @@ public sealed class Build public BuildMetadata? BuildMetadata { get; set; } public Profession Primary { get; set; } = Profession.None; public Profession Secondary { get; set; } = Profession.None; - public List Attributes { get; set; } = new(); - public List Skills { get; set; } = new() { Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill }; + public List Attributes { get; set; } = []; + public List Skills { get; set; } = [Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill, Skill.NoSkill]; public string? SourceUrl { get; set; } } diff --git a/Daybreak/Models/Guildwars/BuildMetadata.cs b/Daybreak/Models/Guildwars/BuildMetadata.cs index b0570d06..f032ff1c 100644 --- a/Daybreak/Models/Guildwars/BuildMetadata.cs +++ b/Daybreak/Models/Guildwars/BuildMetadata.cs @@ -16,7 +16,7 @@ public sealed class BuildMetadata public int SkillsLength { get; set; } public bool TailPresent { get; set; } public bool NewTemplate { get; set; } - public List SkillIds { get; set; } = new(); - public List AttributesIds { get; set; } = new(); - public List AttributePoints { get; set; } = new(); + public List SkillIds { get; set; } = []; + public List AttributesIds { get; set; } = []; + public List AttributePoints { get; set; } = []; } diff --git a/Daybreak/Models/Guildwars/GuildwarsIcon.cs b/Daybreak/Models/Guildwars/GuildwarsIcon.cs index fc23d8f3..95f856d7 100644 --- a/Daybreak/Models/Guildwars/GuildwarsIcon.cs +++ b/Daybreak/Models/Guildwars/GuildwarsIcon.cs @@ -21,8 +21,8 @@ public sealed class GuildwarsIcon : IWikiEntity public static readonly GuildwarsIcon DungeonBoss = new() { Id = 302779, Name = "Dungeon Boss" }; public static readonly GuildwarsIcon DungeonKey = new() { Id = 302777, Name = "Dungeon Key" }; - public static readonly List Icons = new() - { + public static readonly List Icons = + [ ResurrectionShrine, Collector, AreaMap, @@ -34,7 +34,7 @@ public sealed class GuildwarsIcon : IWikiEntity DungeonKey, Flag, Person - }; + ]; public static bool TryParse(int id, out GuildwarsIcon icon) { diff --git a/Daybreak/Models/Guildwars/InventoryData.cs b/Daybreak/Models/Guildwars/InventoryData.cs index eebd26d6..3f068ee5 100644 --- a/Daybreak/Models/Guildwars/InventoryData.cs +++ b/Daybreak/Models/Guildwars/InventoryData.cs @@ -6,10 +6,10 @@ public sealed class InventoryData { public Bag? Backpack { get; init; } public Bag? BeltPouch { get; init; } - public List Bags { get; init; } = new(); + public List Bags { get; init; } = []; public Bag? EquipmentPack { get; init; } public Bag? MaterialStorage { get; init; } public Bag? UnclaimedItems { get; init; } - public List StoragePanes { get; init; } = new(); + public List StoragePanes { get; init; } = []; public Bag? EquippedItems { get; init; } } diff --git a/Daybreak/Models/Guildwars/PathingData.cs b/Daybreak/Models/Guildwars/PathingData.cs index 9bbe6566..7b8c2e23 100644 --- a/Daybreak/Models/Guildwars/PathingData.cs +++ b/Daybreak/Models/Guildwars/PathingData.cs @@ -4,9 +4,9 @@ namespace Daybreak.Models.Guildwars; public sealed class PathingData { - public List Trapezoids { get; init; } = new(); - public List> ComputedPathingMaps { get; init; } = new(); - public List> OriginalPathingMaps { get; init; } = new(); - public List> OriginalAdjacencyList { get; init; } = new(); - public List> ComputedAdjacencyList { get; init; } = new(); + public List Trapezoids { get; init; } = []; + public List> ComputedPathingMaps { get; init; } = []; + public List> OriginalPathingMaps { get; init; } = []; + public List> OriginalAdjacencyList { get; init; } = []; + public List> ComputedAdjacencyList { get; init; } = []; } diff --git a/Daybreak/Models/Guildwars/Profession.cs b/Daybreak/Models/Guildwars/Profession.cs index c4cac322..8e91c4e1 100644 --- a/Daybreak/Models/Guildwars/Profession.cs +++ b/Daybreak/Models/Guildwars/Profession.cs @@ -18,7 +18,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:W/", WikiUrl = "https://wiki.guildwars.com/wiki/Warrior", PrimaryAttribute = Attribute.Strength, - Attributes = new List { Attribute.AxeMastery, Attribute.HammerMastery, Attribute.Swordsmanship, Attribute.Tactics } + Attributes = [Attribute.AxeMastery, Attribute.HammerMastery, Attribute.Swordsmanship, Attribute.Tactics] }; public static readonly Profession Ranger = new() { @@ -28,7 +28,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:R/", WikiUrl = "https://wiki.guildwars.com/wiki/Ranger", PrimaryAttribute = Attribute.Expertise, - Attributes = new List { Attribute.BeastMastery, Attribute.Marksmanship, Attribute.WildernessSurvival } + Attributes = [Attribute.BeastMastery, Attribute.Marksmanship, Attribute.WildernessSurvival] }; public static readonly Profession Monk = new() { @@ -38,7 +38,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:Mo/", WikiUrl = "https://wiki.guildwars.com/wiki/Monk", PrimaryAttribute = Attribute.DivineFavor, - Attributes = new List { Attribute.HealingPrayers, Attribute.SmitingPrayers, Attribute.ProtectionPrayers } + Attributes = [Attribute.HealingPrayers, Attribute.SmitingPrayers, Attribute.ProtectionPrayers] }; public static readonly Profession Necromancer = new() { @@ -48,7 +48,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:N/", WikiUrl = "https://wiki.guildwars.com/wiki/Necromancer", PrimaryAttribute = Attribute.SoulReaping, - Attributes = new List { Attribute.Curses, Attribute.BloodMagic, Attribute.DeathMagic } + Attributes = [Attribute.Curses, Attribute.BloodMagic, Attribute.DeathMagic] }; public static readonly Profession Mesmer = new() { @@ -58,7 +58,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:Me/", WikiUrl = "https://wiki.guildwars.com/wiki/Mesmer", PrimaryAttribute = Attribute.FastCasting, - Attributes = new List { Attribute.DominationMagic, Attribute.IllusionMagic, Attribute.InspirationMagic } + Attributes = [Attribute.DominationMagic, Attribute.IllusionMagic, Attribute.InspirationMagic] }; public static readonly Profession Elementalist = new() { @@ -68,7 +68,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:E/", WikiUrl = "https://wiki.guildwars.com/wiki/Elementalist", PrimaryAttribute = Attribute.EnergyStorage, - Attributes = new List { Attribute.AirMagic, Attribute.EarthMagic, Attribute.FireMagic, Attribute.WaterMagic } + Attributes = [Attribute.AirMagic, Attribute.EarthMagic, Attribute.FireMagic, Attribute.WaterMagic] }; public static readonly Profession Assassin = new() { @@ -78,7 +78,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:A/", WikiUrl = "https://wiki.guildwars.com/wiki/Assassin", PrimaryAttribute = Attribute.CriticalStrikes, - Attributes = new List { Attribute.DaggerMastery, Attribute.DeadlyArts, Attribute.ShadowArts } + Attributes = [Attribute.DaggerMastery, Attribute.DeadlyArts, Attribute.ShadowArts] }; public static readonly Profession Ritualist = new() { @@ -88,7 +88,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:Rt/", WikiUrl = "https://wiki.guildwars.com/wiki/Ritualist", PrimaryAttribute = Attribute.SpawningPower, - Attributes = new List { Attribute.ChannelingMagic, Attribute.Communing, Attribute.RestorationMagic } + Attributes = [Attribute.ChannelingMagic, Attribute.Communing, Attribute.RestorationMagic] }; public static readonly Profession Paragon = new() { @@ -98,7 +98,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:P/", WikiUrl = "https://wiki.guildwars.com/wiki/Paragon", PrimaryAttribute = Attribute.Leadership, - Attributes = new List { Attribute.Command, Attribute.Motivation, Attribute.SpearMastery } + Attributes = [Attribute.Command, Attribute.Motivation, Attribute.SpearMastery] }; public static readonly Profession Dervish = new() { @@ -108,7 +108,7 @@ public sealed class Profession : IWikiEntity BuildsUrl = "https://gwpvx.fandom.com/wiki/Special:PrefixIndex/Build:D/", WikiUrl = "https://wiki.guildwars.com/wiki/Dervish", PrimaryAttribute = Attribute.Mysticism, - Attributes = new List { Attribute.EarthPrayers, Attribute.ScytheMastery, Attribute.WindPrayers } + Attributes = [Attribute.EarthPrayers, Attribute.ScytheMastery, Attribute.WindPrayers] }; public static IEnumerable Professions = new List { @@ -169,7 +169,7 @@ public sealed class Profession : IWikiEntity public string? Name { get; init; } public int Id { get; set; } public Attribute? PrimaryAttribute { get; private set; } - public List Attributes { get; private set; } = new List(); + public List Attributes { get; private set; } = []; private Profession() { } diff --git a/Daybreak/Models/Guildwars/Title.cs b/Daybreak/Models/Guildwars/Title.cs index b1f8eaa4..e6828f3a 100644 --- a/Daybreak/Models/Guildwars/Title.cs +++ b/Daybreak/Models/Guildwars/Title.cs @@ -10,51 +10,51 @@ namespace Daybreak.Models.Guildwars; public sealed class Title : IWikiEntity { public static readonly Title None = new() { Id = 0xFF, }; - public static readonly Title Hero = new() { Id = 0, Name = "Hero", WikiUrl = "https://wiki.guildwars.com/wiki/Hero_(title)", Tiers = new List { "Hero", "Fierce Hero", "Mighty Hero", "Deadly Hero", "Terrifying Hero", "Conquering Hero", "Subjugating Hero", "Vanquishing Hero", "Renowed Hero", "Illustrious Hero", "Eminent Hero", "King's Hero", "Emperor's Hero", "Balthazar's Hero", "Legendary Hero" } }; - public static readonly Title TyrianCartographer = new() { Id = 1, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = new List { "Tyrian Explorer", "Tyrian Pathfinder", "Tyrian Trailblazer", "Tyrian Cartographer", "Tyrian Master Cartographer", "Tyrian Grandmaster Cartographer" } }; - public static readonly Title CanthanCartographer = new() { Id = 2, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = new List { "Canthan Explorer", "Canthan Pathfinder", "Canthan Trailblazer", "Canthan Cartographer", "Canthan Master Cartographer", "Canthan Grandmaster Cartographer" } }; - public static readonly Title Gladiator = new() { Id = 3, Name = "Gladiator", WikiUrl = "https://wiki.guildwars.com/wiki/Gladiator", Tiers = new List { "Gladiator", "Fierce Gladiator", "Mighty Gladiator", "Deadly Gladiator", "Terrifying Gladiator", "Conquering Gladiator", "Subjugating Gladiator", "Vanquishing Gladiator", "King's Gladiator", "Emperor's Gladiator", "Balthazar's Gladiator", "Legendary Gladiator" } }; - public static readonly Title Champion = new() { Id = 4, Name = "Champion", WikiUrl = "https://wiki.guildwars.com/wiki/Champion", Tiers = new List { "Champion", "Fierce Champion", "Mighty Champion", "Deadly Champion", "Terrifying Champion", "Conquering Champion", "Subjugating Champion", "Vanquishing Champion", "King's Champion", "Emperor's Champion", "Balthazar's Champion", "Legendary Champion" } }; - public static readonly Title Kurzick = new() { Id = 5, Name = "Faction Allegiance", WikiUrl = "https://wiki.guildwars.com/wiki/Allegiance_rank", Tiers = new List { "Kurzick Supporter", "Friend of the Kurzicks", "Companion of the Kurzicks", "Ally of the Kurzicks", "Sentinel of the Kurzicks", "Steward of the Kurzicks", "Defender of the Kurzicks", "Warden of the Kurzicks", "Bastion of the Kurzicks", "Champion of the Kurzicks", "Hero of the Kurzicks", "Savior of the Kurzicks" } }; - public static readonly Title Luxon = new() { Id = 6, Name = "Faction Allegiance", WikiUrl = "https://wiki.guildwars.com/wiki/Allegiance_rank", Tiers = new List { "Luxon Supporter", "Friend of the Kurzicks", "Companion of the Luxons", "Ally of the Luxons", "Sentinel of the Luxons", "Steward of the Luxons", "Defender of the Luxons", "Warden of the Luxons", "Bastion of the Luxons", "Champion of the Luxons", "Hero of the Luxons", "Savior of the Luxons" } }; - public static readonly Title Drunkard = new() { Id = 7, Name = "Drunkard", WikiUrl = "https://wiki.guildwars.com/wiki/Drunkard", Tiers = new List { "Drunkard", "Incorrigible Ale-Hound" } }; - public static readonly Title Survivor = new() { Id = 9, Name = "Survivor", WikiUrl = "https://wiki.guildwars.com/wiki/Survivor", Tiers = new List { "Survivor", "Indomitable Survivor", "Legendary Survivor" } }; - public static readonly Title KindOfABigDeal = new() { Id = 10, Name = "Kind of a Big Deal", WikiUrl = "https://wiki.guildwars.com/wiki/Kind_of_a_Big_Deal", Tiers = new List { "Kind Of A Big Deal", "People Know Me", "I'm Very Important", "I Have Many Leather-Bound Books", "My Guild Hall Smells of Rich Mahogany", "God Walking Amongst Mere Mortals" } }; - public static readonly Title ProtectorTyria = new() { Id = 13, Name = "Protector of Tyria", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = new List { "Protector of Tyria" } }; - public static readonly Title ProtectorCantha = new() { Id = 14, Name = "Protector of Cantha", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = new List { "Protector of Cantha" } }; - public static readonly Title Lucky = new() { Id = 15, Name = "Lucky", WikiUrl = "https://wiki.guildwars.com/wiki/Lucky_and_Unlucky", Tiers = new List { "Charmed", "Lucky", "Favored", "Prosperous", "Golden", "Blessed by Fate" } }; - public static readonly Title Unlucky = new() { Id = 16, Name = "Unlucky", WikiUrl = "https://wiki.guildwars.com/wiki/Lucky_and_Unlucky", Tiers = new List { "Hapless", "Unlucky", "Unfavored", "Tragic", "Wretched", "Jinxed", "Cursed by Fate" } }; - public static readonly Title Sunspear = new() { Id = 17, Name = "Sunspear", WikiUrl = "https://wiki.guildwars.com/wiki/Sunspear_rank", Tiers = new List { "Sunspear Sergeant", "Sunspear Master Sergeant", "Second Spear", "First Spear", "Sunspear Captain", "Sunspear Commander", "Sunspear General", "Sunspear Castellan", "Spearmarshal", "Legendary Spearmarshal" } }; - public static readonly Title ElonianCartographer = new() { Id = 18, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = new List { "Elonian Explorer", "Elonian Pathfinder", "Elonian Trailblazer", "Elonian Cartographer", "Elonian Master Cartographer", "Elonian Grandmaster Cartographer" } }; - public static readonly Title ProtectorElona = new() { Id = 19, Name = "Protector of Elona", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = new List { "Protector of Elona" } }; - public static readonly Title Lightbringer = new() { Id = 20, Name = "Lightbringer", WikiUrl = "https://wiki.guildwars.com/wiki/Lightbringer_rank", Tiers = new List { "Lightbringer", "Adept Lightbringer", "Brave Lightbringer", "Mighty Lightbringer", "Conquering Lightbringer", "Vanquishing Lightbringer", "Revered Lightbringer", "Holy Lightbringer" } }; - public static readonly Title LegendaryDefenderOfAscalon = new() { Id = 21, Name = "Defender of Ascalon", WikiUrl = "https://wiki.guildwars.com/wiki/Defender_of_Ascalon", Tiers = new List { "Legendary Defender of Ascalon" } }; - public static readonly Title Commander = new() { Id = 22, Name = "Commander", WikiUrl = "https://wiki.guildwars.com/wiki/Commander", Tiers = new List { "Commander", "Victorious Commander", "Triumphant Commander", "Keen Commander", "Battle Commander", "Field Commander", "Lieutenant Commander", "Wing Commander", "Cobra Commander", "Supreme Commander", "Master And Commander", "Legendary Commander" } }; - public static readonly Title Gamer = new() { Id = 23, Name = "Gamer", WikiUrl = "https://wiki.guildwars.com/wiki/Gamer", Tiers = new List { "Skillz", "Pro Skillz", "Numchuck Skillz", "Mad Skillz", "Über Micro Skillz", "Gosu Skillz", "1337 Skillz", "iddqd Skillz", "T3h Haxz0rz Skillz", "Pure Pwnage Skillz", "These skillz go to", "Real Ultimate Power Skillz" } }; - public static readonly Title SkillHunterTyria = new() { Id = 24, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = new List { "Tyrian Elite Skill Hunter" } }; - public static readonly Title VanquisherTyria = new() { Id = 25, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = new List { "Tyrian Vanquisher" } }; - public static readonly Title SkillHunterCantha = new() { Id = 26, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = new List { "Canthan Elite Skill Hunter" } }; - public static readonly Title VanquisherCantha = new() { Id = 27, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = new List { "Canthan Vanquisher" } }; - public static readonly Title SkillHunterElona = new() { Id = 28, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = new List { "Elonian Elite Skill Hunter" } }; - public static readonly Title VanquisherElona = new() { Id = 29, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = new List { "Elonian Vanquisher" } }; - public static readonly Title LegendaryCartographer = new() { Id = 30, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = new List { "Legendary Cartographer" } }; - public static readonly Title LegendaryGuardian = new() { Id = 31, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = new List { "Legendary Guardian" } }; - public static readonly Title LegendarySkillHunter = new() { Id = 32, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = new List { "Legendary Skill Hunter" } }; - public static readonly Title LegendaryVanquisher = new() { Id = 33, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = new List { "Legendary Vanquisher" } }; - public static readonly Title SweetTooth = new() { Id = 34, Name = "Sweet Tooth", WikiUrl = "https://wiki.guildwars.com/wiki/Sweet_Tooth", Tiers = new List { "Sweet Tooth", "Connoisseur of Confectionaries" } }; - public static readonly Title GuardianTyria = new() { Id = 35, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = new List { "Guardian of Tyria" } }; - public static readonly Title GuardianCantha = new() { Id = 36, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = new List { "Guardian of Cantha" } }; - public static readonly Title GuardianElona = new() { Id = 37, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = new List { "Guardian of Elona" } }; - public static readonly Title Asura = new() { Id = 38, Name = "Asura", WikiUrl = "https://wiki.guildwars.com/wiki/Asura_rank", Tiers = new List { "Not Too Smelly", "Not Too Dopey", "Not Too Clumsy", "Not Too Boring", "Not Too Annoying", "Not Too Grumpy", "Not Too Silly", "Not Too Lazy", "Not Too Foolish", "Not Too Shabby" } }; - public static readonly Title Deldrimor = new() { Id = 39, Name = "Deldrimor", WikiUrl = "https://wiki.guildwars.com/wiki/Deldrimor_rank", Tiers = new List { "Delver", "Stout Delver", "Gutsy Delver", "Risky Delver", "Bold Delver", "Daring Delver", "Adventurous Delver", "Courageous Delver", "Epic Delver", "Legendary Delver" } }; - public static readonly Title EbonVanguard = new() { Id = 40, Name = "Ebon Vanguard", WikiUrl = "https://wiki.guildwars.com/wiki/Ebon_Vanguard_rank", Tiers = new List { "Agent", "Covert Agent", "Stealth Agent", "Mysterious Agent", "Shadow Agent", "Underground Agent", "Special Agent", "Valued Agent", "Superior Agent", "Secret Agent" } }; - public static readonly Title Norn = new() { Id = 41, Name = "Norn", WikiUrl = "https://wiki.guildwars.com/wiki/Norn_rank", Tiers = new List { "Slayer of Imps", "Slayer of Beasts", "Slayer of Nightmares", "Slayer of Giants", "Slayer of Wurms", "Slayer of Demons", "Slayer of Heroes", "Slayer of Champions", "Slayer of Hordes", "Slayer of All" } }; - public static readonly Title MasterOfTheNorth = new() { Id = 42, Name = "Master of the North", WikiUrl = "https://wiki.guildwars.com/wiki/Master_of_the_North", Tiers = new List { "Adventurer of the North", "Pioneer of the North", "Veteran of the North", "Conqueror of the North", "Master of the North", "Legendary Master of the North" } }; - public static readonly Title PartyAnimal = new() { Id = 43, Name = "Party Animal", WikiUrl = "https://wiki.guildwars.com/wiki/Party_Animal", Tiers = new List { "Party Animal", "Life of the Party" } }; - public static readonly Title Zaishen = new() { Id = 44, Name = "Zaishen", WikiUrl = "https://wiki.guildwars.com/wiki/Zaishen_rank", Tiers = new List { "Zaishen Supporter", "Friend of the Zaishen", "Companion of the Zaishen", "Ally of the Zaishen", "Sentinel of the Zaishen", "Steward of the Zaishen", "Defender of the Zaishen", "Warden of the Zaishen", "Bastion of the Zaishen", "Champion of the Zaishen", "Hero of the Zaishen", "Legendary Hero of the Zaishen" } }; - public static readonly Title TreasureHunter = new() { Id = 45, Name = "Treasure Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Treasure_Hunter", Tiers = new List { "Treasure Hunter", "Adept Treasure Hunter", "Advanced Treasure Hunter", "Expert Treasure Hunter", "Elite Treasure Hunter", "Master Treasure Hunter", "Grandmaster Treasure Hunter" } }; - public static readonly Title Wisdom = new() { Id = 46, Name = "Wisdom", WikiUrl = "https://wiki.guildwars.com/wiki/Wisdom", Tiers = new List { "Seeker of Wisdom", "Collector of Wisdom", "Devotee of Wisdom", "Devourer of Wisdom", "Font of Wisdom", "Oracle of Wisdom", "Source of Wisdom" } }; - public static readonly Title Codex = new() { Id = 47, Name = "Codex", WikiUrl = "https://wiki.guildwars.com/wiki/Codex_Title", Tiers = new List { "Codex Initiate", "Codex Acolyte", "Codex Disciple", "Codex Zealot", "Codex Stalwart", "Codex Adept", "Codex Exemplar", "Codex Prodigy", "Codex Champion", "Codex Paragon", "Codex Master", "Codex Grandmaster" } }; + public static readonly Title Hero = new() { Id = 0, Name = "Hero", WikiUrl = "https://wiki.guildwars.com/wiki/Hero_(title)", Tiers = ["Hero", "Fierce Hero", "Mighty Hero", "Deadly Hero", "Terrifying Hero", "Conquering Hero", "Subjugating Hero", "Vanquishing Hero", "Renowed Hero", "Illustrious Hero", "Eminent Hero", "King's Hero", "Emperor's Hero", "Balthazar's Hero", "Legendary Hero"] }; + public static readonly Title TyrianCartographer = new() { Id = 1, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = ["Tyrian Explorer", "Tyrian Pathfinder", "Tyrian Trailblazer", "Tyrian Cartographer", "Tyrian Master Cartographer", "Tyrian Grandmaster Cartographer"] }; + public static readonly Title CanthanCartographer = new() { Id = 2, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = ["Canthan Explorer", "Canthan Pathfinder", "Canthan Trailblazer", "Canthan Cartographer", "Canthan Master Cartographer", "Canthan Grandmaster Cartographer"] }; + public static readonly Title Gladiator = new() { Id = 3, Name = "Gladiator", WikiUrl = "https://wiki.guildwars.com/wiki/Gladiator", Tiers = ["Gladiator", "Fierce Gladiator", "Mighty Gladiator", "Deadly Gladiator", "Terrifying Gladiator", "Conquering Gladiator", "Subjugating Gladiator", "Vanquishing Gladiator", "King's Gladiator", "Emperor's Gladiator", "Balthazar's Gladiator", "Legendary Gladiator"] }; + public static readonly Title Champion = new() { Id = 4, Name = "Champion", WikiUrl = "https://wiki.guildwars.com/wiki/Champion", Tiers = ["Champion", "Fierce Champion", "Mighty Champion", "Deadly Champion", "Terrifying Champion", "Conquering Champion", "Subjugating Champion", "Vanquishing Champion", "King's Champion", "Emperor's Champion", "Balthazar's Champion", "Legendary Champion"] }; + public static readonly Title Kurzick = new() { Id = 5, Name = "Faction Allegiance", WikiUrl = "https://wiki.guildwars.com/wiki/Allegiance_rank", Tiers = ["Kurzick Supporter", "Friend of the Kurzicks", "Companion of the Kurzicks", "Ally of the Kurzicks", "Sentinel of the Kurzicks", "Steward of the Kurzicks", "Defender of the Kurzicks", "Warden of the Kurzicks", "Bastion of the Kurzicks", "Champion of the Kurzicks", "Hero of the Kurzicks", "Savior of the Kurzicks"] }; + public static readonly Title Luxon = new() { Id = 6, Name = "Faction Allegiance", WikiUrl = "https://wiki.guildwars.com/wiki/Allegiance_rank", Tiers = ["Luxon Supporter", "Friend of the Kurzicks", "Companion of the Luxons", "Ally of the Luxons", "Sentinel of the Luxons", "Steward of the Luxons", "Defender of the Luxons", "Warden of the Luxons", "Bastion of the Luxons", "Champion of the Luxons", "Hero of the Luxons", "Savior of the Luxons"] }; + public static readonly Title Drunkard = new() { Id = 7, Name = "Drunkard", WikiUrl = "https://wiki.guildwars.com/wiki/Drunkard", Tiers = ["Drunkard", "Incorrigible Ale-Hound"] }; + public static readonly Title Survivor = new() { Id = 9, Name = "Survivor", WikiUrl = "https://wiki.guildwars.com/wiki/Survivor", Tiers = ["Survivor", "Indomitable Survivor", "Legendary Survivor"] }; + public static readonly Title KindOfABigDeal = new() { Id = 10, Name = "Kind of a Big Deal", WikiUrl = "https://wiki.guildwars.com/wiki/Kind_of_a_Big_Deal", Tiers = ["Kind Of A Big Deal", "People Know Me", "I'm Very Important", "I Have Many Leather-Bound Books", "My Guild Hall Smells of Rich Mahogany", "God Walking Amongst Mere Mortals"] }; + public static readonly Title ProtectorTyria = new() { Id = 13, Name = "Protector of Tyria", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = ["Protector of Tyria"] }; + public static readonly Title ProtectorCantha = new() { Id = 14, Name = "Protector of Cantha", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = ["Protector of Cantha"] }; + public static readonly Title Lucky = new() { Id = 15, Name = "Lucky", WikiUrl = "https://wiki.guildwars.com/wiki/Lucky_and_Unlucky", Tiers = ["Charmed", "Lucky", "Favored", "Prosperous", "Golden", "Blessed by Fate"] }; + public static readonly Title Unlucky = new() { Id = 16, Name = "Unlucky", WikiUrl = "https://wiki.guildwars.com/wiki/Lucky_and_Unlucky", Tiers = ["Hapless", "Unlucky", "Unfavored", "Tragic", "Wretched", "Jinxed", "Cursed by Fate"] }; + public static readonly Title Sunspear = new() { Id = 17, Name = "Sunspear", WikiUrl = "https://wiki.guildwars.com/wiki/Sunspear_rank", Tiers = ["Sunspear Sergeant", "Sunspear Master Sergeant", "Second Spear", "First Spear", "Sunspear Captain", "Sunspear Commander", "Sunspear General", "Sunspear Castellan", "Spearmarshal", "Legendary Spearmarshal"] }; + public static readonly Title ElonianCartographer = new() { Id = 18, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = ["Elonian Explorer", "Elonian Pathfinder", "Elonian Trailblazer", "Elonian Cartographer", "Elonian Master Cartographer", "Elonian Grandmaster Cartographer"] }; + public static readonly Title ProtectorElona = new() { Id = 19, Name = "Protector of Elona", WikiUrl = "https://wiki.guildwars.com/wiki/Protector", Tiers = ["Protector of Elona"] }; + public static readonly Title Lightbringer = new() { Id = 20, Name = "Lightbringer", WikiUrl = "https://wiki.guildwars.com/wiki/Lightbringer_rank", Tiers = ["Lightbringer", "Adept Lightbringer", "Brave Lightbringer", "Mighty Lightbringer", "Conquering Lightbringer", "Vanquishing Lightbringer", "Revered Lightbringer", "Holy Lightbringer"] }; + public static readonly Title LegendaryDefenderOfAscalon = new() { Id = 21, Name = "Defender of Ascalon", WikiUrl = "https://wiki.guildwars.com/wiki/Defender_of_Ascalon", Tiers = ["Legendary Defender of Ascalon"] }; + public static readonly Title Commander = new() { Id = 22, Name = "Commander", WikiUrl = "https://wiki.guildwars.com/wiki/Commander", Tiers = ["Commander", "Victorious Commander", "Triumphant Commander", "Keen Commander", "Battle Commander", "Field Commander", "Lieutenant Commander", "Wing Commander", "Cobra Commander", "Supreme Commander", "Master And Commander", "Legendary Commander"] }; + public static readonly Title Gamer = new() { Id = 23, Name = "Gamer", WikiUrl = "https://wiki.guildwars.com/wiki/Gamer", Tiers = ["Skillz", "Pro Skillz", "Numchuck Skillz", "Mad Skillz", "Über Micro Skillz", "Gosu Skillz", "1337 Skillz", "iddqd Skillz", "T3h Haxz0rz Skillz", "Pure Pwnage Skillz", "These skillz go to", "Real Ultimate Power Skillz"] }; + public static readonly Title SkillHunterTyria = new() { Id = 24, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = ["Tyrian Elite Skill Hunter"] }; + public static readonly Title VanquisherTyria = new() { Id = 25, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = ["Tyrian Vanquisher"] }; + public static readonly Title SkillHunterCantha = new() { Id = 26, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = ["Canthan Elite Skill Hunter"] }; + public static readonly Title VanquisherCantha = new() { Id = 27, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = ["Canthan Vanquisher"] }; + public static readonly Title SkillHunterElona = new() { Id = 28, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = ["Elonian Elite Skill Hunter"] }; + public static readonly Title VanquisherElona = new() { Id = 29, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = ["Elonian Vanquisher"] }; + public static readonly Title LegendaryCartographer = new() { Id = 30, Name = "Cartographer", WikiUrl = "https://wiki.guildwars.com/wiki/Cartographer", Tiers = ["Legendary Cartographer"] }; + public static readonly Title LegendaryGuardian = new() { Id = 31, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = ["Legendary Guardian"] }; + public static readonly Title LegendarySkillHunter = new() { Id = 32, Name = "Skill Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Skill_Hunter", Tiers = ["Legendary Skill Hunter"] }; + public static readonly Title LegendaryVanquisher = new() { Id = 33, Name = "Vanquisher", WikiUrl = "https://wiki.guildwars.com/wiki/Vanquisher", Tiers = ["Legendary Vanquisher"] }; + public static readonly Title SweetTooth = new() { Id = 34, Name = "Sweet Tooth", WikiUrl = "https://wiki.guildwars.com/wiki/Sweet_Tooth", Tiers = ["Sweet Tooth", "Connoisseur of Confectionaries"] }; + public static readonly Title GuardianTyria = new() { Id = 35, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = ["Guardian of Tyria"] }; + public static readonly Title GuardianCantha = new() { Id = 36, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = ["Guardian of Cantha"] }; + public static readonly Title GuardianElona = new() { Id = 37, Name = "Guardian", WikiUrl = "https://wiki.guildwars.com/wiki/Guardian_(title)", Tiers = ["Guardian of Elona"] }; + public static readonly Title Asura = new() { Id = 38, Name = "Asura", WikiUrl = "https://wiki.guildwars.com/wiki/Asura_rank", Tiers = ["Not Too Smelly", "Not Too Dopey", "Not Too Clumsy", "Not Too Boring", "Not Too Annoying", "Not Too Grumpy", "Not Too Silly", "Not Too Lazy", "Not Too Foolish", "Not Too Shabby"] }; + public static readonly Title Deldrimor = new() { Id = 39, Name = "Deldrimor", WikiUrl = "https://wiki.guildwars.com/wiki/Deldrimor_rank", Tiers = ["Delver", "Stout Delver", "Gutsy Delver", "Risky Delver", "Bold Delver", "Daring Delver", "Adventurous Delver", "Courageous Delver", "Epic Delver", "Legendary Delver"] }; + public static readonly Title EbonVanguard = new() { Id = 40, Name = "Ebon Vanguard", WikiUrl = "https://wiki.guildwars.com/wiki/Ebon_Vanguard_rank", Tiers = ["Agent", "Covert Agent", "Stealth Agent", "Mysterious Agent", "Shadow Agent", "Underground Agent", "Special Agent", "Valued Agent", "Superior Agent", "Secret Agent"] }; + public static readonly Title Norn = new() { Id = 41, Name = "Norn", WikiUrl = "https://wiki.guildwars.com/wiki/Norn_rank", Tiers = ["Slayer of Imps", "Slayer of Beasts", "Slayer of Nightmares", "Slayer of Giants", "Slayer of Wurms", "Slayer of Demons", "Slayer of Heroes", "Slayer of Champions", "Slayer of Hordes", "Slayer of All"] }; + public static readonly Title MasterOfTheNorth = new() { Id = 42, Name = "Master of the North", WikiUrl = "https://wiki.guildwars.com/wiki/Master_of_the_North", Tiers = ["Adventurer of the North", "Pioneer of the North", "Veteran of the North", "Conqueror of the North", "Master of the North", "Legendary Master of the North"] }; + public static readonly Title PartyAnimal = new() { Id = 43, Name = "Party Animal", WikiUrl = "https://wiki.guildwars.com/wiki/Party_Animal", Tiers = ["Party Animal", "Life of the Party"] }; + public static readonly Title Zaishen = new() { Id = 44, Name = "Zaishen", WikiUrl = "https://wiki.guildwars.com/wiki/Zaishen_rank", Tiers = ["Zaishen Supporter", "Friend of the Zaishen", "Companion of the Zaishen", "Ally of the Zaishen", "Sentinel of the Zaishen", "Steward of the Zaishen", "Defender of the Zaishen", "Warden of the Zaishen", "Bastion of the Zaishen", "Champion of the Zaishen", "Hero of the Zaishen", "Legendary Hero of the Zaishen"] }; + public static readonly Title TreasureHunter = new() { Id = 45, Name = "Treasure Hunter", WikiUrl = "https://wiki.guildwars.com/wiki/Treasure_Hunter", Tiers = ["Treasure Hunter", "Adept Treasure Hunter", "Advanced Treasure Hunter", "Expert Treasure Hunter", "Elite Treasure Hunter", "Master Treasure Hunter", "Grandmaster Treasure Hunter"] }; + public static readonly Title Wisdom = new() { Id = 46, Name = "Wisdom", WikiUrl = "https://wiki.guildwars.com/wiki/Wisdom", Tiers = ["Seeker of Wisdom", "Collector of Wisdom", "Devotee of Wisdom", "Devourer of Wisdom", "Font of Wisdom", "Oracle of Wisdom", "Source of Wisdom"] }; + public static readonly Title Codex = new() { Id = 47, Name = "Codex", WikiUrl = "https://wiki.guildwars.com/wiki/Codex_Title", Tiers = ["Codex Initiate", "Codex Acolyte", "Codex Disciple", "Codex Zealot", "Codex Stalwart", "Codex Adept", "Codex Exemplar", "Codex Prodigy", "Codex Champion", "Codex Paragon", "Codex Master", "Codex Grandmaster"] }; public static readonly IEnumerable Titles = new List<Title> { diff --git a/Daybreak/Models/PathfindingCache.cs b/Daybreak/Models/PathfindingCache.cs index f12afb1d..f760d465 100644 --- a/Daybreak/Models/PathfindingCache.cs +++ b/Daybreak/Models/PathfindingCache.cs @@ -5,6 +5,6 @@ using System.Windows.Media; namespace Daybreak.Models; public sealed class PathfindingCache { - public List<PathfindingResponse> PathfindingResponses { get; set; } = new List<PathfindingResponse>(); - public List<Color> Colors { get; set; } = new List<Color>(); + public List<PathfindingResponse> PathfindingResponses { get; set; } = []; + public List<Color> Colors { get; set; } = []; } diff --git a/Daybreak/Models/Versioning/Version.cs b/Daybreak/Models/Versioning/Version.cs index f98a05ed..08f2e650 100644 --- a/Daybreak/Models/Versioning/Version.cs +++ b/Daybreak/Models/Versioning/Version.cs @@ -7,7 +7,9 @@ namespace Daybreak.Models.Versioning; public sealed class Version : IEquatable<Version>, IComparable<Version> { - private List<VersionToken> parts = new(); + public static readonly Version Zero = new("0"); + + private List<VersionToken> parts = []; public bool HasPrefix { get; set; } public IEnumerable<VersionToken> VersionTokens { get => this.parts; } @@ -190,7 +192,7 @@ public sealed class Version : IEquatable<Version>, IComparable<Version> tokens[0] = tokens[0][1..]; } - parts = new List<VersionToken>(); + parts = []; for(int i = 0; i < tokens.Length - 1; i++) { var token = tokens[i]; diff --git a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs index 3c4bd8d2..f8cec7c3 100644 --- a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs +++ b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs @@ -8,9 +8,7 @@ using Daybreak.Services.Notifications; using Daybreak.Services.Privilege; using Daybreak.Utils; using Daybreak.Views; -using HarfBuzzSharp; using Microsoft.Extensions.Logging; -using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; @@ -20,9 +18,7 @@ using System.Diagnostics; using System.Extensions; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Security; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -31,7 +27,7 @@ using static Daybreak.Utils.NativeMethods; namespace Daybreak.Services.ApplicationLauncher; -public class ApplicationLauncher : IApplicationLauncher +internal sealed class ApplicationLauncher : IApplicationLauncher { private const int MaxRetries = 10; private const string ProcessName = "gw"; diff --git a/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs b/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs index 2249b43e..770b1614 100644 --- a/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs +++ b/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs @@ -8,15 +8,15 @@ namespace Daybreak.Services.BuildTemplates; /// Attribute point calculator. /// Based on https://wiki.guildwars.com/wiki/Attribute_point. /// </summary> -public sealed class AttributePointCalculator : IAttributePointCalculator +internal sealed class AttributePointCalculator : IAttributePointCalculator { private const int MaxRank = 12; private const int MinRank = 0; - private static readonly List<int> PointsRequiredToIncreaseRankMapping = new() - { + private static readonly List<int> PointsRequiredToIncreaseRankMapping = + [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, int.MaxValue - }; + ]; public int MaximumAttributePoints => 200; diff --git a/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs b/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs index 23145463..67cbfc42 100644 --- a/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs +++ b/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.BuildTemplates; -public sealed class BuildTemplateManager : IBuildTemplateManager +internal sealed class BuildTemplateManager : IBuildTemplateManager { private const string DecodingLookupTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; private readonly static string BuildsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Guild Wars\\Templates\\Skills"; @@ -194,7 +194,7 @@ public sealed class BuildTemplateManager : IBuildTemplateManager var build = new Build() { BuildMetadata = buildMetadata, - Skills = new() + Skills = [] }; if (Profession.TryParse(buildMetadata.PrimaryProfessionId, out var primaryProfession) is false) diff --git a/Daybreak/Services/Charts/LiveChartInitializer.cs b/Daybreak/Services/Charts/LiveChartInitializer.cs index 1f68b97b..fd6cd4e4 100644 --- a/Daybreak/Services/Charts/LiveChartInitializer.cs +++ b/Daybreak/Services/Charts/LiveChartInitializer.cs @@ -8,7 +8,7 @@ using System.Windows.Extensions.Services; namespace Daybreak.Services.Charts; -public sealed class LiveChartInitializer : ILiveChartInitializer, IApplicationLifetimeService +internal sealed class LiveChartInitializer : ILiveChartInitializer, IApplicationLifetimeService { public void OnClosing() { diff --git a/Daybreak/Services/Credentials/CredentialManager.cs b/Daybreak/Services/Credentials/CredentialManager.cs index 30fe2bc7..f140768f 100644 --- a/Daybreak/Services/Credentials/CredentialManager.cs +++ b/Daybreak/Services/Credentials/CredentialManager.cs @@ -11,7 +11,7 @@ using System.Text; namespace Daybreak.Services.Credentials; -public sealed class CredentialManager : ICredentialManager +internal sealed class CredentialManager : ICredentialManager { private static readonly byte[] Entropy = Convert.FromBase64String("uXB8Vmz5MmuDar36v8SRGzpALi0Wv5Gx"); private readonly ILogger<CredentialManager> logger; @@ -44,7 +44,7 @@ public sealed class CredentialManager : ICredentialManager if (config.ProtectedLoginCredentials is null || config.ProtectedLoginCredentials.Count == 0) { this.logger.LogInformation("No credentials found"); - return new List<LoginCredentials>(); + return []; } return config diff --git a/Daybreak/Services/DSOAL/DSOALService.cs b/Daybreak/Services/DSOAL/DSOALService.cs index 72f48f42..262b8614 100644 --- a/Daybreak/Services/DSOAL/DSOALService.cs +++ b/Daybreak/Services/DSOAL/DSOALService.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Configuration; using System.Core.Extensions; -using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; @@ -23,7 +22,7 @@ namespace Daybreak.Services.DSOAL; /// <summary> /// Service for managing DSOAL for GW1. Credits to: https://lemmy.wtf/post/27911 /// </summary> -public sealed class DSOALService : IDSOALService +internal sealed class DSOALService : IDSOALService { public const string DSOALFixAdminMessage = "Daybreak has detected an issue with the DSOAL installation. In order to fix this issue, Daybreak will need to restart as administrator. DSOAL will not work until then."; public const string DSOALFixRegistryKey = "DSOAL/FixSymbolicLink"; diff --git a/Daybreak/Services/Downloads/DownloadService.cs b/Daybreak/Services/Downloads/DownloadService.cs index 082e6249..8cd91462 100644 --- a/Daybreak/Services/Downloads/DownloadService.cs +++ b/Daybreak/Services/Downloads/DownloadService.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.Downloads; -public sealed class DownloadService : IDownloadService +internal sealed class DownloadService : IDownloadService { private const double StatusUpdateInterval = 50; private const string MetricUnits = "bytes/sec"; diff --git a/Daybreak/Services/Drawing/DrawingService.cs b/Daybreak/Services/Drawing/DrawingService.cs index 4b98f1fa..36634c3f 100644 --- a/Daybreak/Services/Drawing/DrawingService.cs +++ b/Daybreak/Services/Drawing/DrawingService.cs @@ -11,7 +11,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; namespace Daybreak.Services.Drawing; -public sealed class DrawingService : IDrawingService, IDrawingModuleProducer +internal sealed class DrawingService : IDrawingService, IDrawingModuleProducer { private const int EngagementAreaMultiplier = 9; diff --git a/Daybreak/Services/Drawing/Modules/Primitives/SvgDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/SvgDrawingModuleBase.cs index c2d16149..13a1e91b 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/SvgDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/SvgDrawingModuleBase.cs @@ -14,7 +14,7 @@ public abstract class SvgDrawingModuleBase : DrawingModuleBase { private const int SvgCacheSize = 100; - private readonly Dictionary<ColorCombination, WriteableBitmap> bitmapCache = new(); + private readonly Dictionary<ColorCombination, WriteableBitmap> bitmapCache = []; protected override bool HasMinimumSize => true; diff --git a/Daybreak/Services/Events/EventNotifierService.cs b/Daybreak/Services/Events/EventNotifierService.cs index 157bd7f2..45c89ee9 100644 --- a/Daybreak/Services/Events/EventNotifierService.cs +++ b/Daybreak/Services/Events/EventNotifierService.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.Events; -public sealed class EventNotifierService : IEventNotifierService +internal sealed class EventNotifierService : IEventNotifierService { private readonly TimespanToETAConverter timespanToETAConverter = new(); private readonly INotificationService notificationService; diff --git a/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs b/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs index 2593cdf8..d2ff7c5e 100644 --- a/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs +++ b/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs @@ -13,7 +13,7 @@ using System.Windows; namespace Daybreak.Services.ExceptionHandling; -public sealed class ExceptionHandler : IExceptionHandler +internal sealed class ExceptionHandler : IExceptionHandler { private readonly INotificationService notificationService; private readonly ILogger<ExceptionHandler> logger; diff --git a/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs b/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs index dd41664a..61a63081 100644 --- a/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs +++ b/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; using System.Windows.Extensions.Services; namespace Daybreak.Services.ExecutableManagement; -public sealed class GuildWarsExecutableManager : IGuildWarsExecutableManager, IApplicationLifetimeService +internal sealed class GuildWarsExecutableManager : IGuildWarsExecutableManager, IApplicationLifetimeService { private readonly static TimeSpan ExecutableVerificationLatency = TimeSpan.FromSeconds(5); private readonly static object Lock = new(); diff --git a/Daybreak/Services/Experience/ExperienceCalculator.cs b/Daybreak/Services/Experience/ExperienceCalculator.cs index 6e6b6f0f..e0bf9e91 100644 --- a/Daybreak/Services/Experience/ExperienceCalculator.cs +++ b/Daybreak/Services/Experience/ExperienceCalculator.cs @@ -6,12 +6,12 @@ namespace Daybreak.Services.Experience; /// Based on the explanation from here https://wiki.guildwars.com/wiki/Experience. /// After 182600, the experience threshold is capped. /// </summary> -public sealed class ExperienceCalculator : IExperienceCalculator +internal sealed class ExperienceCalculator : IExperienceCalculator { private const uint ExperienceCalculationThreshold = 182600; private const uint MaxExperienceRequirement = 15000; - private static readonly List<uint> ExperienceThreshold = new() - { + private static readonly List<uint> ExperienceThreshold = + [ 0, 2000, 4600, @@ -35,7 +35,7 @@ public sealed class ExperienceCalculator : IExperienceCalculator 154000, 168000, 182600 - }; + ]; public uint GetExperienceForCurrentLevel(uint currentTotalExperience) { diff --git a/Daybreak/Services/Graph/GraphClient.cs b/Daybreak/Services/Graph/GraphClient.cs index 591fa618..3cb46fb4 100644 --- a/Daybreak/Services/Graph/GraphClient.cs +++ b/Daybreak/Services/Graph/GraphClient.cs @@ -17,7 +17,6 @@ using System.Extensions; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; -using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using System.Threading; @@ -27,7 +26,7 @@ using System.Windows.Controls; namespace Daybreak.Services.Graph; -public sealed class GraphClient : IGraphClient +internal sealed class GraphClient : IGraphClient { private const int MaxBrowserInitializationRetries = 5; @@ -290,7 +289,7 @@ public sealed class GraphClient : IGraphClient SourceUrl = buildEntry.Build?.SourceUrl }; - var buildList = this.buildsCache ?? new List<BuildFile>(); + var buildList = this.buildsCache ?? []; // Remove the previous version of the build buildList = buildList.Where(b => b.FileName != buildEntry.Name).ToList(); // Add new version of the build diff --git a/Daybreak/Services/Guildwars/GuildwarsCopyService.cs b/Daybreak/Services/Guildwars/GuildwarsCopyService.cs index 0d1777f0..fcdd24a7 100644 --- a/Daybreak/Services/Guildwars/GuildwarsCopyService.cs +++ b/Daybreak/Services/Guildwars/GuildwarsCopyService.cs @@ -1,6 +1,4 @@ -using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Models.Progress; +using Daybreak.Models.Progress; using Daybreak.Services.ExecutableManagement; using Microsoft.Extensions.Logging; using System; @@ -12,7 +10,7 @@ using System.Windows.Forms; namespace Daybreak.Services.Guildwars; -public sealed class GuildwarsCopyService : IGuildwarsCopyService +internal sealed class GuildwarsCopyService : IGuildwarsCopyService { private const string ExecutableName = "Gw.exe"; diff --git a/Daybreak/Services/Guildwars/GuildwarsInstaller.cs b/Daybreak/Services/Guildwars/GuildwarsInstaller.cs index 0925cb0d..5d3265d2 100644 --- a/Daybreak/Services/Guildwars/GuildwarsInstaller.cs +++ b/Daybreak/Services/Guildwars/GuildwarsInstaller.cs @@ -10,7 +10,7 @@ using System.IO; using System.Threading.Tasks; namespace Daybreak.Services.Guildwars; -public sealed class GuildwarsInstaller : IGuildwarsInstaller +internal sealed class GuildwarsInstaller : IGuildwarsInstaller { private const string GuildwarsDownloadUri = "https://cloudfront.guildwars2.com/client/GwSetup.exe"; private const string InstallationFileName = "GwSetup.exe"; diff --git a/Daybreak/Services/IconRetrieve/IconCache.cs b/Daybreak/Services/IconRetrieve/IconCache.cs index 44a39641..08ed0cf8 100644 --- a/Daybreak/Services/IconRetrieve/IconCache.cs +++ b/Daybreak/Services/IconRetrieve/IconCache.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.IconRetrieve; -public sealed class IconCache : IIconCache +internal sealed class IconCache : IIconCache { private const string HighResolutionGalleryUrl = $"https://wiki.guildwars.com/wiki/File:{NamePlaceholder}_(large).jpg"; private const string WikiUrl = "https://wiki.guildwars.com"; diff --git a/Daybreak/Services/Images/ImageCache.cs b/Daybreak/Services/Images/ImageCache.cs index 0e351830..3eebc0a5 100644 --- a/Daybreak/Services/Images/ImageCache.cs +++ b/Daybreak/Services/Images/ImageCache.cs @@ -21,7 +21,7 @@ using System.Windows.Media.Imaging; namespace Daybreak.Services.Images; -public sealed class ImageCache : IImageCache +internal sealed class ImageCache : IImageCache { private const string LatencyMetricName = "Image retrieval latency"; private const string LatencyMetricDescription = "Number of milliseconds spent while retrieving images"; diff --git a/Daybreak/Services/InternetChecker/InternetCheckingService.cs b/Daybreak/Services/InternetChecker/InternetCheckingService.cs index e92d8e90..415cb295 100644 --- a/Daybreak/Services/InternetChecker/InternetCheckingService.cs +++ b/Daybreak/Services/InternetChecker/InternetCheckingService.cs @@ -1,12 +1,10 @@ using Daybreak.Models; using Daybreak.Services.Metrics; using Microsoft.Extensions.Logging; -using System; using System.Core.Extensions; using System.Diagnostics; using System.Diagnostics.Metrics; using System.Extensions; -using System.Net; using System.Net.Http; using System.Net.NetworkInformation; using System.Threading; diff --git a/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs b/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs index 14b302d3..d2779db4 100644 --- a/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs +++ b/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs @@ -10,7 +10,7 @@ using System.Extensions; using System.Linq; namespace Daybreak.Services.LaunchConfigurations; -public sealed class LaunchConfigurationService : ILaunchConfigurationService +internal sealed class LaunchConfigurationService : ILaunchConfigurationService { private readonly ICredentialManager credentialManager; private readonly IGuildWarsExecutableManager guildWarsExecutableManager; diff --git a/Daybreak/Services/Logging/CompositeLogsWritter.cs b/Daybreak/Services/Logging/CompositeLogsWritter.cs index 5533212a..2fc4b57d 100644 --- a/Daybreak/Services/Logging/CompositeLogsWritter.cs +++ b/Daybreak/Services/Logging/CompositeLogsWritter.cs @@ -3,7 +3,7 @@ using System.Logging; namespace Daybreak.Services.Logging; -public sealed class CompositeLogsWriter : ILogsWriter +internal sealed class CompositeLogsWriter : ILogsWriter { private readonly IEnumerable<ILogsWriter> logsWriters; diff --git a/Daybreak/Services/Logging/DebugLogsWriter.cs b/Daybreak/Services/Logging/DebugLogsWriter.cs index 16fa39f2..4f4520b4 100644 --- a/Daybreak/Services/Logging/DebugLogsWriter.cs +++ b/Daybreak/Services/Logging/DebugLogsWriter.cs @@ -3,7 +3,7 @@ using System.Logging; namespace Daybreak.Services.Logging; -public sealed class DebugLogsWriter : IDebugLogsWriter +internal sealed class DebugLogsWriter : IDebugLogsWriter { public void WriteLog(Log log) { diff --git a/Daybreak/Services/Logging/EventViewerLogsWriter.cs b/Daybreak/Services/Logging/EventViewerLogsWriter.cs index 6c0a99c6..60ba1384 100644 --- a/Daybreak/Services/Logging/EventViewerLogsWriter.cs +++ b/Daybreak/Services/Logging/EventViewerLogsWriter.cs @@ -4,7 +4,7 @@ using System.Logging; namespace Daybreak.Services.Logging; -public sealed class EventViewerLogsWriter : IEventViewerLogsWriter +internal sealed class EventViewerLogsWriter : IEventViewerLogsWriter { private const string AppName = "Daybreak"; private const string LogType = "Application"; diff --git a/Daybreak/Services/Logging/JsonLogsManager.cs b/Daybreak/Services/Logging/JsonLogsManager.cs index c17a88e7..92ece039 100644 --- a/Daybreak/Services/Logging/JsonLogsManager.cs +++ b/Daybreak/Services/Logging/JsonLogsManager.cs @@ -11,11 +11,11 @@ using System.Logging; namespace Daybreak.Services.Logging; -public sealed class JsonLogsManager : ILogsManager +internal sealed class JsonLogsManager : ILogsManager { private const int MemoryCacheMaxSize = 5000; - private readonly List<Models.Log> memoryCache = new(); + private readonly List<Models.Log> memoryCache = []; private readonly ILiteCollection<Models.Log> collection; private readonly ILiveOptions<LauncherOptions> liveOptions; diff --git a/Daybreak/Services/Menu/MenuService.cs b/Daybreak/Services/Menu/MenuService.cs index 431ecd25..d4529cec 100644 --- a/Daybreak/Services/Menu/MenuService.cs +++ b/Daybreak/Services/Menu/MenuService.cs @@ -4,7 +4,7 @@ using System.Core.Extensions; namespace Daybreak.Services.Menu; -public sealed class MenuService : IMenuService, IMenuServiceInitializer +internal sealed class MenuService : IMenuService, IMenuServiceInitializer { private readonly ILogger<MenuService> logger; diff --git a/Daybreak/Services/Metrics/MetricsService.cs b/Daybreak/Services/Metrics/MetricsService.cs index 2d79205e..d5d8abdb 100644 --- a/Daybreak/Services/Metrics/MetricsService.cs +++ b/Daybreak/Services/Metrics/MetricsService.cs @@ -8,7 +8,7 @@ using System.Threading; namespace Daybreak.Services.Metrics; -public sealed class MetricsService : IMetricsService, IDisposable +internal sealed class MetricsService : IMetricsService, IDisposable { private const int MetricsStoreLimit = 10000; private const string MetricsNamespace = "Daybreak"; diff --git a/Daybreak/Services/Mods/ModsManager.cs b/Daybreak/Services/Mods/ModsManager.cs index e1ba4629..3bf6c066 100644 --- a/Daybreak/Services/Mods/ModsManager.cs +++ b/Daybreak/Services/Mods/ModsManager.cs @@ -5,7 +5,7 @@ using System.Core.Extensions; namespace Daybreak.Services.Mods; -public sealed class ModsManager : IModsManager +internal sealed class ModsManager : IModsManager { private readonly IServiceManager serviceManager; private readonly ILogger<IModsManager> logger; diff --git a/Daybreak/Services/Monitoring/DiskUsageMonitor.cs b/Daybreak/Services/Monitoring/DiskUsageMonitor.cs index 87797707..6f5fd90c 100644 --- a/Daybreak/Services/Monitoring/DiskUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/DiskUsageMonitor.cs @@ -9,7 +9,7 @@ using System.Threading; namespace Daybreak.Services.Monitoring; -public sealed class DiskUsageMonitor : IApplicationLifetimeService +internal sealed class DiskUsageMonitor : IApplicationLifetimeService { private const string WriteDiskUsage = "Write Disk Usage"; private const string WriteDiskUsageUnit = "MBs/s"; diff --git a/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs b/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs index 314b08e5..40562c98 100644 --- a/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs @@ -9,7 +9,7 @@ using System.Threading; namespace Daybreak.Services.Monitoring; -public sealed class MemoryUsageMonitor : IApplicationLifetimeService +internal sealed class MemoryUsageMonitor : IApplicationLifetimeService { private const string MemoryUsage = "Memory Usage"; private const string MemoryUsageUnit = "MBs"; diff --git a/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs b/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs index 044c3b02..e4a41c54 100644 --- a/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs @@ -9,7 +9,7 @@ using System.Windows.Extensions.Services; namespace Daybreak.Services.Monitoring; -public sealed class ProcessorUsageMonitor : IApplicationLifetimeService +internal sealed class ProcessorUsageMonitor : IApplicationLifetimeService { private const string ProcessorTime = "Processor Usage"; private const string ProcessorTimeUnit = "% CPU"; diff --git a/Daybreak/Services/Mutex/MutexHandler.cs b/Daybreak/Services/Mutex/MutexHandler.cs index 95d1f6f5..7ced6012 100644 --- a/Daybreak/Services/Mutex/MutexHandler.cs +++ b/Daybreak/Services/Mutex/MutexHandler.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; namespace Daybreak.Services.Mutex; -public sealed class MutexHandler : IMutexHandler +internal sealed class MutexHandler : IMutexHandler { public void CloseMutex(Process process, string mutexName) { diff --git a/Daybreak/Services/Navigation/ViewManager.cs b/Daybreak/Services/Navigation/ViewManager.cs index 2e4ff7bf..1f7bf487 100644 --- a/Daybreak/Services/Navigation/ViewManager.cs +++ b/Daybreak/Services/Navigation/ViewManager.cs @@ -6,7 +6,7 @@ using System.Windows.Controls; namespace Daybreak.Services.Navigation; -public sealed class ViewManager : IViewManager +internal sealed class ViewManager : IViewManager { private readonly IServiceManager serviceManager; private Panel? container; diff --git a/Daybreak/Services/Notifications/NotificationService.cs b/Daybreak/Services/Notifications/NotificationService.cs index 87463513..094be486 100644 --- a/Daybreak/Services/Notifications/NotificationService.cs +++ b/Daybreak/Services/Notifications/NotificationService.cs @@ -15,7 +15,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.Notifications; -public sealed class NotificationService : INotificationService, INotificationProducer, INotificationHandlerProducer +internal sealed class NotificationService : INotificationService, INotificationProducer, INotificationHandlerProducer { private readonly ConcurrentQueue<Notification> pendingNotifications = new(); private readonly IServiceManager serviceManager; diff --git a/Daybreak/Services/Onboarding/OnboardingService.cs b/Daybreak/Services/Onboarding/OnboardingService.cs index 8aec1fb1..8af3a327 100644 --- a/Daybreak/Services/Onboarding/OnboardingService.cs +++ b/Daybreak/Services/Onboarding/OnboardingService.cs @@ -10,7 +10,7 @@ using System.Extensions; namespace Daybreak.Services.Onboarding; -public sealed class OnboardingService : IOnboardingService +internal sealed class OnboardingService : IOnboardingService { private readonly ICredentialManager credentialManager; private readonly IGuildWarsExecutableManager guildWarsExecutableManager; diff --git a/Daybreak/Services/Options/OptionsManager.cs b/Daybreak/Services/Options/OptionsManager.cs index 27334508..6270064e 100644 --- a/Daybreak/Services/Options/OptionsManager.cs +++ b/Daybreak/Services/Options/OptionsManager.cs @@ -1,6 +1,5 @@ using Daybreak.Attributes; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Configuration; @@ -11,13 +10,13 @@ using System.Linq; namespace Daybreak.Services.Options; -public sealed class OptionsManager : IOptionsManager, IOptionsProducer, IOptionsUpdateHook, IOptionsProvider +internal sealed class OptionsManager : IOptionsManager, IOptionsProducer, IOptionsUpdateHook, IOptionsProvider { private const string OptionsFile = "Daybreak.options"; - private readonly Dictionary<string, string> optionsCache = new(); - private readonly Dictionary<Type, List<Action>> optionsUpdateHooks = new(); - private readonly HashSet<Type> optionsTypes = new(); + private readonly Dictionary<string, string> optionsCache = []; + private readonly Dictionary<Type, List<Action>> optionsUpdateHooks = []; + private readonly HashSet<Type> optionsTypes = []; public OptionsManager() { @@ -29,7 +28,7 @@ public sealed class OptionsManager : IOptionsManager, IOptionsProducer, IOptions var optionsFileContent = File.ReadAllText(OptionsFile); if (optionsFileContent.IsNullOrWhiteSpace()) { - this.optionsCache = new Dictionary<string, string>(); + this.optionsCache = []; } else { @@ -69,7 +68,7 @@ public sealed class OptionsManager : IOptionsManager, IOptionsProducer, IOptions if (this.optionsUpdateHooks.TryGetValue(typeof(TOptionsType), out var hooks) is false || hooks is null) { - hooks = new List<Action>(); + hooks = []; this.optionsUpdateHooks[typeof(TOptionsType)] = hooks; } diff --git a/Daybreak/Services/Pathfinding/StupidPathfinder.cs b/Daybreak/Services/Pathfinding/StupidPathfinder.cs index de515582..43fb9045 100644 --- a/Daybreak/Services/Pathfinding/StupidPathfinder.cs +++ b/Daybreak/Services/Pathfinding/StupidPathfinder.cs @@ -22,7 +22,7 @@ namespace Daybreak.Services.Pathfinding; /// <summary> /// Pathfinder based on Euclidean distance with discrete space. /// </summary> -public sealed class StupidPathfinder : IPathfinder +internal sealed class StupidPathfinder : IPathfinder { private const string PathfindingLatencyMetricName = "Pathfinding Latency"; private const string PathfindingLatencyMetricUnit = "Milliseconds"; diff --git a/Daybreak/Services/Plugins/Models/PluginEntry.cs b/Daybreak/Services/Plugins/Models/PluginEntry.cs index 517f9326..ccad3eb2 100644 --- a/Daybreak/Services/Plugins/Models/PluginEntry.cs +++ b/Daybreak/Services/Plugins/Models/PluginEntry.cs @@ -1,5 +1,5 @@ namespace Daybreak.Services.Plugins.Models; -public sealed class PluginEntry +internal sealed class PluginEntry { public string Name { get; set; } = string.Empty; public string Path { get; set; } = string.Empty; diff --git a/Daybreak/Services/Plugins/PluginsService.cs b/Daybreak/Services/Plugins/PluginsService.cs index 1393b829..dd960756 100644 --- a/Daybreak/Services/Plugins/PluginsService.cs +++ b/Daybreak/Services/Plugins/PluginsService.cs @@ -28,14 +28,14 @@ using System.Threading.Tasks; namespace Daybreak.Services.Plugins; -public sealed class PluginsService : IPluginsService +internal sealed class PluginsService : IPluginsService { private const string DllExtension = ".dll"; private const string PluginsDirectory = "Plugins"; private static readonly object Lock = new(); - private readonly List<AvailablePlugin> loadedPlugins = new(); + private readonly List<AvailablePlugin> loadedPlugins = []; private readonly ILiveUpdateableOptions<PluginsServiceOptions> liveUpdateableOptions; private readonly ILogger<PluginsService> logger; private readonly DaybreakPluginValidator daybreakPluginValidator = new(); diff --git a/Daybreak/Services/Plugins/Resolvers/DaybreakPluginDependencyResolver.cs b/Daybreak/Services/Plugins/Resolvers/DaybreakPluginDependencyResolver.cs index fe539b43..798a8df3 100644 --- a/Daybreak/Services/Plugins/Resolvers/DaybreakPluginDependencyResolver.cs +++ b/Daybreak/Services/Plugins/Resolvers/DaybreakPluginDependencyResolver.cs @@ -2,7 +2,7 @@ using System.Reflection; namespace Daybreak.Services.Plugins.Resolvers; -public sealed class DaybreakPluginDependencyResolver : IDependencyResolver +internal sealed class DaybreakPluginDependencyResolver : IDependencyResolver { public bool TryResolveDependency(Assembly? requestingAssembly, string dependencyName, out string? path) { diff --git a/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs b/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs index c22192e6..7efbf81c 100644 --- a/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs +++ b/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Reflection.Metadata; namespace Daybreak.Services.Plugins.Validators; -public sealed class DaybreakPluginValidator : IMetadataValidator, IEnvironmentVersionValidator, ITypeDefinitionsValidator +internal sealed class DaybreakPluginValidator : IMetadataValidator, IEnvironmentVersionValidator, ITypeDefinitionsValidator { public bool Validate(IEnumerable<TypeDefinition> typeDefinitions, MetadataReader metadataReader) { diff --git a/Daybreak/Services/Privilege/PrivilegeManager.cs b/Daybreak/Services/Privilege/PrivilegeManager.cs index 4b70a480..88ac0fd1 100644 --- a/Daybreak/Services/Privilege/PrivilegeManager.cs +++ b/Daybreak/Services/Privilege/PrivilegeManager.cs @@ -8,7 +8,7 @@ using System.Windows.Controls; namespace Daybreak.Services.Privilege; -public sealed class PrivilegeManager : IPrivilegeManager +internal sealed class PrivilegeManager : IPrivilegeManager { public bool AdminPrivileges => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); diff --git a/Daybreak/Services/ReShade/ReShadeService.cs b/Daybreak/Services/ReShade/ReShadeService.cs index 21179141..70c9b092 100644 --- a/Daybreak/Services/ReShade/ReShadeService.cs +++ b/Daybreak/Services/ReShade/ReShadeService.cs @@ -26,7 +26,7 @@ using System.Threading.Tasks; using System.Windows.Extensions.Services; namespace Daybreak.Services.ReShade; -public sealed class ReShadeService : IReShadeService, IApplicationLifetimeService +internal sealed class ReShadeService : IReShadeService, IApplicationLifetimeService { private const string PackagesIniUrl = "https://raw.githubusercontent.com/crosire/reshade-shaders/list/EffectPackages.ini"; private const string ReShadeHomepageUrl = "https://reshade.me"; diff --git a/Daybreak/Services/Registry/RegistryService.cs b/Daybreak/Services/Registry/RegistryService.cs index 404df73d..e3e81567 100644 --- a/Daybreak/Services/Registry/RegistryService.cs +++ b/Daybreak/Services/Registry/RegistryService.cs @@ -9,7 +9,7 @@ using System.Linq; namespace Daybreak.Services.Registry; -public sealed class RegistryService : IRegistryService +internal sealed class RegistryService : IRegistryService { private const string RegistryKey = "Daybreak"; diff --git a/Daybreak/Services/Scanner/GWCAMemoryReader.cs b/Daybreak/Services/Scanner/GWCAMemoryReader.cs index 0ea09039..1d453769 100644 --- a/Daybreak/Services/Scanner/GWCAMemoryReader.cs +++ b/Daybreak/Services/Scanner/GWCAMemoryReader.cs @@ -77,8 +77,8 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader CurrentTargetId = (int)gameData.TargetId, LivingEntities = gameData.LivingEntities?.Select(ParsePayload).ToList(), MainPlayer = gameData.MainPlayer is not null ? ParsePayload(gameData.MainPlayer) : new MainPlayerInformation(), - Party = gameData.Party?.Select(ParsePayload).ToList() ?? new List<PlayerInformation>(), - WorldPlayers = gameData.WorldPlayers?.Select(ParsePayload).ToList() ?? new List<WorldPlayerInformation>(), + Party = gameData.Party?.Select(ParsePayload).ToList() ?? [], + WorldPlayers = gameData.WorldPlayers?.Select(ParsePayload).ToList() ?? [], MapIcons = gameData.MapIcons?.Select(m => { if (!GuildwarsIcon.TryParse((int)m.Id, out var icon)) @@ -96,7 +96,7 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader Y = m.PosY } }; - }).OfType<MapIcon>().ToList() ?? new List<MapIcon>() + }).OfType<MapIcon>().ToList() ?? [] }; } catch(Exception ex) @@ -261,15 +261,15 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader XBR = pathingTrapezoid.XBR, XTL = pathingTrapezoid.XTL, XTR = pathingTrapezoid.XTR - }).ToList() ?? new List<Trapezoid>(); - var adjacencyList = pathingPayload.AdjacencyList ?? new List<List<int>>(); + }).ToList() ?? []; + var adjacencyList = pathingPayload.AdjacencyList ?? []; var pathingMapsCount = pathingPayload.Trapezoids?.Max(p => p.PathingMapId) ?? 0; var originalPathingMaps = new List<List<int>>((int)pathingMapsCount); foreach(var trapezoid in trapezoidList) { while (originalPathingMaps.Count <= trapezoid.PathingMapId) { - originalPathingMaps.Add(new List<int>()); + originalPathingMaps.Add([]); } originalPathingMaps[trapezoid.PathingMapId].Add(trapezoid.Id); @@ -683,7 +683,7 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader return new Bag { Capacity = bagPayload.Items?.Count ?? 0, - Items = bagPayload.Items?.Select(ParsePayload).ToList() ?? new List<IBagContent>() + Items = bagPayload.Items?.Select(ParsePayload).ToList() ?? [] }; } @@ -787,7 +787,7 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader Attribute = attribute, Points = (int)a.BaseLevel }; - }).OfType<AttributeEntry>().ToList() ?? new List<AttributeEntry>(), + }).OfType<AttributeEntry>().ToList() ?? [], Skills = partyPlayerPayload.Build?.Skills?.Select(s => { if(!Skill.TryParse((int)s, out var skill)) @@ -817,7 +817,7 @@ public sealed class GWCAMemoryReader : IGuildwarsMemoryReader } return default; - }).OfType<Profession>().ToList() ?? new List<Profession>() + }).OfType<Profession>().ToList() ?? [] }; } diff --git a/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs b/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs index 8cc195f7..327879a4 100644 --- a/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs +++ b/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs @@ -3,7 +3,6 @@ using Daybreak.Models.Guildwars; using Daybreak.Models.LaunchConfigurations; using Daybreak.Services.Scanner.Models; using System; -using System.Collections.Generic; using System.Configuration; using System.Core.Extensions; using System.Threading; @@ -11,7 +10,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.Scanner; -public sealed class GuildwarsMemoryCache : IGuildwarsMemoryCache +internal sealed class GuildwarsMemoryCache : IGuildwarsMemoryCache { private readonly IGuildwarsMemoryReader guildwarsMemoryReader; private readonly ILiveOptions<MemoryReaderOptions> liveOptions; diff --git a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs index 1dc16d9c..332dcc7f 100644 --- a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs +++ b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.Screens; -public sealed class GuildwarsScreenPlacer : IGuildwarsScreenPlacer +internal sealed class GuildwarsScreenPlacer : IGuildwarsScreenPlacer { private const int MaxTries = 10; diff --git a/Daybreak/Services/Screens/ScreenManager.cs b/Daybreak/Services/Screens/ScreenManager.cs index 186cbcc0..bb366b70 100644 --- a/Daybreak/Services/Screens/ScreenManager.cs +++ b/Daybreak/Services/Screens/ScreenManager.cs @@ -16,7 +16,7 @@ using System.Windows.Media; namespace Daybreak.Services.Screens; -public sealed class ScreenManager : IScreenManager, IApplicationLifetimeService +internal sealed class ScreenManager : IScreenManager, IApplicationLifetimeService { private readonly MainWindow host; private readonly ILiveUpdateableOptions<ScreenManagerOptions> liveUpdateableOptions; diff --git a/Daybreak/Services/Screens/SplashScreenService.cs b/Daybreak/Services/Screens/SplashScreenService.cs index 66c3d943..837755d3 100644 --- a/Daybreak/Services/Screens/SplashScreenService.cs +++ b/Daybreak/Services/Screens/SplashScreenService.cs @@ -10,7 +10,7 @@ using System.Windows; namespace Daybreak.Services.Screens; -public sealed class SplashScreenService : ISplashScreenService +internal sealed class SplashScreenService : ISplashScreenService { private readonly IThemeManager themeManager; private readonly IOptions<ScreenManagerOptions> options; diff --git a/Daybreak/Services/Screenshots/BackgroundProvider.cs b/Daybreak/Services/Screenshots/BackgroundProvider.cs index 1a6f8af5..61b2bd6f 100644 --- a/Daybreak/Services/Screenshots/BackgroundProvider.cs +++ b/Daybreak/Services/Screenshots/BackgroundProvider.cs @@ -9,7 +9,7 @@ using System.Windows.Media; namespace Daybreak.Services.Screenshots; -public sealed class BackgroundProvider : IBackgroundProvider +internal sealed class BackgroundProvider : IBackgroundProvider { private readonly IScreenshotProvider screenshotProvider; private readonly IOnlinePictureClient bloogumClient; diff --git a/Daybreak/Services/Screenshots/Models/Event.cs b/Daybreak/Services/Screenshots/Models/Event.cs index eb760ed6..f47bc0cf 100644 --- a/Daybreak/Services/Screenshots/Models/Event.cs +++ b/Daybreak/Services/Screenshots/Models/Event.cs @@ -14,8 +14,8 @@ internal sealed class Event public static readonly Event Wintersday = new() { Name = "Wintersday", - ValidLocations = new List<Map> - { + ValidLocations = + [ Map.AscalonCityWintersdayOutpost, Map.DroknarsForgeWintersdayOutpost, Map.EyeOfTheNorthOutpostWintersdayOutpost, @@ -60,6 +60,6 @@ internal sealed class Event Map.DrakkarLake, Map.JagaMoraine, Map.BjoraMarches - } + ] }; } diff --git a/Daybreak/Services/Screenshots/Models/Location.cs b/Daybreak/Services/Screenshots/Models/Location.cs index 7d7af1aa..69356123 100644 --- a/Daybreak/Services/Screenshots/Models/Location.cs +++ b/Daybreak/Services/Screenshots/Models/Location.cs @@ -8,8 +8,7 @@ internal sealed class Location { public static readonly Location AscalonPreSearing = new( Region.PresearingAscalon, - new List<Entry> - { + [ new Entry { Map = Map.AscalonCityPresearing, @@ -118,11 +117,10 @@ internal sealed class Location StartIndex = 1, Count = 10 }, - }); + ]); public static readonly Location Ascalon = new( Region.Ascalon, - new List<Entry> - { + [ new Entry { Map = Map.AscalonCityOutpost, @@ -249,11 +247,10 @@ internal sealed class Location StartIndex = 1, Count = 18 } - }); + ]); public static readonly Location NorthernShiverpeaks = new( Region.ShiverpeakMountains, - new List<Entry> - { + [ new Entry { Map = Map.TravelersVale, @@ -344,11 +341,10 @@ internal sealed class Location StartIndex = 1, Count = 7 }, - }); + ]); public static readonly Location Kryta = new( Region.Kryta, - new List<Entry> - { + [ new Entry { Map = Map.ScoundrelsRise, @@ -601,11 +597,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location MaguumaJungle = new( Region.MaguumaJungle, - new List<Entry> - { + [ new Entry { Map = Map.DruidsOverlookOutpost, @@ -759,11 +754,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location CrystalDesert = new( Region.CrystalDesert, - new List<Entry> - { + [ new Entry { Map = Map.TheAmnoonOasisOutpost, @@ -926,11 +920,10 @@ internal sealed class Location StartIndex = 1, Count = 60 }, - }); + ]); public static readonly Location SouthernShiverpeaks = new( Region.ShiverpeakMountains, - new List<Entry> - { + [ new Entry { Map = Map.DroknarsForgeOutpost, @@ -1157,11 +1150,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location RingOfFireIslandChain = new( Region.RingOfFireIslands, - new List<Entry> - { + [ new Entry { Map = Map.EmberLightCampOutpost, @@ -1225,11 +1217,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location FarShiverpeaks = new( Region.FarShiverpeaks, - new List<Entry> - { + [ new Entry { Map = Map.EmberLightCampOutpost, @@ -1356,11 +1347,10 @@ internal sealed class Location StartIndex = 1, Count = 4 }, - }); + ]); public static readonly Location CharrHomelands = new( Region.CharrHomelands, - new List<Entry> - { + [ new Entry { Map = Map.GrothmarWardowns, @@ -1406,11 +1396,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location TarnishedCoast = new( Region.TarnishedCoast, - new List<Entry> - { + [ new Entry { Map = Map.VerdantCascades, @@ -1519,11 +1508,10 @@ internal sealed class Location StartIndex = 1, Count = 4 }, - }); + ]); public static readonly Location DepthsOfTyria = new( Region.DepthsOfTyria, - new List<Entry> - { + [ new Entry { Map = Map.TheFissureofWoe, @@ -2000,11 +1988,10 @@ internal sealed class Location StartIndex = 1, Count = 40 }, - }); + ]); public static readonly Location ShingJeaIsland = new( Region.ShingJeaIsland, - new List<Entry> - { + [ new Entry { Map = Map.MonasteryOverlook1, @@ -2293,11 +2280,10 @@ internal sealed class Location StartIndex = 1, Count = 2 }, - }); + ]); public static readonly Location KainengCity = new( Region.KainengCity, - new List<Entry> - { + [ new Entry { Map = Map.KainengCenterCanthanNewYearOutpost, @@ -2676,11 +2662,10 @@ internal sealed class Location StartIndex = 1, Count = 5 }, - }); + ]); public static readonly Location EchovaldForest = new( Region.EchovaldForest, - new List<Entry> - { + [ new Entry { Map = Map.TanglewoodCopseOutpost, @@ -2915,11 +2900,10 @@ internal sealed class Location StartIndex = 1, Count = 13 }, - }); + ]); public static readonly Location JadeSea = new( Region.TheJadeSea, - new List<Entry> - { + [ new Entry { Map = Map.BoreasSeabedExplorable, @@ -3163,11 +3147,10 @@ internal sealed class Location StartIndex = 1, Count = 18 }, - }); + ]); public static readonly Location Istan = new( Region.Istan, - new List<Entry> - { + [ new Entry { Map = Map.IslandOfShehkah, @@ -3438,11 +3421,10 @@ internal sealed class Location StartIndex = 1, Count = 2 }, - }); + ]); public static readonly Location Kourna = new( Region.Kourna, - new List<Entry> - { + [ new Entry { Map = Map.YohlonHavenOutpost, @@ -3650,11 +3632,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location Vabbi = new( Region.Vabbi, - new List<Entry> - { + [ new Entry { Map = Map.YatendiCanyons, @@ -3880,11 +3861,10 @@ internal sealed class Location StartIndex = 1, Count = 2 }, - }); + ]); public static readonly Location TheDesolation = new( Region.TheDesolation, - new List<Entry> - { + [ new Entry { Map = Map.GateOfDesolation, @@ -4011,11 +3991,10 @@ internal sealed class Location StartIndex = 1, Count = 5 }, - }); + ]); public static readonly Location GateOfTorment = new( Region.RealmOfTorment, - new List<Entry> - { + [ new Entry { Map = Map.GateOfTormentOutpost, @@ -4169,11 +4148,10 @@ internal sealed class Location StartIndex = 1, Count = 1 } - }); + ]); public static readonly Location BattleIsles = new( Region.TheBattleIsles, - new List<Entry> - { + [ new Entry { Map = Map.GreatTempleOfBalthazarOutpost, @@ -4273,11 +4251,10 @@ internal sealed class Location StartIndex = 1, Count = 12 }, - }); + ]); public static readonly Location GuildHalls = new( Region.TheBattleIsles, - new List<Entry> - { + [ new Entry { Map = Map.WarriorsIsle, @@ -4710,10 +4687,10 @@ internal sealed class Location StartIndex = 1, Count = 12 } - }); + ]); - public static List<Location> Locations { get; } = new List<Location> - { + public static List<Location> Locations { get; } = + [ AscalonPreSearing, Ascalon, NorthernShiverpeaks, @@ -4737,10 +4714,10 @@ internal sealed class Location GateOfTorment, BattleIsles, GuildHalls - }; + ]; public Region Region { get; } - public List<Entry> Entries { get; } = new(); + public List<Entry> Entries { get; } = []; internal Location(Region region, List<Entry> entries) { this.Region = region; diff --git a/Daybreak/Services/Screenshots/OnlinePictureClient.cs b/Daybreak/Services/Screenshots/OnlinePictureClient.cs index d0202060..7bd1412f 100644 --- a/Daybreak/Services/Screenshots/OnlinePictureClient.cs +++ b/Daybreak/Services/Screenshots/OnlinePictureClient.cs @@ -14,12 +14,11 @@ using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using System.Windows.Documents; using System.Windows.Media; namespace Daybreak.Services.Screenshots; -public sealed class OnlinePictureClient : IOnlinePictureClient +internal sealed class OnlinePictureClient : IOnlinePictureClient { private const string CloudFlareCookieValue = "fcfd523b2470336531e47baff3d2c2d6a0e2412a.1689426482.1"; private const string CloudFlareCookieKey = "wschkid"; diff --git a/Daybreak/Services/Screenshots/ScreenshotProvider.cs b/Daybreak/Services/Screenshots/ScreenshotProvider.cs index fe7a321d..87ca428d 100644 --- a/Daybreak/Services/Screenshots/ScreenshotProvider.cs +++ b/Daybreak/Services/Screenshots/ScreenshotProvider.cs @@ -1,20 +1,16 @@ using Daybreak.Services.Images; using Microsoft.Extensions.Logging; -using NAudio.CoreAudioApi; using System; using System.Collections.Generic; using System.Core.Extensions; using System.Extensions; using System.IO; -using System.Linq; using System.Threading.Tasks; using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Xml.Linq; namespace Daybreak.Services.Screenshots; -public sealed class ScreenshotProvider : IScreenshotProvider +internal sealed class ScreenshotProvider : IScreenshotProvider { private readonly static string ScreenshotsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Guild Wars\\Screens"; diff --git a/Daybreak/Services/Shortcuts/ShortcutManager.cs b/Daybreak/Services/Shortcuts/ShortcutManager.cs index 1c7b1881..f0b60140 100644 --- a/Daybreak/Services/Shortcuts/ShortcutManager.cs +++ b/Daybreak/Services/Shortcuts/ShortcutManager.cs @@ -9,7 +9,7 @@ using System.IO; namespace Daybreak.Services.Shortcuts; //TODO: Fix dependency on IConfigurationManager -public sealed class ShortcutManager : IShortcutManager +internal sealed class ShortcutManager : IShortcutManager { private const string ShortcutName = "Daybreak.lnk"; diff --git a/Daybreak/Services/Sounds/SoundService.cs b/Daybreak/Services/Sounds/SoundService.cs index 33782253..260ac2f7 100644 --- a/Daybreak/Services/Sounds/SoundService.cs +++ b/Daybreak/Services/Sounds/SoundService.cs @@ -1,5 +1,4 @@ using Daybreak.Configuration.Options; -using Microsoft.Extensions.Options; using NAudio.Wave; using System.Configuration; using System.Core.Extensions; @@ -8,7 +7,7 @@ using System.Reflection; namespace Daybreak.Services.Sounds; -public sealed class SoundService : ISoundService +internal sealed class SoundService : ISoundService { private const string CloseNotification = "NotifyClose"; private const string ErrorNotification = "NotifyError"; diff --git a/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs b/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs index aaa0401a..7c59c2c3 100644 --- a/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs +++ b/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs @@ -4,7 +4,7 @@ using System.IO; namespace Daybreak.Services.Startup.Actions; -public sealed class RenameInstallerAction : StartupActionBase +internal sealed class RenameInstallerAction : StartupActionBase { private const string TemporaryInstallerFileName = "Daybreak.Installer.Temp.exe"; private const string InstallerFileName = "Daybreak.Installer.exe"; diff --git a/Daybreak/Services/Startup/StartupActionManager.cs b/Daybreak/Services/Startup/StartupActionManager.cs index c91af5ed..46050551 100644 --- a/Daybreak/Services/Startup/StartupActionManager.cs +++ b/Daybreak/Services/Startup/StartupActionManager.cs @@ -10,7 +10,7 @@ using System.Windows.Extensions.Services; namespace Daybreak.Services.Startup; -public sealed class StartupActionManager : IStartupActionProducer, IApplicationLifetimeService +internal sealed class StartupActionManager : IStartupActionProducer, IApplicationLifetimeService { private readonly IServiceManager serviceManager; private readonly ILogger<StartupActionManager> logger; diff --git a/Daybreak/Services/Themes/ThemeManager.cs b/Daybreak/Services/Themes/ThemeManager.cs index a62db237..2dfd715b 100644 --- a/Daybreak/Services/Themes/ThemeManager.cs +++ b/Daybreak/Services/Themes/ThemeManager.cs @@ -7,7 +7,6 @@ using Daybreak.Utils; using System; using System.Configuration; using System.Core.Extensions; -using System.Diagnostics; using System.Extensions; using System.Linq; using System.Reflection; @@ -15,7 +14,7 @@ using System.Windows.Extensions.Services; using System.Windows.Media; namespace Daybreak.Services.Themes; -public sealed class ThemeManager : IThemeManager, IApplicationLifetimeService +internal sealed class ThemeManager : IThemeManager, IApplicationLifetimeService { private const string LightThemeValue = "Light"; private const string RegistryKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes"; diff --git a/Daybreak/Services/TradeChat/ItemHashService.cs b/Daybreak/Services/TradeChat/ItemHashService.cs index 92d746fa..6d4133fa 100644 --- a/Daybreak/Services/TradeChat/ItemHashService.cs +++ b/Daybreak/Services/TradeChat/ItemHashService.cs @@ -5,7 +5,7 @@ using System.Text; namespace Daybreak.Services.TradeChat; -public sealed class ItemHashService : IItemHashService +internal sealed class ItemHashService : IItemHashService { public string? ComputeHash(ItemBase itemBase) { diff --git a/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs b/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs index abcb37b0..8b533557 100644 --- a/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs +++ b/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs @@ -9,7 +9,7 @@ using System.Extensions; namespace Daybreak.Services.TradeChat.Notifications; -public sealed class TradeMessageNotificationHandler : INotificationHandler +internal sealed class TradeMessageNotificationHandler : INotificationHandler { private readonly IViewManager viewManager; diff --git a/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs b/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs index 21629e43..63bf14fc 100644 --- a/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs @@ -8,7 +8,7 @@ using System.Core.Extensions; using System.Extensions; namespace Daybreak.Services.TradeChat; -public sealed class PriceHistoryDatabase : IPriceHistoryDatabase +internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase { private readonly IItemHashService itemHashService; private readonly ILiteCollection<TraderQuoteDTO> collection; diff --git a/Daybreak/Services/TradeChat/PriceHistoryService.cs b/Daybreak/Services/TradeChat/PriceHistoryService.cs index d3fe6c7f..fb359e92 100644 --- a/Daybreak/Services/TradeChat/PriceHistoryService.cs +++ b/Daybreak/Services/TradeChat/PriceHistoryService.cs @@ -16,7 +16,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.TradeChat; -public sealed class PriceHistoryService : IPriceHistoryService +internal sealed class PriceHistoryService : IPriceHistoryService { private static readonly DateTime MinEpochTime = DateTimeOffset.FromUnixTimeSeconds(1420070400).UtcDateTime; diff --git a/Daybreak/Services/TradeChat/TradeAlertingService.cs b/Daybreak/Services/TradeChat/TradeAlertingService.cs index ee106999..897c149b 100644 --- a/Daybreak/Services/TradeChat/TradeAlertingService.cs +++ b/Daybreak/Services/TradeChat/TradeAlertingService.cs @@ -4,11 +4,8 @@ using Daybreak.Services.Notifications; using Daybreak.Services.TradeChat.Models; using Daybreak.Services.TradeChat.Notifications; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Microsoft.VisualBasic; using Newtonsoft.Json; using System; -using System.Collections; using System.Collections.Generic; using System.Configuration; using System.Core.Extensions; @@ -20,9 +17,9 @@ using System.Threading.Tasks; using System.Windows.Extensions.Services; namespace Daybreak.Services.TradeChat; -public sealed class TradeAlertingService : ITradeAlertingService, IApplicationLifetimeService +internal sealed class TradeAlertingService : ITradeAlertingService, IApplicationLifetimeService { - private readonly List<TradeAlert> tradeAlerts = new List<TradeAlert>(); + private readonly List<TradeAlert> tradeAlerts = []; private readonly INotificationService notificationService; private readonly ITradeHistoryDatabase tradeHistoryDatabase; private readonly ITradeChatService<KamadanTradeChatOptions> kamadanTradeChatService; @@ -47,7 +44,7 @@ public sealed class TradeAlertingService : ITradeAlertingService, IApplicationLi this.ascalonTradeChatService = ascalonTradeChatService.ThrowIfNull(); this.options = options.ThrowIfNull(); this.logger = logger.ThrowIfNull(); - this.tradeAlerts = this.options.Value.Alerts ?? new List<TradeAlert>(); + this.tradeAlerts = this.options.Value.Alerts ?? []; } public void AddTradeAlert(TradeAlert tradeAlert) diff --git a/Daybreak/Services/TradeChat/TradeChatService.cs b/Daybreak/Services/TradeChat/TradeChatService.cs index 0d8e5fa5..b2ba075b 100644 --- a/Daybreak/Services/TradeChat/TradeChatService.cs +++ b/Daybreak/Services/TradeChat/TradeChatService.cs @@ -1,5 +1,4 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; using Daybreak.Models.Trade; using Daybreak.Services.TradeChat.Models; using Microsoft.Extensions.Logging; @@ -25,7 +24,7 @@ namespace Daybreak.Services.TradeChat; /// Client implementation for https://github.com/3vcloud/kamadan-trade-chat /// </summary> /// <typeparam name="TChannelOptions"></typeparam> -public sealed class TradeChatService<TChannelOptions> : ITradeChatService<TChannelOptions>, IDisposable +internal sealed class TradeChatService<TChannelOptions> : ITradeChatService<TChannelOptions>, IDisposable where TChannelOptions : class, ITradeChatOptions, new() { private const long MinEpochTime = 1420070400; diff --git a/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs b/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs index 7d79cee4..73f3aae7 100644 --- a/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs @@ -6,7 +6,7 @@ using System.Core.Extensions; namespace Daybreak.Services.TradeChat; -public sealed class TradeHistoryDatabase : ITradeHistoryDatabase +internal sealed class TradeHistoryDatabase : ITradeHistoryDatabase { private readonly ILiteCollection<TraderMessageDTO> liteCollection; diff --git a/Daybreak/Services/TradeChat/TraderQuoteService.cs b/Daybreak/Services/TradeChat/TraderQuoteService.cs index 85ef3701..a2f6f723 100644 --- a/Daybreak/Services/TradeChat/TraderQuoteService.cs +++ b/Daybreak/Services/TradeChat/TraderQuoteService.cs @@ -3,7 +3,6 @@ using Daybreak.Models.Guildwars; using Daybreak.Models.Trade; using Daybreak.Services.TradeChat.Models; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -22,7 +21,7 @@ namespace Daybreak.Services.TradeChat; /// Based on https://github.com/3vcloud/kamadan-trade-chat /// </summary> /// <typeparam name="TChannelOptions"></typeparam> -public sealed class TraderQuoteService : ITraderQuoteService +internal sealed class TraderQuoteService : ITraderQuoteService { private const string TraderQuotesUri = "trader_quotes"; diff --git a/Daybreak/Services/TradeChat/WordHighlightingService.cs b/Daybreak/Services/TradeChat/WordHighlightingService.cs index 947d5020..1ccca407 100644 --- a/Daybreak/Services/TradeChat/WordHighlightingService.cs +++ b/Daybreak/Services/TradeChat/WordHighlightingService.cs @@ -7,31 +7,31 @@ using System.Windows.Media; namespace Daybreak.Services.TradeChat; -public sealed class WordHighlightingService : IWordHighlightingService +internal sealed class WordHighlightingService : IWordHighlightingService { private static readonly Regex WordsSplitRegex = new("[\\s+\\|+]", RegexOptions.Compiled); - private static readonly string[] BuyWords = new[] - { + private static readonly string[] BuyWords = + [ "wtb", "buy", "buying", "buyin", - }; - private static readonly string[] SellWords = new[] - { + ]; + private static readonly string[] SellWords = + [ "wts", "sell", "selling", "sellin" - }; - private static readonly string[] TradeWords = new[] - { + ]; + private static readonly string[] TradeWords = + [ "wtt", "trade", "trading", "lf", "tradin" - }; + ]; public IEnumerable<ColoredTextElement> ParseString(string s, SolidColorBrush foreground, SolidColorBrush buy, SolidColorBrush sell, SolidColorBrush trade) { diff --git a/Daybreak/Services/UMod/IUModService.cs b/Daybreak/Services/UMod/IUModService.cs index 7290c640..01adba3b 100644 --- a/Daybreak/Services/UMod/IUModService.cs +++ b/Daybreak/Services/UMod/IUModService.cs @@ -1,5 +1,6 @@ using Daybreak.Models.Progress; using Daybreak.Models.UMod; +using Daybreak.Models.Versioning; using Daybreak.Services.Mods; using System.Collections.Generic; using System.Threading; @@ -8,6 +9,8 @@ using System.Threading.Tasks; namespace Daybreak.Services.UMod; public interface IUModService : IModService { + Version Version { get; } + Task<bool> SetupUMod(UModInstallationStatus uModInstallationStatus); Task CheckAndUpdateUMod(CancellationToken cancellationToken); diff --git a/Daybreak/Services/UMod/UModService.cs b/Daybreak/Services/UMod/UModService.cs index d195965d..72cf4634 100644 --- a/Daybreak/Services/UMod/UModService.cs +++ b/Daybreak/Services/UMod/UModService.cs @@ -22,7 +22,7 @@ using System.Threading.Tasks; namespace Daybreak.Services.UMod; -public sealed class UModService : IUModService +internal sealed class UModService : IUModService { private const string TagPlaceholder = "[TAG_PLACEHOLDER]"; private const string ReleaseUrl = "https://github.com/gwdevhub/gMod/releases/download/[TAG_PLACEHOLDER]/gMod.dll"; @@ -53,6 +53,12 @@ public sealed class UModService : IUModService public bool IsInstalled => File.Exists(Path.GetFullPath(Path.Combine(UModDirectory, UModDll))); + public Models.Versioning.Version Version => File.Exists(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)) ? + Models.Versioning.Version.TryParse(FileVersionInfo.GetVersionInfo(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)).FileVersion!, out var version) ? + version : + Models.Versioning.Version.Zero : + Models.Versioning.Version.Zero; + public UModService( IProcessInjector processInjector, INotificationService notificationService, @@ -207,14 +213,7 @@ public sealed class UModService : IUModService return; } - var currentRelease = FileVersionInfo.GetVersionInfo(existingUMod).FileVersion; - if (!Daybreak.Models.Versioning.Version.TryParse(currentRelease ?? string.Empty, out var currentVersion)) - { - scopedLogger.LogError($"Unable to parse current version {currentRelease}"); - return; - } - - if (currentVersion.CompareTo(latestVersion) >= 0) + if (this.Version.CompareTo(latestVersion) >= 0) { scopedLogger.LogError($"UMod is up to date"); return; diff --git a/Daybreak/Services/Updater/ApplicationUpdater.cs b/Daybreak/Services/Updater/ApplicationUpdater.cs index f7999a62..db5c4b4c 100644 --- a/Daybreak/Services/Updater/ApplicationUpdater.cs +++ b/Daybreak/Services/Updater/ApplicationUpdater.cs @@ -22,7 +22,7 @@ using Version = Daybreak.Models.Versioning.Version; namespace Daybreak.Services.Updater; -public sealed class ApplicationUpdater : IApplicationUpdater +internal sealed class ApplicationUpdater : IApplicationUpdater { private const string InstallerFileName = "Daybreak.Installer.exe"; private const string UpdatedKey = "LauncherUpdating"; diff --git a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs b/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs index 463b7452..bd328b63 100644 --- a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs +++ b/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs @@ -5,7 +5,7 @@ using System.Core.Extensions; namespace Daybreak.Services.Updater.PostUpdate; -public sealed class PostUpdateActionManager : IPostUpdateActionManager +internal sealed class PostUpdateActionManager : IPostUpdateActionManager { private readonly IServiceManager serviceManager; private readonly ILogger<PostUpdateActionManager> logger; diff --git a/Daybreak/Services/Updater/UpdateNotificationHandler.cs b/Daybreak/Services/Updater/UpdateNotificationHandler.cs index af55de34..a1605cc3 100644 --- a/Daybreak/Services/Updater/UpdateNotificationHandler.cs +++ b/Daybreak/Services/Updater/UpdateNotificationHandler.cs @@ -6,7 +6,7 @@ using Daybreak.Views; using System.Core.Extensions; namespace Daybreak.Services.Updater; -public sealed class UpdateNotificationHandler : INotificationHandler +internal sealed class UpdateNotificationHandler : INotificationHandler { private readonly IViewManager viewManager; diff --git a/Daybreak/Views/BuildsSynchronizationView.xaml.cs b/Daybreak/Views/BuildsSynchronizationView.xaml.cs index 61f2ef20..246865e1 100644 --- a/Daybreak/Views/BuildsSynchronizationView.xaml.cs +++ b/Daybreak/Views/BuildsSynchronizationView.xaml.cs @@ -27,8 +27,8 @@ public partial class BuildsSynchronizationView : UserControl private readonly IViewManager viewManager; private readonly ILogger<BuildsSynchronizationView> logger; - public ObservableCollection<SynchronizationBuild> RemoteBuildEntries { get; } = new(); - public ObservableCollection<SynchronizationBuild> LocalBuildEntries { get; } = new(); + public ObservableCollection<SynchronizationBuild> RemoteBuildEntries { get; } = []; + public ObservableCollection<SynchronizationBuild> LocalBuildEntries { get; } = []; [GenerateDependencyProperty(InitialValue = true)] private bool buttonsEnabled; diff --git a/Daybreak/Views/FocusView.xaml.cs b/Daybreak/Views/FocusView.xaml.cs index 0e783f67..7696c9d7 100644 --- a/Daybreak/Views/FocusView.xaml.cs +++ b/Daybreak/Views/FocusView.xaml.cs @@ -303,17 +303,17 @@ public partial class FocusView : UserControl maybeGameData.MainPlayer.Position = this.GameData?.MainPlayer?.Position ?? new Position(); } - foreach(var worldPlayer in maybeGameData.WorldPlayers ?? new List<WorldPlayerInformation>()) + foreach(var worldPlayer in maybeGameData.WorldPlayers ?? []) { worldPlayer.Position = this.GameData?.WorldPlayers?.FirstOrDefault(w => w.Id == worldPlayer.Id)?.Position ?? new Position(); } - foreach (var partyPlayer in maybeGameData.Party ?? new List<PlayerInformation>()) + foreach (var partyPlayer in maybeGameData.Party ?? []) { partyPlayer.Position = this.GameData?.Party?.FirstOrDefault(w => w.Id == partyPlayer.Id)?.Position ?? new Position(); } - foreach (var entity in maybeGameData.LivingEntities ?? new List<LivingEntity>()) + foreach (var entity in maybeGameData.LivingEntities ?? []) { var oldEntity = this.GameData?.LivingEntities?.FirstOrDefault(w => w.Id == entity.Id); entity.Position = oldEntity?.Position ?? new Position(); diff --git a/Daybreak/Views/Launch/AccountsView.xaml.cs b/Daybreak/Views/Launch/AccountsView.xaml.cs index d9f089c0..c500b637 100644 --- a/Daybreak/Views/Launch/AccountsView.xaml.cs +++ b/Daybreak/Views/Launch/AccountsView.xaml.cs @@ -19,7 +19,7 @@ public partial class AccountsView : UserControl private readonly IViewManager viewManager; private readonly ICredentialManager credentialManager; - public ObservableCollection<LoginCredentials> Accounts { get; } = new(); + public ObservableCollection<LoginCredentials> Accounts { get; } = []; public AccountsView( IViewManager viewManager, diff --git a/Daybreak/Views/Launch/ExecutablesView.xaml.cs b/Daybreak/Views/Launch/ExecutablesView.xaml.cs index 1ced3400..e1be3f07 100644 --- a/Daybreak/Views/Launch/ExecutablesView.xaml.cs +++ b/Daybreak/Views/Launch/ExecutablesView.xaml.cs @@ -18,7 +18,7 @@ public partial class ExecutablesView : UserControl { private readonly IViewManager viewManager; private readonly IGuildWarsExecutableManager guildWarsExecutableManager; - public ObservableCollection<ExecutablePath> Paths { get; } = new(); + public ObservableCollection<ExecutablePath> Paths { get; } = []; public ExecutablesView( IViewManager viewManager, diff --git a/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs b/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs index a2ca1036..74fa1c37 100644 --- a/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs +++ b/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs @@ -29,8 +29,8 @@ public partial class LaunchConfigurationView : UserControl [GenerateDependencyProperty] private string selectedPath = default!; - public ObservableCollection<LoginCredentials> Credentials { get; set; } = new(); - public ObservableCollection<string> ExecutablePaths { get; set; } = new(); + public ObservableCollection<LoginCredentials> Credentials { get; set; } = []; + public ObservableCollection<string> ExecutablePaths { get; set; } = []; public LaunchConfigurationView( INotificationService notificationService, diff --git a/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs b/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs index cf0a5e18..c5067a35 100644 --- a/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs +++ b/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs @@ -18,7 +18,7 @@ public partial class LaunchConfigurationsView : UserControl private readonly IViewManager viewManager; private readonly ILaunchConfigurationService launchConfigurationService; - public ObservableCollection<LaunchConfigurationWithCredentials> LaunchConfigurations { get; set; } = new(); + public ObservableCollection<LaunchConfigurationWithCredentials> LaunchConfigurations { get; set; } = []; public LaunchConfigurationsView( IViewManager viewManager, diff --git a/Daybreak/Views/LauncherView.xaml.cs b/Daybreak/Views/LauncherView.xaml.cs index d470b8ae..be29657f 100644 --- a/Daybreak/Views/LauncherView.xaml.cs +++ b/Daybreak/Views/LauncherView.xaml.cs @@ -45,7 +45,7 @@ public partial class LauncherView : UserControl [GenerateDependencyProperty] private bool loading; - public ObservableCollection<LaunchConfigurationWithCredentials> LaunchConfigurations { get; } = new(); + public ObservableCollection<LaunchConfigurationWithCredentials> LaunchConfigurations { get; } = []; public LauncherView( IMenuService menuService, @@ -108,40 +108,45 @@ public partial class LauncherView : UserControl return; } - if (this.applicationLauncher.GetGuildwarsProcess(this.LatestConfiguration) is GuildWarsApplicationLaunchContext context) + var launchingTask = await new TaskFactory().StartNew(async () => { - // Detected already running guildwars process - await this.Dispatcher.InvokeAsync(() => this.Loading = false); - if (this.focusViewOptions.Value.Enabled) - { - this.menuService.CloseMenu(); - this.viewManager.ShowView<FocusView>(context); - } - - return; - } - - try - { - var launchedContext = await this.applicationLauncher.LaunchGuildwars(this.LatestConfiguration); - if (launchedContext is null) + var latestConfig = await this.Dispatcher.InvokeAsync(() => this.LatestConfiguration); + if (this.applicationLauncher.GetGuildwarsProcess(latestConfig) is GuildWarsApplicationLaunchContext context) { + // Detected already running guildwars process await this.Dispatcher.InvokeAsync(() => this.Loading = false); + if (this.focusViewOptions.Value.Enabled) + { + this.menuService.CloseMenu(); + this.viewManager.ShowView<FocusView>(context); + } + return; } - this.launchConfigurationService.SetLastLaunchConfigurationWithCredentials(this.LatestConfiguration); - if (this.focusViewOptions.Value.Enabled) + try { - await this.Dispatcher.InvokeAsync(() => this.Loading = false); - this.menuService.CloseMenu(); - this.viewManager.ShowView<FocusView>(launchedContext); - } - } - catch (Exception) - { - } + var launchedContext = await this.applicationLauncher.LaunchGuildwars(latestConfig); + if (launchedContext is null) + { + await this.Dispatcher.InvokeAsync(() => this.Loading = false); + return; + } + this.launchConfigurationService.SetLastLaunchConfigurationWithCredentials(latestConfig); + if (this.focusViewOptions.Value.Enabled) + { + await this.Dispatcher.InvokeAsync(() => this.Loading = false); + this.menuService.CloseMenu(); + this.viewManager.ShowView<FocusView>(launchedContext); + } + } + catch (Exception) + { + } + }, TaskCreationOptions.LongRunning); + + await launchingTask; await this.Dispatcher.InvokeAsync(() => this.Loading = false); } } diff --git a/Daybreak/Views/MetricsView.xaml.cs b/Daybreak/Views/MetricsView.xaml.cs index ad1c25a0..dcced760 100644 --- a/Daybreak/Views/MetricsView.xaml.cs +++ b/Daybreak/Views/MetricsView.xaml.cs @@ -31,7 +31,7 @@ public partial class MetricsView : UserControl private readonly SolidColorPaint accentPaint; private readonly IMetricsService metricsService; - public ObservableCollection<MetricSetViewModel> Metrics { get; } = new ObservableCollection<MetricSetViewModel>(); + public ObservableCollection<MetricSetViewModel> Metrics { get; } = []; public MetricsView( IMetricsService metricsService) diff --git a/Daybreak/Views/NotificationsView.xaml.cs b/Daybreak/Views/NotificationsView.xaml.cs index eae03228..d509720f 100644 --- a/Daybreak/Views/NotificationsView.xaml.cs +++ b/Daybreak/Views/NotificationsView.xaml.cs @@ -22,7 +22,7 @@ public partial class NotificationsView : UserControl private CancellationTokenSource? cancellationTokenSource; - public ObservableCollection<Notification> Notifications { get; } = new ObservableCollection<Notification>(); + public ObservableCollection<Notification> Notifications { get; } = []; public NotificationsView( INotificationProducer notificationProducer, diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeMainView.xaml.cs b/Daybreak/Views/Onboarding/ReShade/ReShadeMainView.xaml.cs index a9cb2692..868d738d 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeMainView.xaml.cs +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeMainView.xaml.cs @@ -31,7 +31,7 @@ public partial class ReShadeMainView : UserControl [GenerateDependencyProperty] private bool loading; - public ObservableCollection<UModEntry> Mods { get; } = new(); + public ObservableCollection<UModEntry> Mods { get; } = []; public ReShadeMainView( IViewManager viewManager, diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeStockEffectsSelectorView.xaml.cs b/Daybreak/Views/Onboarding/ReShade/ReShadeStockEffectsSelectorView.xaml.cs index 0d117f09..46f29494 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeStockEffectsSelectorView.xaml.cs +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeStockEffectsSelectorView.xaml.cs @@ -19,7 +19,7 @@ public partial class ReShadeStockEffectsSelectorView : UserControl [GenerateDependencyProperty] private bool loading; - public ObservableCollection<ShaderPackage> Packages { get; set; } = new(); + public ObservableCollection<ShaderPackage> Packages { get; set; } = []; public ReShadeStockEffectsSelectorView( IReShadeService reShadeService) diff --git a/Daybreak/Views/Onboarding/UMod/UModMainView.xaml b/Daybreak/Views/Onboarding/UMod/UModMainView.xaml index 73b2517c..e3073e5c 100644 --- a/Daybreak/Views/Onboarding/UMod/UModMainView.xaml +++ b/Daybreak/Views/Onboarding/UMod/UModMainView.xaml @@ -31,6 +31,22 @@ <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right"> + <TextBlock + ToolTip="Current uMod version" + FontSize="9" + Text="Version: " + Foreground="{Binding MahApps.Brushes.ThemeForeground}" + VerticalAlignment="Bottom" + TextAlignment="Center" + Margin="0, 0, 0, 0"/> + <TextBlock + ToolTip="Current uMod version" + FontSize="9" + Text="{Binding ElementName=_this, Path=CurrentVersion, Mode=OneWay}" + Foreground="{Binding MahApps.Brushes.ThemeForeground}" + VerticalAlignment="Bottom" + TextAlignment="Center" + Margin="0, 0, 15, 0"/> <buttons:HelpButton ToolTip="uMod Wiki" Height="30" diff --git a/Daybreak/Views/Onboarding/UMod/UModMainView.xaml.cs b/Daybreak/Views/Onboarding/UMod/UModMainView.xaml.cs index 3399823a..cfc8ee0c 100644 --- a/Daybreak/Views/Onboarding/UMod/UModMainView.xaml.cs +++ b/Daybreak/Views/Onboarding/UMod/UModMainView.xaml.cs @@ -32,7 +32,10 @@ public partial class UModMainView : UserControl [GenerateDependencyProperty] public bool uModEnabled; - public ObservableCollection<UModEntry> Mods { get; } = new(); + [GenerateDependencyProperty] + public string currentVersion; + + public ObservableCollection<UModEntry> Mods { get; } = []; public UModMainView( IViewManager viewManager, @@ -50,6 +53,7 @@ public partial class UModMainView : UserControl { this.RefreshMods(); this.UModEnabled = this.uModService.IsEnabled; + this.CurrentVersion = this.uModService.Version.ToString(); } private void SaveButton_Clicked(object _, EventArgs e) diff --git a/Daybreak/Views/OptionSectionView.xaml.cs b/Daybreak/Views/OptionSectionView.xaml.cs index 2548c7f3..5d54f9c2 100644 --- a/Daybreak/Views/OptionSectionView.xaml.cs +++ b/Daybreak/Views/OptionSectionView.xaml.cs @@ -31,7 +31,7 @@ public partial class OptionSectionView : UserControl [GenerateDependencyProperty] private string title = string.Empty; - public ObservableCollection<OptionEntry> OptionEntries { get; } = new ObservableCollection<OptionEntry>(); + public ObservableCollection<OptionEntry> OptionEntries { get; } = []; public OptionSectionView( IViewManager viewManager, diff --git a/Daybreak/Views/PluginsView.xaml.cs b/Daybreak/Views/PluginsView.xaml.cs index 4e4b9d28..a506203d 100644 --- a/Daybreak/Views/PluginsView.xaml.cs +++ b/Daybreak/Views/PluginsView.xaml.cs @@ -20,7 +20,7 @@ public partial class PluginsView : UserControl private readonly IViewManager viewManager; private readonly IPluginsService pluginsService; - public ObservableCollection<AvailablePlugin> AvailablePlugins { get; private set; } = new(); + public ObservableCollection<AvailablePlugin> AvailablePlugins { get; private set; } = []; public PluginsView( IViewManager viewManager, diff --git a/Daybreak/Views/Trade/PriceHistoryView.xaml.cs b/Daybreak/Views/Trade/PriceHistoryView.xaml.cs index 86e84f07..dfff1f25 100644 --- a/Daybreak/Views/Trade/PriceHistoryView.xaml.cs +++ b/Daybreak/Views/Trade/PriceHistoryView.xaml.cs @@ -26,7 +26,7 @@ public partial class PriceHistoryView : UserControl { private readonly IViewManager viewManager; private readonly IPriceHistoryService priceHistoryService; - private readonly List<TraderQuote> traderQuotes = new(); + private readonly List<TraderQuote> traderQuotes = []; private readonly SolidColorPaint backgroundPaint; private readonly SolidColorPaint foregroundPaint; private readonly SolidColorPaint accentPaint; diff --git a/Daybreak/Views/Trade/PriceQuotesView.xaml.cs b/Daybreak/Views/Trade/PriceQuotesView.xaml.cs index e2811f13..c7536882 100644 --- a/Daybreak/Views/Trade/PriceQuotesView.xaml.cs +++ b/Daybreak/Views/Trade/PriceQuotesView.xaml.cs @@ -23,12 +23,12 @@ public partial class PriceQuotesView : UserControl private readonly IViewManager viewManager; private readonly ITraderQuoteService traderQuoteService; - private List<TraderQuote> traderQuotesCache = new(); + private List<TraderQuote> traderQuotesCache = []; [GenerateDependencyProperty] private bool loading = false; - public ObservableCollection<TraderQuote> TraderQuotes { get; } = new ObservableCollection<TraderQuote>(); + public ObservableCollection<TraderQuote> TraderQuotes { get; } = []; public PriceQuotesView( IViewManager viewManager, diff --git a/Daybreak/Views/Trade/TradeAlertsView.xaml.cs b/Daybreak/Views/Trade/TradeAlertsView.xaml.cs index d1dd1787..f2bbfe99 100644 --- a/Daybreak/Views/Trade/TradeAlertsView.xaml.cs +++ b/Daybreak/Views/Trade/TradeAlertsView.xaml.cs @@ -20,7 +20,7 @@ public partial class TradeAlertsView : UserControl private readonly IViewManager viewManager; private readonly ITradeAlertingService tradeAlertingService; - public ObservableCollection<TradeAlert> TradeAlerts { get; set; } = new(); + public ObservableCollection<TradeAlert> TradeAlerts { get; set; } = []; public TradeAlertsView( IViewManager viewManager, diff --git a/Daybreak/Views/VersionManagementView.xaml.cs b/Daybreak/Views/VersionManagementView.xaml.cs index 736c410a..1c21728a 100644 --- a/Daybreak/Views/VersionManagementView.xaml.cs +++ b/Daybreak/Views/VersionManagementView.xaml.cs @@ -28,7 +28,7 @@ public partial class VersionManagementView : UserControl [GenerateDependencyProperty] private bool loading; - public ObservableCollection<Version> Versions { get; } = new(); + public ObservableCollection<Version> Versions { get; } = []; public VersionManagementView( IApplicationUpdater applicationUpdater,