fixes + improved crash handler
This commit is contained in:
parent
f623fd79f2
commit
e1351cc756
10 changed files with 129 additions and 19 deletions
|
@ -2,6 +2,7 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Windows.Media;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Nocksoft.IO.ConfigFiles;
|
using Nocksoft.IO.ConfigFiles;
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
|
@ -17,6 +18,7 @@ namespace WeeXnes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App
|
public partial class App
|
||||||
{
|
{
|
||||||
|
public static bool DebugMode = false;
|
||||||
private void SetExceptionHandler()
|
private void SetExceptionHandler()
|
||||||
{
|
{
|
||||||
AppDomain currentDomain = default(AppDomain);
|
AppDomain currentDomain = default(AppDomain);
|
||||||
|
@ -30,6 +32,7 @@ namespace WeeXnes
|
||||||
{
|
{
|
||||||
writer.WriteLine(ex.ToString());
|
writer.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
|
new FluentMessageBox(ex.Message).ShowDialog();
|
||||||
}
|
}
|
||||||
private void App_OnStartup(object sender, StartupEventArgs e)
|
private void App_OnStartup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +145,7 @@ namespace WeeXnes
|
||||||
);
|
);
|
||||||
newItem.Filename = file.Name;
|
newItem.Filename = file.Name;
|
||||||
KeyManagerView.Data.KeyItemsList.Add(newItem);
|
KeyManagerView.Data.KeyItemsList.Add(newItem);
|
||||||
WeeXnes.Core.CustomConsole.WriteLine(file.Name + " loaded");
|
WeeXnes.Core.CustomConsole.WriteLineVerbose(file.Name + " loaded");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -173,9 +176,10 @@ namespace WeeXnes
|
||||||
|
|
||||||
private void CheckForDebugMode()
|
private void CheckForDebugMode()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
DebugMode = true;
|
||||||
HandleLaunchArguments.arg_enableConsole();
|
HandleLaunchArguments.arg_enableConsole();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using VanillaConsole = System.Console;
|
using VanillaConsole = System.Console;
|
||||||
|
@ -33,14 +34,11 @@ namespace WeeXnes.Core
|
||||||
ConsoleColor color,
|
ConsoleColor color,
|
||||||
ConsoleColor foregroundColor = ConsoleColor.White)
|
ConsoleColor foregroundColor = ConsoleColor.White)
|
||||||
{
|
{
|
||||||
try
|
if(!App.DebugMode)
|
||||||
{
|
return;
|
||||||
VanillaConsole.OutputEncoding = Encoding.UTF8;
|
|
||||||
}
|
VanillaConsole.OutputEncoding = Encoding.UTF8;
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
VanillaConsole.WriteLine("error setting OutputEncoding to UTF8");
|
|
||||||
}
|
|
||||||
ConsoleColor prevColor = VanillaConsole.BackgroundColor;
|
ConsoleColor prevColor = VanillaConsole.BackgroundColor;
|
||||||
ConsoleColor prevForeColor = VanillaConsole.ForegroundColor;
|
ConsoleColor prevForeColor = VanillaConsole.ForegroundColor;
|
||||||
if (Data.Colors.colored_output)
|
if (Data.Colors.colored_output)
|
||||||
|
@ -64,6 +62,13 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,VanillaConsole.BackgroundColor, ConsoleColor.White);
|
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,VanillaConsole.BackgroundColor, ConsoleColor.White);
|
||||||
}
|
}
|
||||||
|
public static void WriteLineVerbose(string text,
|
||||||
|
[CallerLineNumber] int lineNumber = 0,
|
||||||
|
[CallerMemberName] string caller = null,
|
||||||
|
[CallerFilePath] string filePath = null)
|
||||||
|
{
|
||||||
|
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + Path.GetFileName(filePath) + "|" + caller + "|" + lineNumber + ") " + text,VanillaConsole.BackgroundColor, ConsoleColor.White);
|
||||||
|
}
|
||||||
public static void WriteLine(float text,
|
public static void WriteLine(float text,
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
[CallerLineNumber] int lineNumber = 0,
|
||||||
[CallerMemberName] string caller = null)
|
[CallerMemberName] string caller = null)
|
||||||
|
|
|
@ -39,5 +39,10 @@ namespace WeeXnes.Core
|
||||||
}
|
}
|
||||||
File.WriteAllLines(filepath, stringArray, Encoding.UTF8);
|
File.WriteAllLines(filepath, stringArray, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ThrowTestException()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
public class Information
|
public class Information
|
||||||
{
|
{
|
||||||
public const string Version = "4.3.3";
|
public const string Version = "4.3.4";
|
||||||
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
||||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,16 @@
|
||||||
SelectionChanged="ListviewKeys_OnSelectionChanged">
|
SelectionChanged="ListviewKeys_OnSelectionChanged">
|
||||||
<ListView.ContextMenu>
|
<ListView.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Remove"
|
|
||||||
Name="btn_context_remove"
|
|
||||||
Click="ContextMenu_Remove"/>
|
|
||||||
<Separator />
|
|
||||||
<MenuItem Header="Export"
|
<MenuItem Header="Export"
|
||||||
Name="btn_context_export"
|
Name="btn_context_export"
|
||||||
Click="ContextMenu_Export"/>
|
Click="ContextMenu_Export"/>
|
||||||
<MenuItem Header="Import"
|
<MenuItem Header="Import"
|
||||||
Name="btn_context_import"
|
Name="btn_context_import"
|
||||||
Click="ContextMenu_Import"/>
|
Click="ContextMenu_Import"/>
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Header="Remove"
|
||||||
|
Name="btn_context_remove"
|
||||||
|
Click="ContextMenu_Remove"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListView.ContextMenu>
|
</ListView.ContextMenu>
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,25 @@
|
||||||
|
|
||||||
<TextBlock Text="(will auto close after saving)" FontSize="10" Foreground="White"
|
<TextBlock Text="(will auto close after saving)" FontSize="10" Foreground="White"
|
||||||
HorizontalAlignment="Center"/>
|
HorizontalAlignment="Center"/>
|
||||||
<ui:TextBox Name="TextboxKeyPath" PlaceholderText="Key Files Path" Margin="0,4"/>
|
<ui:TextBox Name="TextboxKeyPath" PlaceholderText="Key Files Path" Margin="0,4">
|
||||||
<ui:TextBox Name="TextboxRPCPath" PlaceholderText="Client ID" Margin="0,4"/>
|
<ui:TextBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Select Folder for Key Files"
|
||||||
|
Name="btn_context_selFolderKF"
|
||||||
|
Click="ContextMenu_SelectKfFolder"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ui:TextBox.ContextMenu>
|
||||||
|
</ui:TextBox>
|
||||||
|
<ui:TextBox Name="TextboxRPCPath" PlaceholderText="Client ID" Margin="0,4">
|
||||||
|
<ui:TextBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Select Folder for RPC Files"
|
||||||
|
Name="btn_context_selFolderRPC"
|
||||||
|
Click="ContextMenu_SelectRpcFolder"
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ui:TextBox.ContextMenu>
|
||||||
|
</ui:TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Forms;
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
||||||
|
using TextBox = System.Windows.Controls.TextBox;
|
||||||
|
|
||||||
namespace WeeXnes.Views.Settings
|
namespace WeeXnes.Views.Settings
|
||||||
{
|
{
|
||||||
|
@ -29,5 +33,29 @@ namespace WeeXnes.Views.Settings
|
||||||
Global.AppDataPathKEY.Value = TextboxKeyPath.Text;
|
Global.AppDataPathKEY.Value = TextboxKeyPath.Text;
|
||||||
Global.ForceClose();
|
Global.ForceClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ContextMenu_SelectKfFolder(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CallOpenFolderDialog(TextboxKeyPath);
|
||||||
|
}
|
||||||
|
private void ContextMenu_SelectRpcFolder(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CallOpenFolderDialog(TextboxRPCPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CallOpenFolderDialog(TextBox textBoxToChange)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
using(var fbd = new FolderBrowserDialog())
|
||||||
|
{
|
||||||
|
DialogResult result = fbd.ShowDialog();
|
||||||
|
|
||||||
|
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||||
|
{
|
||||||
|
textBoxToChange.Text = fbd.SelectedPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
33
WeeXnes/Views/Settings/FluentMessageBox.xaml
Normal file
33
WeeXnes/Views/Settings/FluentMessageBox.xaml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<ui:UiWindow x:Class="WeeXnes.Views.Settings.FluentMessageBox"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:WeeXnes.Views.Settings"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="" Height="200" Width="600"
|
||||||
|
Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
ExtendsContentIntoTitleBar="True"
|
||||||
|
WindowBackdropType="Mica"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<ui:TitleBar
|
||||||
|
Grid.Row="0"
|
||||||
|
Title="Error"
|
||||||
|
ShowHelp="False"
|
||||||
|
ShowClose="True"
|
||||||
|
ShowMinimize="False"
|
||||||
|
ShowMaximize="False"
|
||||||
|
UseSnapLayout="True">
|
||||||
|
|
||||||
|
</ui:TitleBar>
|
||||||
|
<Border Margin="0,0,0,0">
|
||||||
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
||||||
|
<Label Content="Oh no! an error has occurred" Foreground="White" HorizontalAlignment="Center" FontSize="25"/>
|
||||||
|
<Label Content="full exception log has been dumped into error__log.txt" Foreground="White" HorizontalAlignment="Center" FontSize="12"/>
|
||||||
|
<Label Content="" Name="ErrorDump" Foreground="Gray" HorizontalAlignment="Center" FontSize="12" Padding="0,15,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</ui:UiWindow>
|
14
WeeXnes/Views/Settings/FluentMessageBox.xaml.cs
Normal file
14
WeeXnes/Views/Settings/FluentMessageBox.xaml.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Windows;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace WeeXnes.Views.Settings
|
||||||
|
{
|
||||||
|
public partial class FluentMessageBox : UiWindow
|
||||||
|
{
|
||||||
|
public FluentMessageBox(string messageContent)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ErrorDump.Content = "Exception: " + messageContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Version>4.3.3</Version>
|
<Version>4.3.4</Version>
|
||||||
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>WeeXnes</RootNamespace>
|
<RootNamespace>WeeXnes</RootNamespace>
|
||||||
|
@ -98,6 +98,9 @@
|
||||||
<Compile Include="Views\Settings\ChangePathsView.xaml.cs">
|
<Compile Include="Views\Settings\ChangePathsView.xaml.cs">
|
||||||
<DependentUpon>ChangePathsView.xaml</DependentUpon>
|
<DependentUpon>ChangePathsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\Settings\FluentMessageBox.xaml.cs">
|
||||||
|
<DependentUpon>FluentMessageBox.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\Settings\SettingsView.xaml.cs">
|
<Compile Include="Views\Settings\SettingsView.xaml.cs">
|
||||||
<DependentUpon>SettingsView.xaml</DependentUpon>
|
<DependentUpon>SettingsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -127,6 +130,7 @@
|
||||||
<Page Include="Views\Home\HomeView.xaml" />
|
<Page Include="Views\Home\HomeView.xaml" />
|
||||||
<Page Include="Views\KeyManager\KeyManagerView.xaml" />
|
<Page Include="Views\KeyManager\KeyManagerView.xaml" />
|
||||||
<Page Include="Views\Settings\ChangePathsView.xaml" />
|
<Page Include="Views\Settings\ChangePathsView.xaml" />
|
||||||
|
<Page Include="Views\Settings\FluentMessageBox.xaml" />
|
||||||
<Page Include="Views\Settings\SettingsView.xaml" />
|
<Page Include="Views\Settings\SettingsView.xaml" />
|
||||||
<Page Include="Views\Settings\UpdateFoundView.xaml" />
|
<Page Include="Views\Settings\UpdateFoundView.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Add table
Reference in a new issue