mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 05:06:36 +02:00
Incremental fix for StyleCop on Infra (#5729)
* Fixes file names and classes don't match. All but PluginsSettings * making it pluginsettings * fixing due to conflict
This commit is contained in:
@@ -6,7 +6,7 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace ColorPicker.Settings
|
namespace ColorPicker.Settings
|
||||||
{
|
{
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "It does, it is a generic. False positive")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public sealed class SettingItem<T> : INotifyPropertyChanged
|
public sealed class SettingItem<T> : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private T _value;
|
private T _value;
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ namespace Wox.Core.Plugin
|
|||||||
|
|
||||||
public static IPublicAPI API { private set; get; }
|
public static IPublicAPI API { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
// todo happlebao, this should not be public, the indicator function should be embedded
|
// todo happlebao, this should not be public, the indicator function should be embedded
|
||||||
public static PluginsSettings Settings;
|
public static PluginSettings Settings;
|
||||||
private static List<PluginMetadata> _metadatas;
|
private static List<PluginMetadata> _metadatas;
|
||||||
private static readonly string[] Directories = { Constant.PreinstalledDirectory, Constant.PluginsDirectory };
|
private static readonly string[] Directories = { Constant.PreinstalledDirectory, Constant.PluginsDirectory };
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ namespace Wox.Core.Plugin
|
|||||||
/// todo happlebao The API should be removed
|
/// todo happlebao The API should be removed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="settings"></param>
|
/// <param name="settings"></param>
|
||||||
public static void LoadPlugins(PluginsSettings settings)
|
public static void LoadPlugins(PluginSettings settings)
|
||||||
{
|
{
|
||||||
_metadatas = PluginConfig.Parse(Directories);
|
_metadatas = PluginConfig.Parse(Directories);
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
public const string PATH = "PATH";
|
public const string PATH = "PATH";
|
||||||
|
|
||||||
public static List<PluginPair> Plugins(List<PluginMetadata> metadatas, PluginsSettings settings)
|
public static List<PluginPair> Plugins(List<PluginMetadata> metadatas, PluginSettings settings)
|
||||||
{
|
{
|
||||||
var csharpPlugins = CSharpPlugins(metadatas).ToList();
|
var csharpPlugins = CSharpPlugins(metadatas).ToList();
|
||||||
var executablePlugins = ExecutablePlugins(metadatas);
|
var executablePlugins = ExecutablePlugins(metadatas);
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ using Wox.Infrastructure.UserSettings;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure
|
namespace Wox.Infrastructure
|
||||||
{
|
{
|
||||||
public interface IAlphabet
|
|
||||||
{
|
|
||||||
string Translate(string stringToTranslate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Alphabet : IAlphabet
|
public class Alphabet : IAlphabet
|
||||||
{
|
{
|
||||||
private readonly HanyuPinyinOutputFormat Format = new HanyuPinyinOutputFormat();
|
private readonly HanyuPinyinOutputFormat Format = new HanyuPinyinOutputFormat();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) Microsoft Corporation
|
// Copyright (c) Microsoft Corporation
|
||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
11
src/modules/launcher/Wox.Infrastructure/IAlphabet.cs
Normal file
11
src/modules/launcher/Wox.Infrastructure/IAlphabet.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
namespace Wox.Infrastructure
|
||||||
|
{
|
||||||
|
public interface IAlphabet
|
||||||
|
{
|
||||||
|
string Translate(string stringToTranslate);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Wox.Infrastructure.Image
|
||||||
|
{
|
||||||
|
public interface IImageHashGenerator
|
||||||
|
{
|
||||||
|
string GetHashFromImage(ImageSource image);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,11 +10,6 @@ using System.Windows.Media.Imaging;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.Image
|
namespace Wox.Infrastructure.Image
|
||||||
{
|
{
|
||||||
public interface IImageHashGenerator
|
|
||||||
{
|
|
||||||
string GetHashFromImage(ImageSource image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ImageHashGenerator : IImageHashGenerator
|
public class ImageHashGenerator : IImageHashGenerator
|
||||||
{
|
{
|
||||||
public string GetHashFromImage(ImageSource imageSource)
|
public string GetHashFromImage(ImageSource imageSource)
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace Wox.Infrastructure.Image
|
|||||||
public class WindowsThumbnailProvider
|
public class WindowsThumbnailProvider
|
||||||
{
|
{
|
||||||
// Based on https://stackoverflow.com/questions/21751747/extract-thumbnail-for-any-file-in-windows
|
// Based on https://stackoverflow.com/questions/21751747/extract-thumbnail-for-any-file-in-windows
|
||||||
|
|
||||||
private const string IShellItem2Guid = "7E9FB0D3-919F-4307-AB2E-9B1860310C93";
|
private const string IShellItem2Guid = "7E9FB0D3-919F-4307-AB2E-9B1860310C93";
|
||||||
|
|
||||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
@@ -16,6 +16,7 @@ namespace Wox.Infrastructure.Storage
|
|||||||
/// Storage object using binary data
|
/// Storage object using binary data
|
||||||
/// Normally, it has better performance, but not readable
|
/// Normally, it has better performance, but not readable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public class BinaryStorage<T> : IStorage<T>
|
public class BinaryStorage<T> : IStorage<T>
|
||||||
{
|
{
|
||||||
// This storage helper returns whether or not to delete the binary storage items
|
// This storage helper returns whether or not to delete the binary storage items
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.Storage
|
namespace Wox.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public interface IRepository<T>
|
public interface IRepository<T>
|
||||||
{
|
{
|
||||||
void Add(T insertedItem);
|
void Add(T insertedItem);
|
||||||
|
|||||||
@@ -4,18 +4,19 @@
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.Storage
|
namespace Wox.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public interface IStorage<T>
|
public interface IStorage<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the data
|
/// Saves the data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data">data to be saved</param>
|
||||||
void Save(T data);
|
void Save(T data);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to load data, otherwise it will return the default provided
|
/// Attempts to load data, otherwise it will return the default provided
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="defaultData"></param>
|
/// <param name="defaultData">default data value</param>
|
||||||
/// <returns>The loaded data or default</returns>
|
/// <returns>The loaded data or default</returns>
|
||||||
T TryLoad(T defaultData);
|
T TryLoad(T defaultData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Wox.Infrastructure.Storage
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serialize object using json format.
|
/// Serialize object using json format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public class JsonStorage<T>
|
public class JsonStorage<T>
|
||||||
{
|
{
|
||||||
private readonly JsonSerializerSettings _serializerSettings;
|
private readonly JsonSerializerSettings _serializerSettings;
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ namespace Wox.Infrastructure.Storage
|
|||||||
/// The intent of this class is to provide a basic subset of 'list' like operations, without exposing callers to the internal representation
|
/// The intent of this class is to provide a basic subset of 'list' like operations, without exposing callers to the internal representation
|
||||||
/// of the data structure. Currently this is implemented as a list for it's simplicity.
|
/// of the data structure. Currently this is implemented as a list for it's simplicity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">typeof</typeparam>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public class ListRepository<T> : IRepository<T>, IEnumerable<T>
|
public class ListRepository<T> : IRepository<T>, IEnumerable<T>
|
||||||
{
|
{
|
||||||
public IList<T> Items { get { return _items.Values.ToList(); } }
|
public IList<T> Items { get { return _items.Values.ToList(); } }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.Storage
|
namespace Wox.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public class PluginJsonStorage<T> : JsonStorage<T> where T : new()
|
public class PluginJsonStorage<T> : JsonStorage<T> where T : new()
|
||||||
{
|
{
|
||||||
public PluginJsonStorage()
|
public PluginJsonStorage()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.Storage
|
namespace Wox.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")]
|
||||||
public class WoxJsonStorage<T> : JsonStorage<T> where T : new()
|
public class WoxJsonStorage<T> : JsonStorage<T> where T : new()
|
||||||
{
|
{
|
||||||
public WoxJsonStorage()
|
public WoxJsonStorage()
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Wox.Infrastructure.UserSettings
|
||||||
|
{
|
||||||
|
public class Plugin
|
||||||
|
{
|
||||||
|
public string ID { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public List<string> ActionKeywords { get; set; } // a reference of the action keywords from plugin manager
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether used only to save the state of the plugin in settings
|
||||||
|
/// </summary>
|
||||||
|
public bool Disabled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ using Wox.Plugin;
|
|||||||
|
|
||||||
namespace Wox.Infrastructure.UserSettings
|
namespace Wox.Infrastructure.UserSettings
|
||||||
{
|
{
|
||||||
public class PluginsSettings : BaseModel
|
public class PluginSettings : BaseModel
|
||||||
{
|
{
|
||||||
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
||||||
|
|
||||||
@@ -39,18 +39,4 @@ namespace Wox.Infrastructure.UserSettings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Plugin
|
|
||||||
{
|
|
||||||
public string ID { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public List<string> ActionKeywords { get; set; } // a reference of the action keywords from plugin manager
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used only to save the state of the plugin in settings
|
|
||||||
/// </summary>
|
|
||||||
public bool Disabled { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Wox.Infrastructure.UserSettings
|
|||||||
|
|
||||||
// Order defaults to 0 or -1, so 1 will let this property appear last
|
// Order defaults to 0 or -1, so 1 will let this property appear last
|
||||||
[JsonProperty(Order = 1)]
|
[JsonProperty(Order = 1)]
|
||||||
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
public PluginSettings PluginSettings { get; set; } = new PluginSettings();
|
||||||
|
|
||||||
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
|
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user