fully implemented user debug flag for trouble shooting
This commit is contained in:
parent
30099b56d2
commit
d5f6e160da
17 changed files with 48 additions and 52 deletions
|
@ -41,6 +41,7 @@ namespace WeeXnes
|
|||
private void App_OnStartup(object sender, StartupEventArgs e)
|
||||
{
|
||||
Environment.CurrentDirectory = Application.StartupPath;
|
||||
Console.Data.Colors.colored_output = false;
|
||||
SetExceptionHandler();
|
||||
CheckForDebugMode();
|
||||
CheckUpdatedFiles();
|
||||
|
@ -66,7 +67,7 @@ namespace WeeXnes
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.Error(ex.ToString());
|
||||
Console.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,11 +129,11 @@ namespace WeeXnes
|
|||
{
|
||||
Game newGame = Game.Methods.GameFromIni(new INIFile(file.FullName));
|
||||
DiscordRPCView.Data.Games.Add(newGame);
|
||||
WeeXnes.Core.CustomConsole.WriteLine(file.Name + " loaded -> " + newGame.ProcessName);
|
||||
Console.WriteLine(file.Name + " loaded -> " + newGame.ProcessName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.Error(file.Name + ": " + ex.Message);
|
||||
Console.Error(file.Name + ": " + ex.Message);
|
||||
new FluentMessageBox(file.Name + ": " + ex.Message).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
@ -154,12 +155,12 @@ namespace WeeXnes
|
|||
);
|
||||
newItem.Filename = file.Name;
|
||||
KeyManagerView.Data.KeyItemsList.Add(newItem);
|
||||
WeeXnes.Core.CustomConsole.WriteLine(file.Name + " loaded -> " + newItem.Name);
|
||||
Console.WriteLine(file.Name + " loaded -> " + newItem.Name);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.Error(file.Name + ": " + ex.Message);
|
||||
Console.Error(file.Name + ": " + ex.Message);
|
||||
new FluentMessageBox(file.Name + ": " + ex.Message).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
@ -187,11 +188,7 @@ namespace WeeXnes
|
|||
private void CheckForDebugMode()
|
||||
{
|
||||
#if DEBUG
|
||||
DebugMode = true;
|
||||
HandleLaunchArguments.arg_enableConsole();
|
||||
//Allow untrusted certs in Debug mode
|
||||
ServicePointManager.ServerCertificateValidationCallback +=
|
||||
(sender, cert, chain, sslPolicyErrors) => true;
|
||||
HandleLaunchArguments.arg_debugMode();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
using System;
|
||||
global using Console = WeeXnes.Core.Console;
|
||||
global using VanillaConsole = System.Console;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using VanillaConsole = System.Console;
|
||||
|
||||
|
||||
|
||||
namespace WeeXnes.Core
|
||||
{
|
||||
public class CustomConsole
|
||||
|
||||
|
||||
public static class Console
|
||||
{
|
||||
public static class Data
|
||||
{
|
||||
|
@ -28,7 +32,6 @@ namespace WeeXnes.Core
|
|||
public static string writeline_char = "•";
|
||||
}
|
||||
}
|
||||
|
||||
private static void ConfiguredWriteline(
|
||||
string text,
|
||||
ConsoleColor color,
|
||||
|
@ -36,9 +39,7 @@ namespace WeeXnes.Core
|
|||
{
|
||||
if(!App.DebugMode)
|
||||
return;
|
||||
|
||||
//VanillaConsole.OutputEncoding = Encoding.UTF8;
|
||||
|
||||
ConsoleColor prevColor = VanillaConsole.BackgroundColor;
|
||||
ConsoleColor prevForeColor = VanillaConsole.ForegroundColor;
|
||||
if (Data.Colors.colored_output)
|
||||
|
@ -62,13 +63,6 @@ namespace WeeXnes.Core
|
|||
{
|
||||
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,
|
||||
[CallerLineNumber] int lineNumber = 0,
|
||||
[CallerMemberName] string caller = null)
|
|
@ -8,7 +8,7 @@ namespace WeeXnes.Core
|
|||
{
|
||||
public class Information
|
||||
{
|
||||
public const string Version = "4.5.0";
|
||||
public const string Version = "4.5.1";
|
||||
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
|
@ -19,7 +20,11 @@ namespace WeeXnes.Core
|
|||
}
|
||||
public static void arg_debugMode()
|
||||
{
|
||||
MessageBox.Show("user debug mode enabled");
|
||||
App.DebugMode = true;
|
||||
HandleLaunchArguments.arg_enableConsole();
|
||||
//Allow untrusted certs in Debug mode
|
||||
ServicePointManager.ServerCertificateValidationCallback +=
|
||||
(sender, cert, chain, sslPolicyErrors) => true;
|
||||
}
|
||||
public static void arg_enableConsole()
|
||||
{
|
||||
|
|
|
@ -37,13 +37,13 @@ namespace WeeXnes.Core
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.WriteLine(ex.ToString());
|
||||
Console.Error(ex.ToString());
|
||||
this.ExceptionCache.Value = ex;
|
||||
}
|
||||
};
|
||||
this._loginWorker.RunWorkerCompleted += (sender, args) =>
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.WriteLine("LoginWorker complete");
|
||||
Console.WriteLine("LoginWorker complete");
|
||||
};
|
||||
this._loginUrl = loginUrl;
|
||||
this._userDataUrl = userDataUrl;
|
||||
|
@ -79,7 +79,7 @@ namespace WeeXnes.Core
|
|||
}
|
||||
else
|
||||
{
|
||||
WeeXnes.Core.CustomConsole.WriteLine("Error: " + response.StatusCode);
|
||||
Console.Error("Error: " + response.StatusCode);
|
||||
LoginView.errorStringCache.Value = response.StatusCode.ToString();
|
||||
return null;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace WeeXnes.Core
|
|||
user = user.user;
|
||||
|
||||
// Now you can access the user object properties dynamically
|
||||
WeeXnes.Core.CustomConsole.WriteLine("authenticated user: " + user.name);
|
||||
Console.WriteLine("authenticated user: " + user.name);
|
||||
//Console.WriteLine($"Email: {user.email}");
|
||||
// Access other properties as needed
|
||||
_currentUserCache.Value = user;
|
||||
|
@ -129,7 +129,7 @@ namespace WeeXnes.Core
|
|||
// Handle the error, e.g., print the status code
|
||||
_currentUserCache.Value = null;
|
||||
|
||||
WeeXnes.Core.CustomConsole.WriteLine("Error: " + response.StatusCode);
|
||||
Console.Error("Error: " + response.StatusCode);
|
||||
|
||||
LoginView.errorStringCache.Value = response.StatusCode.ToString();
|
||||
return null;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace WeeXnes.Core
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
Console.WriteLine(e.ToString());
|
||||
returnval = null;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace WeeXnes.Core
|
|||
returnval = rawcontent[2];
|
||||
}catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
Console.WriteLine(e.ToString());
|
||||
returnval = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
CloseDialog();
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ using System.Windows.Controls;
|
|||
using Microsoft.Win32;
|
||||
using Nocksoft.IO.ConfigFiles;
|
||||
using WeeXnes.Core;
|
||||
using CConsole = WeeXnes.Core.CustomConsole;
|
||||
|
||||
namespace WeeXnes.Views.DiscordRPC
|
||||
{
|
||||
|
@ -67,7 +66,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
File.Copy(filepath, dialog.FileName, true);
|
||||
CustomConsole.WriteLine("Exported to: " + dialog.FileName);
|
||||
Console.WriteLine("Exported to: " + dialog.FileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -92,11 +91,11 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
{
|
||||
File.Copy(dialog.FileName, Global.AppDataPathRPC.Value + "\\" + newGame.UUID + ".rpc", true);
|
||||
DiscordRPCView.Data.Games.Add(newGame);
|
||||
CustomConsole.WriteLine("Imported: " + dialog.FileName);
|
||||
Console.WriteLine("Imported: " + dialog.FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomConsole.Error("not imported: " + dialog.FileName);
|
||||
Console.Error("not imported: " + dialog.FileName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
|
||||
private void LogChanged()
|
||||
{
|
||||
Console.WriteLine("Log Write Data: " + Data.LogCache.Value);
|
||||
VanillaConsole.WriteLine("Log Write Data: " + Data.LogCache.Value);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
RpcLogView.Items.Add(Data.LogCache.Value);
|
||||
|
@ -58,7 +58,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
VanillaConsole.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
public void StopBackgroundWorker()
|
||||
|
@ -71,7 +71,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
VanillaConsole.WriteLine(ex.ToString());
|
||||
}
|
||||
//Stop RPC
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ namespace WeeXnes.Views.DiscordRPC
|
|||
{
|
||||
foreach (Game game in DiscordRPCView.Data.Games)
|
||||
game.Stop();
|
||||
Console.WriteLine("Thread Stopped");
|
||||
VanillaConsole.WriteLine("Thread Stopped");
|
||||
Data.LogCache.Value = new customEvent("[INFO] RPC Thread has stopped", EventType.ProcessStoppedEvent);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ using System.Net;
|
|||
using Wpf.Ui.Controls;
|
||||
using Microsoft.Win32;
|
||||
using Path = System.Windows.Shapes.Path;
|
||||
using Console = WeeXnes.Core.CustomConsole;
|
||||
|
||||
namespace WeeXnes.Views.KeyManager
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace WeeXnes.Views.KeyManager
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace WeeXnes.Views.PasswordGenerator
|
|||
CustomPasswordBuilderString += PasswordBuilderStrings.special;
|
||||
|
||||
|
||||
CustomConsole.WriteLine("Generating Password from: " + CustomPasswordBuilderString);
|
||||
Console.WriteLine("Generating Password from: " + CustomPasswordBuilderString);
|
||||
//MessageBox.Show(CustomPasswordBuilderString);
|
||||
|
||||
string generatedPassword = "";
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace WeeXnes.Views.ProfileView
|
|||
{
|
||||
CardAction button = (CardAction)sender;
|
||||
dynamic messageObj = button.Tag;
|
||||
Console.WriteLine(messageObj.ToString());
|
||||
MessageFullView.MessageToShow = messageObj;
|
||||
NavigationService.Navigate(new Uri("/Views/ProfileView/MessageFullView.xaml",UriKind.Relative));
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace WeeXnes.Views.ProfileView
|
|||
auth.ExceptionCache.ValueChanged += LoginWorkerException;
|
||||
auth._currentUserCache.ValueChanged += userCacheChanged;
|
||||
LoginView.errorStringCache.ValueChanged += errorStringChanged;
|
||||
WeeXnes.Core.CustomConsole.WriteLine("Error Hooks loaded");
|
||||
Console.WriteLine("Error Hooks loaded");
|
||||
|
||||
WeeXnes.Core.CustomConsole.WriteLine("Event hooks loaded");
|
||||
Console.WriteLine("Event hooks loaded");
|
||||
if (auth._currentUserCache.Value == null)
|
||||
{
|
||||
LoadingScreen.Visibility = Visibility.Visible;
|
||||
|
@ -83,7 +83,7 @@ namespace WeeXnes.Views.ProfileView
|
|||
auth._currentUserCache.ValueChanged -= userCacheChanged;
|
||||
LoginView.errorStringCache.ValueChanged -= errorStringChanged;
|
||||
|
||||
WeeXnes.Core.CustomConsole.WriteLine("Event hooks unloaded");
|
||||
Console.WriteLine("Event hooks unloaded");
|
||||
}
|
||||
private void errorStringChanged()
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace WeeXnes.Views.Settings
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace WeeXnes.Views.Settings
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine(ex.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Version>4.5.0</Version>
|
||||
<Version>4.5.1</Version>
|
||||
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>WeeXnes</RootNamespace>
|
||||
|
@ -15,6 +15,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
||||
<LangVersion>10</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -70,7 +71,7 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Core\CustomConsole.cs" />
|
||||
<Compile Include="Core\Console.cs" />
|
||||
<Compile Include="Core\EncryptorLibrary.cs" />
|
||||
<Compile Include="Core\HandleLaunchArguments.cs" />
|
||||
<Compile Include="Core\LoginLib.cs" />
|
||||
|
|
Loading…
Add table
Reference in a new issue