mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
ReSharper: remove redundant code
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Wox.Core.Plugin
|
||||
|
||||
foreach (Type type in types)
|
||||
{
|
||||
PluginPair pair = new PluginPair()
|
||||
PluginPair pair = new PluginPair
|
||||
{
|
||||
Plugin = Activator.CreateInstance(type) as IPlugin,
|
||||
Metadata = metadata
|
||||
@@ -38,7 +38,7 @@ namespace Wox.Core.Plugin
|
||||
plugins.Add(pair);
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(new WoxPluginException(metadata.Name, $"Couldn't load plugin", e));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
@@ -41,7 +42,7 @@ namespace Wox.Core.Plugin
|
||||
foreach (JsonRPCResult result in queryResponseModel.Result)
|
||||
{
|
||||
JsonRPCResult result1 = result;
|
||||
result.Action = (c) =>
|
||||
result.Action = c =>
|
||||
{
|
||||
if (result1.JsonRPCAction == null) return false;
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
return results;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
@@ -89,7 +90,7 @@ namespace Wox.Core.Plugin
|
||||
{
|
||||
methodInfo.Invoke(PluginManager.API, parameters);
|
||||
}
|
||||
catch (System.Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
#if (DEBUG)
|
||||
{
|
||||
@@ -150,7 +151,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(System.Exception e)
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new WoxJsonRPCException(e.Message);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Wox.Core.Plugin
|
||||
T jsonRPCPlugin = new T();
|
||||
List<PluginMetadata> jsonRPCPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == jsonRPCPlugin.SupportedLanguage.ToUpper()).ToList();
|
||||
|
||||
return jsonRPCPluginMetadatas.Select(metadata => new PluginPair()
|
||||
return jsonRPCPluginMetadatas.Select(metadata => new PluginPair
|
||||
{
|
||||
Plugin = new T(), //every JsonRPC plugin should has its own plugin instance
|
||||
Metadata = metadata
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
@@ -45,7 +46,7 @@ namespace Wox.Core.Plugin
|
||||
Directory.Delete(directory, true);
|
||||
continue;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Fatal(e);
|
||||
}
|
||||
@@ -77,7 +78,7 @@ namespace Wox.Core.Plugin
|
||||
// for plugin still use old ActionKeyword
|
||||
metadata.ActionKeyword = metadata.ActionKeywords?[0];
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: json format is not valid";
|
||||
Log.Error(new WoxException(msg));
|
||||
|
||||
@@ -107,12 +107,12 @@ namespace Wox.Core.Plugin
|
||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||
metadata.PluginDirectory = pluginDirectory;
|
||||
}
|
||||
catch (System.Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
string error = $"Parse plugin config {configPath} failed: json format is not valid";
|
||||
#if (DEBUG)
|
||||
{
|
||||
throw new System.Exception(error);
|
||||
throw new Exception(error);
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
@@ -124,7 +124,7 @@ namespace Wox.Core.Plugin
|
||||
string error = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}";
|
||||
#if (DEBUG)
|
||||
{
|
||||
throw new System.Exception(error);
|
||||
throw new Exception(error);
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
@@ -134,7 +134,7 @@ namespace Wox.Core.Plugin
|
||||
string error = $"Parse plugin config {configPath} failed: ExecuteFile {metadata.ExecuteFilePath} didn't exist";
|
||||
#if (DEBUG)
|
||||
{
|
||||
throw new System.Exception(error);
|
||||
throw new Exception(error);
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace Wox.Core.Plugin
|
||||
|
||||
protected override string ExecuteQuery(Query query)
|
||||
{
|
||||
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel()
|
||||
{
|
||||
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
|
||||
{
|
||||
Method = "query",
|
||||
Parameters = new object[] { query.GetAllRemainingParameter() },
|
||||
HttpProxy = HttpProxy.Instance
|
||||
|
||||
Reference in New Issue
Block a user