Skip to content

Commit d07b304

Browse files
committed
Improve code quality
1 parent 8f7ad27 commit d07b304

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

Flow.Launcher.Core/Plugin/PluginConfig.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.IO;
@@ -9,7 +9,6 @@
99

1010
namespace Flow.Launcher.Core.Plugin
1111
{
12-
1312
internal abstract class PluginConfig
1413
{
1514
/// <summary>
@@ -112,7 +111,7 @@ private static PluginMetadata GetPluginMetadata(string pluginDirectory)
112111
metadata = JsonSerializer.Deserialize<PluginMetadata>(File.ReadAllText(configPath));
113112
metadata.PluginDirectory = pluginDirectory;
114113
// for plugins which doesn't has ActionKeywords key
115-
metadata.ActionKeywords = metadata.ActionKeywords ?? new List<string> { metadata.ActionKeyword };
114+
metadata.ActionKeywords ??= new List<string> { metadata.ActionKeyword };
116115
// for plugin still use old ActionKeyword
117116
metadata.ActionKeyword = metadata.ActionKeywords?[0];
118117
}
@@ -137,4 +136,4 @@ private static PluginMetadata GetPluginMetadata(string pluginDirectory)
137136
return metadata;
138137
}
139138
}
140-
}
139+
}

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
8181
metadata.PluginCacheDirectoryPath = Path.Combine(DataLocation.PluginCacheDirectory, assemblyName);
8282
}
8383
#if DEBUG
84-
catch (Exception e)
84+
catch (Exception)
8585
{
8686
throw;
8787
}
@@ -117,7 +117,7 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
117117

118118
if (erroredPlugins.Count > 0)
119119
{
120-
var errorPluginString = String.Join(Environment.NewLine, erroredPlugins);
120+
var errorPluginString = string.Join(Environment.NewLine, erroredPlugins);
121121

122122
var errorMessage = "The following "
123123
+ (erroredPlugins.Count > 1 ? "plugins have " : "plugin has ")

Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ public void UpdatePluginSettings(List<PluginMetadata> metadatas)
3232
{
3333
foreach (var metadata in metadatas)
3434
{
35-
if (Plugins.ContainsKey(metadata.ID))
35+
if (Plugins.TryGetValue(metadata.ID, out var settings))
3636
{
37-
var settings = Plugins[metadata.ID];
38-
3937
if (string.IsNullOrEmpty(settings.Version))
4038
settings.Version = metadata.Version;
4139

0 commit comments

Comments
 (0)