stability improvements

This commit is contained in:
WeeXnes 2023-11-28 10:48:20 +01:00
parent 7570f7d442
commit 56174d8003
9 changed files with 30 additions and 12 deletions

View file

@ -42,6 +42,7 @@ namespace WeeXnes
{ {
Environment.CurrentDirectory = Application.StartupPath; Environment.CurrentDirectory = Application.StartupPath;
Console.Data.Colors.colored_output = false; Console.Data.Colors.colored_output = false;
Console.Data.Formatting.timestamp_prefix = true;
SetExceptionHandler(); SetExceptionHandler();
CheckForDebugMode(); CheckForDebugMode();
CheckUpdatedFiles(); CheckUpdatedFiles();

View file

@ -25,6 +25,7 @@ namespace WeeXnes.Core
public static class Formatting public static class Formatting
{ {
public static bool timestamp_prefix = false;
public static string success_char = "✓"; public static string success_char = "✓";
public static string warning_char = "⌬"; public static string warning_char = "⌬";
public static string info_char = "◈"; public static string info_char = "◈";
@ -47,7 +48,9 @@ namespace WeeXnes.Core
VanillaConsole.BackgroundColor = color; VanillaConsole.BackgroundColor = color;
VanillaConsole.ForegroundColor = foregroundColor; VanillaConsole.ForegroundColor = foregroundColor;
} }
DateTime currentTime = DateTime.Now;
if (Data.Formatting.timestamp_prefix)
text = currentTime.ToString("[HH:mm:ss]") + text;
VanillaConsole.WriteLine(text + " "); VanillaConsole.WriteLine(text + " ");
if (Data.Colors.colored_output) if (Data.Colors.colored_output)
{ {

View file

@ -8,7 +8,7 @@ namespace WeeXnes.Core
{ {
public class Information public class Information
{ {
public const string Version = "4.5.1.1"; public const string Version = "4.5.1.2";
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";
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Net; using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Windows; using System.Windows;
namespace WeeXnes.Core namespace WeeXnes.Core

View file

@ -41,13 +41,16 @@ namespace WeeXnes.Core
this.ExceptionCache.Value = ex; this.ExceptionCache.Value = ex;
} }
}; };
this._loginWorker.RunWorkerCompleted += (sender, args) => this._loginWorker.RunWorkerCompleted += LoginWorkerOnRunWorkerCompleted;
{
Console.WriteLine("LoginWorker complete");
};
this._loginUrl = loginUrl; this._loginUrl = loginUrl;
this._userDataUrl = userDataUrl; this._userDataUrl = userDataUrl;
} }
private void LoginWorkerOnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Console.WriteLine("LoginWorker complete");
}
public string Login(string email, string password) public string Login(string email, string password)
{ {
if (String.IsNullOrEmpty(email)) if (String.IsNullOrEmpty(email))

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Text;
using System.Windows; using System.Windows;
using WeeXnes.Core; using WeeXnes.Core;
using ButtonBase = System.Windows.Controls.Primitives.ButtonBase; using ButtonBase = System.Windows.Controls.Primitives.ButtonBase;

View file

@ -22,9 +22,9 @@ namespace WeeXnes.Views.ProfileView
auth.ExceptionCache.ValueChanged += LoginWorkerException; auth.ExceptionCache.ValueChanged += LoginWorkerException;
auth._currentUserCache.ValueChanged += userCacheChanged; auth._currentUserCache.ValueChanged += userCacheChanged;
LoginView.errorStringCache.ValueChanged += errorStringChanged; LoginView.errorStringCache.ValueChanged += errorStringChanged;
Console.WriteLine("Event hooks loaded");
Console.WriteLine("Error Hooks loaded"); Console.WriteLine("Error Hooks loaded");
Console.WriteLine("Event hooks loaded");
if (auth._currentUserCache.Value == null) if (auth._currentUserCache.Value == null)
{ {
LoadingScreen.Visibility = Visibility.Visible; LoadingScreen.Visibility = Visibility.Visible;
@ -84,6 +84,7 @@ namespace WeeXnes.Views.ProfileView
LoginView.errorStringCache.ValueChanged -= errorStringChanged; LoginView.errorStringCache.ValueChanged -= errorStringChanged;
Console.WriteLine("Event hooks unloaded"); Console.WriteLine("Event hooks unloaded");
Console.WriteLine("Error hooks unloaded");
} }
private void errorStringChanged() private void errorStringChanged()
{ {

View file

@ -55,7 +55,7 @@ namespace WeeXnes.Views.Settings
private void ButtonCheckForUpdates_OnClick(object sender, RoutedEventArgs e) private void ButtonCheckForUpdates_OnClick(object sender, RoutedEventArgs e)
{ {
Console.WriteLine("Checking for Updates...");
try try
{ {
using(WebClient webClient = new WebClient()) using(WebClient webClient = new WebClient())
@ -66,9 +66,14 @@ namespace WeeXnes.Views.Settings
GithubApiResponse apiResponseData = JsonConvert.DeserializeObject<GithubApiResponse>(downloadString); GithubApiResponse apiResponseData = JsonConvert.DeserializeObject<GithubApiResponse>(downloadString);
if (apiResponseData.tag_name != Information.Version) if (apiResponseData.tag_name != Information.Version)
{ {
Console.WriteLine("Update found");
UpdateFoundView.Data.updateResponse = apiResponseData; UpdateFoundView.Data.updateResponse = apiResponseData;
NavigationService.Navigate(new Uri("/Views/Settings/UpdateFoundView.xaml",UriKind.Relative)); NavigationService.Navigate(new Uri("/Views/Settings/UpdateFoundView.xaml",UriKind.Relative));
} }
else
{
Console.WriteLine("No Update found");
}
} }
} }
catch (Exception ex) catch (Exception ex)
@ -87,7 +92,7 @@ namespace WeeXnes.Views.Settings
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message); Console.Error(ex.Message);
} }
} }
@ -100,7 +105,7 @@ namespace WeeXnes.Views.Settings
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message); Console.Error(ex.Message);
} }
} }
@ -113,7 +118,7 @@ namespace WeeXnes.Views.Settings
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message); Console.Error(ex.Message);
} }
} }
@ -144,11 +149,13 @@ namespace WeeXnes.Views.Settings
private void dbg_throwException(object sender, RoutedEventArgs e) private void dbg_throwException(object sender, RoutedEventArgs e)
{ {
Console.Warning("Creating ArithmeticException for Debugging");
Functions.ThrowTestException(new ArithmeticException()); Functions.ThrowTestException(new ArithmeticException());
} }
private void TimedShutdown_OnClick(object sender, RoutedEventArgs e) private void TimedShutdown_OnClick(object sender, RoutedEventArgs e)
{ {
Console.WriteLine("Setting timed shutdown in " + (Convert.ToInt32(ShutdownTimer.Value)) + "mins");
System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
@ -160,6 +167,7 @@ namespace WeeXnes.Views.Settings
private void ResetShutdown_OnClick(object sender, RoutedEventArgs e) private void ResetShutdown_OnClick(object sender, RoutedEventArgs e)
{ {
Console.WriteLine("Canceling timed shutdown");
System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

View file

@ -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.5.1.1</Version> <Version>4.5.1.2</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>