mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-09-16 13:29:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b27998d7f2 | ||
|
|
98d3e21db9 |
@@ -8,6 +8,8 @@ namespace Daybreak.Configuration
|
||||
{
|
||||
[JsonProperty("ToolboxPath")]
|
||||
public string ToolboxPath { get; set; }
|
||||
[JsonProperty("TexmodPath")]
|
||||
public string TexmodPath { get; set; }
|
||||
[JsonProperty("ToolboxAutoLaunch")]
|
||||
public bool ToolboxAutoLaunch { get; set; }
|
||||
[JsonProperty("LeftBrowserDefault")]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
|
||||
<Version>0.6.2</Version>
|
||||
<Version>0.6.3</Version>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Daybreak.Services.Logging;
|
||||
using Daybreak.Services.Mutex;
|
||||
using Daybreak.Utils;
|
||||
using Microsoft.Win32;
|
||||
using Pepa.Wpf.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -12,12 +13,15 @@ using System.Extensions;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Daybreak.Services.ApplicationLauncher
|
||||
{
|
||||
public class ApplicationLauncher : IApplicationLauncher
|
||||
{
|
||||
private const string TexModProcessName = "TexMod";
|
||||
private const string UModProcessName = "uMod";
|
||||
private const string ToolboxProcessName = "GWToolbox";
|
||||
private const string ProcessName = "gw";
|
||||
private const string ArenaNetMutex = "AN-Mute";
|
||||
@@ -27,6 +31,7 @@ namespace Daybreak.Services.ApplicationLauncher
|
||||
private readonly IMutexHandler mutexHandler;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public bool IsTexmodRunning => TexModProcessDetected();
|
||||
public bool IsGuildwarsRunning => this.GuildwarsProcessDetected();
|
||||
public bool IsToolboxRunning => GuildwarsToolboxProcessDetected();
|
||||
|
||||
@@ -80,6 +85,24 @@ namespace Daybreak.Services.ApplicationLauncher
|
||||
});
|
||||
}
|
||||
|
||||
public Task LaunchTexmod()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var configuration = this.configurationManager.GetConfiguration();
|
||||
var executable = configuration.TexmodPath;
|
||||
if (File.Exists(executable) is false)
|
||||
{
|
||||
throw new ExecutableNotFoundException($"Texmod executable doesn't exist at {executable}");
|
||||
}
|
||||
|
||||
if (Process.Start(executable) is null)
|
||||
{
|
||||
throw new InvalidOperationException($"Unable to launch {executable}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void LaunchGuildwarsProcess(string email, Models.SecureString password, string character)
|
||||
{
|
||||
var executable = this.configurationManager.GetConfiguration().GuildwarsPaths.Where(path => path.Default).FirstOrDefault();
|
||||
@@ -132,7 +155,7 @@ namespace Daybreak.Services.ApplicationLauncher
|
||||
}
|
||||
}
|
||||
|
||||
return Process.GetProcessesByName(ProcessName).FirstOrDefault() is not null;
|
||||
return Process.GetProcessesByName(ProcessName).Any();
|
||||
}
|
||||
|
||||
private void ClearGwLocks()
|
||||
@@ -197,7 +220,14 @@ namespace Daybreak.Services.ApplicationLauncher
|
||||
|
||||
private static bool GuildwarsToolboxProcessDetected()
|
||||
{
|
||||
return Process.GetProcessesByName(ToolboxProcessName).FirstOrDefault() is not null;
|
||||
return Process.GetProcessesByName(ToolboxProcessName).Any();
|
||||
}
|
||||
|
||||
private static bool TexModProcessDetected()
|
||||
{
|
||||
return Process.GetProcesses()
|
||||
.Where(process => string.Equals(process.ProcessName, UModProcessName, StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(process.ProcessName, TexModProcessName, StringComparison.OrdinalIgnoreCase)).Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ namespace Daybreak.Services.ApplicationLauncher
|
||||
{
|
||||
bool IsGuildwarsRunning { get; }
|
||||
bool IsToolboxRunning { get; }
|
||||
bool IsTexmodRunning { get; }
|
||||
Task LaunchGuildwars();
|
||||
Task LaunchGuildwarsToolbox();
|
||||
Task LaunchTexmod();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
|
||||
namespace Pepa.Wpf.Utilities
|
||||
{
|
||||
@@ -102,5 +103,7 @@ namespace Pepa.Wpf.Utilities
|
||||
public static extern NtStatus NtQueryObject(IntPtr ObjectHandle, ObjectInformationClass ObjectInformationClass, IntPtr ObjectInformation, int ObjectInformationLength, out int ReturnLength);
|
||||
[DllImport("ntdll.dll")]
|
||||
public static extern NtStatus NtQuerySystemInformation(SystemInformationClass SystemInformationClass, IntPtr SystemInformation, int SystemInformationLength, out int ReturnLength);
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern bool QueryFullProcessImageName(IntPtr hProcess, uint dwFlags, StringBuilder lpExeName, ref uint lpdwSize);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,11 @@
|
||||
<controls:OpaqueButton Text="Launch toolbox" Highlight="White" TransparentBackground="Black" HighlightOpacity="0.3" BackgroundOpacity="0.2"
|
||||
Foreground="White" FontSize="24" Width="200" Height="40" Margin="0, 10, 0, 10"
|
||||
IsEnabled="{Binding ElementName=_this, Path=LaunchToolboxButtonEnabled, Mode=OneWay}"
|
||||
Clicked="LaunchToolboxButton_Clicked" Grid.Row="1" Grid.ColumnSpan="3"></controls:OpaqueButton>
|
||||
Clicked="LaunchToolboxButton_Clicked" Grid.Row="1" Grid.ColumnSpan="2"></controls:OpaqueButton>
|
||||
<controls:OpaqueButton Text="Launch texmod" Highlight="White" TransparentBackground="Black" HighlightOpacity="0.3" BackgroundOpacity="0.2"
|
||||
Foreground="White" FontSize="24" Width="200" Height="40" Margin="0, 10, 0, 10"
|
||||
IsEnabled="{Binding ElementName=_this, Path=LaunchTexmodButtonEnabled, Mode=OneWay}"
|
||||
Clicked="LaunchTexmodButton_Clicked" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="1"></controls:OpaqueButton>
|
||||
<Grid x:Name="RightContainer" Grid.Column="2" Margin="10">
|
||||
<controls:ChromiumBrowserWrapper Address="{Binding ElementName=_this, Path=RightBrowserAddress, Mode=OneWay}"
|
||||
Foreground="White" FavoriteUriChanged="RightBrowser_FavoriteUriChanged"
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Daybreak.Views
|
||||
DependencyPropertyExtensions.Register<MainView, bool>(nameof(LaunchButtonEnabled));
|
||||
public static readonly DependencyProperty LaunchToolboxButtonEnabledProperty =
|
||||
DependencyPropertyExtensions.Register<MainView, bool>(nameof(LaunchToolboxButtonEnabled));
|
||||
public static readonly DependencyProperty LaunchTexmodButtonEnabledProperty =
|
||||
DependencyPropertyExtensions.Register<MainView, bool>(nameof(LaunchTexmodButtonEnabled));
|
||||
public static readonly DependencyProperty RightBrowserAddressProperty =
|
||||
DependencyPropertyExtensions.Register<MainView, string>(nameof(RightBrowserAddress));
|
||||
public static readonly DependencyProperty LeftBrowserAddressProperty =
|
||||
@@ -69,6 +71,11 @@ namespace Daybreak.Views
|
||||
get => this.GetTypedValue<bool>(LaunchToolboxButtonEnabledProperty);
|
||||
set => this.SetTypedValue(LaunchToolboxButtonEnabledProperty, value);
|
||||
}
|
||||
public bool LaunchTexmodButtonEnabled
|
||||
{
|
||||
get => this.GetTypedValue<bool>(LaunchTexmodButtonEnabledProperty);
|
||||
set => this.SetTypedValue(LaunchTexmodButtonEnabledProperty, value);
|
||||
}
|
||||
|
||||
public MainView(
|
||||
IApplicationLauncher applicationDetector,
|
||||
@@ -99,8 +106,9 @@ namespace Daybreak.Views
|
||||
|
||||
private void CheckGameState()
|
||||
{
|
||||
this.LaunchButtonEnabled = applicationDetector.IsGuildwarsRunning is false;
|
||||
this.LaunchToolboxButtonEnabled = applicationDetector.IsToolboxRunning is false;
|
||||
this.LaunchButtonEnabled = this.applicationDetector.IsGuildwarsRunning is false;
|
||||
this.LaunchToolboxButtonEnabled = this.applicationDetector.IsToolboxRunning is false;
|
||||
this.LaunchTexmodButtonEnabled = this.applicationDetector.IsTexmodRunning is false;
|
||||
}
|
||||
|
||||
private void StartupView_Loaded(object sender, RoutedEventArgs e)
|
||||
@@ -146,6 +154,18 @@ namespace Daybreak.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void LaunchTexmodButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.applicationDetector.LaunchTexmod();
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.viewManager.ShowView<SettingsView>();
|
||||
}
|
||||
}
|
||||
|
||||
private void LeftBrowser_FavoriteUriChanged(object sender, string e)
|
||||
{
|
||||
var config = this.configurationManager.GetConfiguration();
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
<controls:SaveButton Foreground="White" Height="30" Width="30" Grid.Column="1" HorizontalAlignment="Right" Margin="5"
|
||||
Clicked="SaveButton_Clicked"></controls:SaveButton>
|
||||
<StackPanel Orientation="Vertical" Grid.Row="1">
|
||||
<TextBlock Text="Texmod path" FontSize="22" Foreground="White"></TextBlock>
|
||||
<TextBlock Text="GWToolbox path: " FontSize="22" Foreground="White"></TextBlock>
|
||||
<TextBlock Text="GWToolbox auto-launch: " FontSize="22" Foreground="White"></TextBlock>
|
||||
<TextBlock Text="Address bar readonly: " FontSize="22" Foreground="White"/>
|
||||
@@ -88,6 +89,14 @@
|
||||
<TextBlock Text="Right browser homepage: " FontSize="22" Foreground="White"></TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="1">
|
||||
<Grid>
|
||||
<TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
|
||||
FontSize="22" Margin="0, 0, 30, 0" Background="Transparent" Foreground="White"
|
||||
Text="{Binding ElementName=_this, Path=TexmodPath, Mode=TwoWay}"></TextBox>
|
||||
<controls:FilePickerGlyph Height="30" Width="30" HorizontalAlignment="Right"
|
||||
Foreground="White" BorderBrush="Gray" BorderThickness="0"
|
||||
Clicked="TexmodFilePickerGlyph_Clicked"></controls:FilePickerGlyph>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
|
||||
FontSize="22" Margin="0, 0, 30, 0" Background="Transparent" Foreground="White"
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace Daybreak.Views
|
||||
/// </summary>
|
||||
public partial class SettingsView : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty TexmodPathProperty =
|
||||
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(TexmodPath));
|
||||
public static readonly DependencyProperty ToolboxPathProperty =
|
||||
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(ToolboxPath));
|
||||
public static readonly DependencyProperty AddressBarReadonlyProperty =
|
||||
@@ -28,6 +30,11 @@ namespace Daybreak.Views
|
||||
private readonly IConfigurationManager configurationManager;
|
||||
private readonly IViewManager viewManager;
|
||||
|
||||
public string TexmodPath
|
||||
{
|
||||
get => this.GetTypedValue<string>(TexmodPathProperty);
|
||||
set => this.SetValue(TexmodPathProperty, value);
|
||||
}
|
||||
public bool ToolboxAutoLaunch
|
||||
{
|
||||
get => this.GetTypedValue<bool>(ToolboxAutoLaunchProperty);
|
||||
@@ -72,6 +79,7 @@ namespace Daybreak.Views
|
||||
this.LeftBrowserUrl = config.LeftBrowserDefault;
|
||||
this.RightBrowserUrl = config.RightBrowserDefault;
|
||||
this.ToolboxAutoLaunch = config.ToolboxAutoLaunch;
|
||||
this.TexmodPath = config.TexmodPath;
|
||||
}
|
||||
|
||||
private void SaveButton_Clicked(object sender, EventArgs e)
|
||||
@@ -82,6 +90,7 @@ namespace Daybreak.Views
|
||||
currentConfig.LeftBrowserDefault = this.LeftBrowserUrl;
|
||||
currentConfig.RightBrowserDefault = this.RightBrowserUrl;
|
||||
currentConfig.ToolboxAutoLaunch = this.ToolboxAutoLaunch;
|
||||
currentConfig.TexmodPath = this.TexmodPath;
|
||||
this.configurationManager.SaveConfiguration(currentConfig);
|
||||
this.viewManager.ShowView<SettingsCategoryView>();
|
||||
}
|
||||
@@ -101,6 +110,21 @@ namespace Daybreak.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void TexmodFilePickerGlyph_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
var filePicker = new OpenFileDialog()
|
||||
{
|
||||
CheckFileExists = true,
|
||||
CheckPathExists = true,
|
||||
DefaultExt = "exe",
|
||||
Multiselect = false
|
||||
};
|
||||
if (filePicker.ShowDialog() is true)
|
||||
{
|
||||
this.TexmodPath = filePicker.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
private void BackButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
this.viewManager.ShowView<SettingsCategoryView>();
|
||||
|
||||
@@ -6,24 +6,14 @@ Requires webview2 runtime https://go.microsoft.com/fwlink/p/?LinkId=2124703.
|
||||

|
||||

|
||||
|
||||
# Examples/Usage
|
||||
To modify any settings, press the settings button on the titlebar
|
||||

|
||||
|
||||
When launching, if any of the required settings are not valid (missing username/password/character name), the launcher will open the settings page.
|
||||

|
||||
|
||||
By default, the browser address bar is set to readonly. To allow any link to be typed in the address bar, change the "Address bar readonly" setting from settings page to "True".
|
||||
|
||||
When in the main view, the browsers open the default/prefferred page. To change the prefferred page, navigate to it using one of the browsers and press the star button. The current loaded page will become the default for the selected browser.
|
||||

|
||||
|
||||
To display other images than the ones retrieved from "http://bloogum.net/guildwars", place images in the Screenshots folder, next to the Daybreak.exe executable. If the folder doesn't exist yet, either create it or run the launcher once so that it gets created automatically.
|
||||
|
||||
# Features
|
||||
Automatically detect if guildwars is running or not. Includes the ability to launch guildwars from the client.
|
||||
|
||||
Manages username and password combination.
|
||||
Multibox support.
|
||||
|
||||
Manages multiple username and password combinations.
|
||||
|
||||
Manages multiple executables.
|
||||
|
||||
Ability to set a character name which gets autoloaded during launch.
|
||||
|
||||
@@ -32,3 +22,24 @@ Embedded browser set on useful pages or links.
|
||||
Ability to set default page for each of the two browser windows.
|
||||
|
||||
Rotates screenshots from "Screenshots" folder. If no screenshots are present in the folder, downloads and rotates images from http://bloogum.net/guildwars (link to page is visible when showing images from the website).
|
||||
|
||||
# Examples/Usage
|
||||
To modify any settings, press the settings button on the titlebar
|
||||

|
||||
|
||||
To adjust functionality, choose one of the settings categories
|
||||

|
||||
|
||||
When in the main view, the browsers open the default/prefferred page. To change the prefferred page, navigate to it using one of the browsers and press the star button. The current loaded page will become the default for the selected browser. Preffered page can also be selected from settings.
|
||||

|
||||
|
||||
To display other images than the ones retrieved from "http://bloogum.net/guildwars", place images in the Screenshots folder, next to the Daybreak.exe executable. If the folder doesn't exist yet, either create it or run the launcher once so that it gets created automatically.
|
||||
|
||||
To adjust accounts, go into account settings. Clicking on the star next to an account sets it as the current account.
|
||||

|
||||
|
||||
To adjust executables, go into Guildwars settings. Clicking on the star next to the executable path sets it as the current executable.
|
||||

|
||||
|
||||
To enable multiboxing (multi-launch), go into Experimental settings. Then, switch between executables/accounts and launch them.
|
||||

|
||||
|
||||
Reference in New Issue
Block a user