mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-15 15:19:57 +00:00
Further decouple shared project from main application (#991)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using Daybreak.Shared;
|
||||
using Daybreak.Shared.Models.Guildwars;
|
||||
using Daybreak.Shared.Models.Guildwars;
|
||||
using Daybreak.Shared.Services.Events;
|
||||
using ExCSS;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -9,43 +9,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.1.120" />
|
||||
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
|
||||
<PackageReference Include="ini-parser-netstandard" Version="2.5.3" />
|
||||
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc2" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="Microsoft.CorrelationVector" Version="1.0.42" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3240.44" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
|
||||
<PackageReference Include="NAudio" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="PeNet" Version="5.1.0" />
|
||||
<PackageReference Include="Plumsy" Version="1.1.0" />
|
||||
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
||||
<PackageReference Include="Slim" Version="1.9.2" />
|
||||
<PackageReference Include="Squealify" Version="0.8.2.2" />
|
||||
<PackageReference Include="Svg" Version="3.4.7" />
|
||||
<PackageReference Include="System.Formats.Asn1" Version="9.0.5" />
|
||||
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="System.Reflection.Metadata" Version="9.0.5" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.5" />
|
||||
<PackageReference Include="System.Text.Json" Version="9.0.5" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageReference Include="SystemExtensions.NetCore" Version="1.6.11" />
|
||||
<PackageReference Include="SystemExtensions.NetStandard" Version="1.6.11" />
|
||||
<PackageReference Include="SystemExtensions.NetStandard.DependencyInjection" Version="1.6.9" />
|
||||
<PackageReference Include="WpfExtended" Version="0.7.9" />
|
||||
<PackageReference Include="WpfExtended.SourceGeneration" Version="0.3.0" />
|
||||
<PackageReference Include="WpfScreenHelper" Version="2.1.1" />
|
||||
<PackageReference Include="WriteableBitmapEx" Version="1.6.8" />
|
||||
<PackageReference Include="SystemExtensions.NetStandard.Generators" Version="0.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Daybreak.Shared.Models.Guildwars;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Extensions;
|
||||
using System.Extensions;
|
||||
|
||||
namespace Daybreak.Models;
|
||||
public partial class EventViewModel : INotifyPropertyChanged
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Daybreak.Shared.Models;
|
||||
|
||||
public sealed class KeyMacro
|
||||
{
|
||||
public List<Keys>? Keys { get; set; }
|
||||
public Keys TargetKey { get; set; }
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace Daybreak.Shared.Models;
|
||||
|
||||
public sealed class KeyboardHookEventArgs
|
||||
{
|
||||
public bool Handled { get; set; }
|
||||
public KeyboardState KeyboardState { get; }
|
||||
public KeyboardInput KeyboardInput { get; }
|
||||
|
||||
public KeyboardHookEventArgs(
|
||||
KeyboardState keyboardState,
|
||||
KeyboardInput keyboardInput)
|
||||
{
|
||||
this.KeyboardState = keyboardState;
|
||||
this.KeyboardInput = keyboardInput;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Daybreak.Shared.Models;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct KeyboardInput
|
||||
{
|
||||
/// <summary>
|
||||
/// A virtual-key code. The code must be a value in the range 1 to 254.
|
||||
/// </summary>
|
||||
public int VirtualCode;
|
||||
|
||||
// EDT: added a conversion from VirtualCode to Keys.
|
||||
/// <summary>
|
||||
/// The VirtualCode converted to typeof(Keys) for higher usability.
|
||||
/// </summary>
|
||||
public Keys Key { get { return (Keys)this.VirtualCode; } }
|
||||
|
||||
/// <summary>
|
||||
/// A hardware scan code for the key.
|
||||
/// </summary>
|
||||
public int HardwareScanCode;
|
||||
|
||||
/// <summary>
|
||||
/// The extended-key flag, event-injected Flags, context code, and transition-state flag. This member is specified as follows. An application can use the following values to test the keystroke Flags. Testing LLKHF_INJECTED (bit 4) will tell you whether the event was injected. If it was, then testing LLKHF_LOWER_IL_INJECTED (bit 1) will tell you whether or not the event was injected from a process running at lower integrity level.
|
||||
/// </summary>
|
||||
public int Flags;
|
||||
|
||||
/// <summary>
|
||||
/// The time stamp stamp for this message, equivalent to what GetMessageTime would return for this message.
|
||||
/// </summary>
|
||||
public int TimeStamp;
|
||||
|
||||
/// <summary>
|
||||
/// Additional information associated with the message.
|
||||
/// </summary>
|
||||
public nint AdditionalInformation;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Daybreak.Shared.Models;
|
||||
|
||||
public enum KeyboardState
|
||||
{
|
||||
KeyDown = 0x0100,
|
||||
KeyUp = 0x0101,
|
||||
SysKeyDown = 0x0104,
|
||||
SysKeyUp = 0x0105
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Daybreak.Shared.Models;
|
||||
|
||||
public sealed class Win32Window : System.Windows.Forms.IWin32Window
|
||||
{
|
||||
public Win32Window(Window window)
|
||||
{
|
||||
this.Handle = new WindowInteropHelper(window).Handle;
|
||||
}
|
||||
|
||||
public nint Handle { get; init; }
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using Daybreak.Shared.Services.Mods;
|
||||
using System.Windows.Extensions.Services;
|
||||
|
||||
namespace Daybreak.Shared.Services.Guildwars;
|
||||
public interface IGuildWarsVersionChecker : IModService, IApplicationLifetimeService
|
||||
public interface IGuildWarsVersionChecker : IModService
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Windows.Extensions.Services;
|
||||
namespace Daybreak.Shared.Services.Shortcuts;
|
||||
|
||||
namespace Daybreak.Shared.Services.Shortcuts;
|
||||
|
||||
public interface IShortcutManager : IApplicationLifetimeService
|
||||
public interface IShortcutManager
|
||||
{
|
||||
bool ShortcutEnabled { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using ControlzEx.Theming;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Daybreak.Shared.Services.Themes;
|
||||
public interface IThemeManager
|
||||
{
|
||||
Theme GetCurrentTheme();
|
||||
// Hacky way to pass the theme without having to take a dependency on the theme manager
|
||||
object? GetCurrentTheme();
|
||||
Color GetForegroundColor();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using Daybreak.Shared.Models.Progress;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Extensions.Services;
|
||||
using Version = Daybreak.Shared.Models.Versioning.Version;
|
||||
|
||||
namespace Daybreak.Shared.Services.Updater;
|
||||
|
||||
public interface IApplicationUpdater : IApplicationLifetimeService
|
||||
public interface IApplicationUpdater
|
||||
{
|
||||
Version CurrentVersion { get; }
|
||||
void FinalizeUpdate();
|
||||
|
||||
@@ -53,6 +53,30 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Reloaded.Assembler" Version="1.0.16" />
|
||||
<PackageReference Include="WpfExtended" Version="0.7.9" />
|
||||
<PackageReference Include="WpfExtended.SourceGeneration" Version="0.3.0" />
|
||||
<PackageReference Include="WpfScreenHelper" Version="2.1.1" />
|
||||
<PackageReference Include="WriteableBitmapEx" Version="1.6.8" />
|
||||
<PackageReference Include="Squealify" Version="0.8.2.2" />
|
||||
<PackageReference Include="System.Formats.Asn1" Version="9.0.5" />
|
||||
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||
<PackageReference Include="PeNet" Version="5.1.0" />
|
||||
<PackageReference Include="Plumsy" Version="1.1.0" />
|
||||
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.1.120" />
|
||||
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
|
||||
<PackageReference Include="ini-parser-netstandard" Version="2.5.3" />
|
||||
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc2" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="Microsoft.CorrelationVector" Version="1.0.42" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
|
||||
<PackageReference Include="NAudio" Version="2.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,9 +10,10 @@ using System.Core.Extensions;
|
||||
using System.Extensions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Extensions.Services;
|
||||
|
||||
namespace Daybreak.Services.GuildWars;
|
||||
internal sealed class GuildWarsVersionChecker : IGuildWarsVersionChecker
|
||||
internal sealed class GuildWarsVersionChecker : IGuildWarsVersionChecker, IApplicationLifetimeService
|
||||
{
|
||||
public string Name => "GuildWars Version Checker";
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Daybreak.Configuration.Options;
|
||||
using ControlzEx.Theming;
|
||||
using Daybreak.Configuration.Options;
|
||||
using Daybreak.Launch;
|
||||
using Daybreak.Shared.Models;
|
||||
using Daybreak.Shared.Services.Screens;
|
||||
@@ -6,6 +7,7 @@ using Daybreak.Shared.Services.Themes;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Collections.Generic;
|
||||
using System.Core.Extensions;
|
||||
using System.Extensions;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
@@ -51,7 +53,12 @@ internal sealed class SplashScreenService : ISplashScreenService
|
||||
|
||||
private void SetupThemeResources()
|
||||
{
|
||||
var theme = this.themeManager.GetCurrentTheme();
|
||||
var theme = this.themeManager.GetCurrentTheme()?.As<Theme>();
|
||||
if (theme is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(var key in theme.Resources.Keys)
|
||||
{
|
||||
this.splashWindow.Resources.Add(key, theme.Resources[key]);
|
||||
|
||||
@@ -6,11 +6,12 @@ using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Extensions;
|
||||
using System.IO;
|
||||
using System.Windows.Extensions.Services;
|
||||
|
||||
namespace Daybreak.Services.Shortcuts;
|
||||
|
||||
//TODO: Fix dependency on IConfigurationManager
|
||||
internal sealed class ShortcutManager : IShortcutManager
|
||||
internal sealed class ShortcutManager : IShortcutManager, IApplicationLifetimeService
|
||||
{
|
||||
private const string ShortcutName = "Daybreak.lnk";
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ internal sealed class ThemeManager : IThemeManager, IApplicationLifetimeService
|
||||
return (Color)mahAppsResources!["MahApps.Colors.ThemeForeground"];
|
||||
}
|
||||
|
||||
public Theme GetCurrentTheme()
|
||||
public object? GetCurrentTheme()
|
||||
{
|
||||
return ControlzEx.Theming.ThemeManager.Current.DetectTheme(Launcher.Instance) ?? throw new InvalidOperationException("Unable to retrieve theme");
|
||||
}
|
||||
|
||||
@@ -25,12 +25,13 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Extensions.Services;
|
||||
using UpdateStatus = Daybreak.Shared.Models.Progress.UpdateStatus;
|
||||
using Version = Daybreak.Shared.Models.Versioning.Version;
|
||||
|
||||
namespace Daybreak.Services.Updater;
|
||||
|
||||
internal sealed class ApplicationUpdater : IApplicationUpdater
|
||||
internal sealed class ApplicationUpdater : IApplicationUpdater, IApplicationLifetimeService
|
||||
{
|
||||
private const string UpdatePkgSubPath = "update.pkg";
|
||||
private const string TempInstallerFileNameSubPath = "Daybreak.Installer.Temp.exe";
|
||||
|
||||
Reference in New Issue
Block a user