mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Improved exception dialog shown at early startup failure
Plugins - Provide a better error message on built in plugin installation failure Conditions - Added better null/not null checks for strings
This commit is contained in:
1 parent
c66c21152f
commit
992657b0c5
6 files changed
+94
-11
No files matched your search
@@ -0,0 +1,13 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
internal class StringNotNullConditionOperator : ConditionOperator<string>
|
||||
{
|
||||
public override string Description => "Is not null";
|
||||
public override string Icon => "CheckboxMarkedCircleOutline";
|
||||
|
||||
public override bool Evaluate(string a)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
internal class StringNullConditionOperator : ConditionOperator<string>
|
||||
{
|
||||
public override string Description => "Is null";
|
||||
public override string Icon => "Null";
|
||||
|
||||
public override bool Evaluate(string a)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,11 +98,19 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginInfo pluginInfo;
|
||||
try
|
||||
{
|
||||
// Compare versions, copy if the same when debugging
|
||||
PluginInfo pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!;
|
||||
pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisPluginException($"Failed read plugin metadata needed to install built-in plugin: {e.Message}", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (builtInPluginInfo.Version > pluginInfo.Version)
|
||||
{
|
||||
_logger.Debug("Copying updated built-in plugin from {pluginInfo} to {builtInPluginInfo}", pluginInfo, builtInPluginInfo);
|
||||
@@ -111,7 +119,7 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisPluginException("Failed read plugin metadata needed to install built-in plugin", e);
|
||||
throw new ArtemisPluginException($"Failed to install built-in plugin: {e.Message}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ namespace Artemis.Core.Services
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringStartsWithConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringEndsWithConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringMatchesRegexConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNullConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNotNullConditionOperator());
|
||||
|
||||
// Null checks, at the bottom
|
||||
// TODO: Implement a priority mechanism
|
||||
|
||||
Reference in new issue
Block a user