mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-09 23:39:28 +02:00
Add more logs to plugin window
This commit is contained in:
@@ -121,6 +121,7 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
private void Window_ContentRendered(object? sender, EventArgs e)
|
private void Window_ContentRendered(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - Starting plugin thread", "Plugin");
|
||||||
pluginThread = new Thread(LoadPlugin);
|
pluginThread = new Thread(LoadPlugin);
|
||||||
pluginThread.Start();
|
pluginThread.Start();
|
||||||
}
|
}
|
||||||
@@ -162,13 +163,17 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
private void LoadPlugin()
|
private void LoadPlugin()
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - Loading plugin", "Plugin");
|
||||||
|
|
||||||
if (pluginClassInstance is null)
|
if (pluginClassInstance is null)
|
||||||
{
|
{
|
||||||
PluginFolderPath = $"{App.ApplicationDataPath}\\Plugins\\{PluginName}";
|
PluginFolderPath = $"{App.ApplicationDataPath}\\Plugins\\{PluginName}";
|
||||||
|
|
||||||
if (!File.Exists($"{PluginFolderPath}\\{PluginName}.dll"))
|
if (!File.Exists($"{PluginFolderPath}\\{PluginName}.dll"))
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - File does not exist", "Plugin", LogSeverity.Error);
|
||||||
_ = MessageBox.Show("File does not exist!", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show("File does not exist!", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -199,7 +204,9 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
if (instanceType is null)
|
if (instanceType is null)
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", "Plugin", LogSeverity.Error);
|
||||||
_ = MessageBox.Show($"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show($"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -213,6 +220,7 @@ public partial class PluginWindow : Window
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", "Plugin", LogSeverity.Error);
|
||||||
_ = MessageBox.Show($"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
_ = MessageBox.Show($"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginName}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
@@ -238,6 +246,8 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
private void LoadOptions(object instance)
|
private void LoadOptions(object instance)
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - Loading plugin options", "Plugin");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#pragma warning disable S3011 // Reflection should not be used to increase accessibility of classes, methods, or fields
|
#pragma warning disable S3011 // Reflection should not be used to increase accessibility of classes, methods, or fields
|
||||||
@@ -325,6 +335,7 @@ public partial class PluginWindow : Window
|
|||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
{
|
{
|
||||||
|
App.Logger.Log($"\"{PluginName}\" - Stopping plugin", "Plugin");
|
||||||
pluginClassInstance?.Stop();
|
pluginClassInstance?.Stop();
|
||||||
IsRunning = false;
|
IsRunning = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user