diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty`1.cs similarity index 88% rename from src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty.cs rename to src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty`1.cs index fe2bdbc838..bbdeed1cdd 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GenericProperty`1.cs @@ -1,27 +1,25 @@ -// 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.Text.Json; -using System.Text.Json.Serialization; - -namespace Microsoft.PowerToys.Settings.UI.Lib -{ -#pragma warning disable SA1649 // File name should match first type name - - public class GenericProperty - { - [JsonPropertyName("value")] - public T Value { get; set; } - - public GenericProperty(T value) - { - Value = value; - } - - // Added a parameterless constructor because of an exception during deserialization. More details here: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to#deserialization-behavior - public GenericProperty() - { - } - } -} +// 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.Text.Json; +using System.Text.Json.Serialization; + +namespace Microsoft.PowerToys.Settings.UI.Lib +{ + public class GenericProperty + { + [JsonPropertyName("value")] + public T Value { get; set; } + + public GenericProperty(T value) + { + Value = value; + } + + // Added a parameterless constructor because of an exception during deserialization. More details here: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to#deserialization-behavior + public GenericProperty() + { + } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings`1.cs similarity index 90% rename from src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs rename to src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings`1.cs index db849614ba..24e8665a04 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings`1.cs @@ -4,8 +4,6 @@ using System.Text.Json; -#pragma warning disable SA1649 // File name should match first type name - namespace Microsoft.PowerToys.Settings.UI.Lib { // Represents a powertoys module settings setnt to the runner. diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj index 99e495eed7..4249e31b1b 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj +++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj @@ -103,7 +103,7 @@ - + diff --git a/src/modules/colorPicker/ColorPickerUI/Settings/SettingItem.cs b/src/modules/colorPicker/ColorPickerUI/Settings/SettingItem`1.cs similarity index 82% rename from src/modules/colorPicker/ColorPickerUI/Settings/SettingItem.cs rename to src/modules/colorPicker/ColorPickerUI/Settings/SettingItem`1.cs index 7143a96ba4..c23d96ea62 100644 --- a/src/modules/colorPicker/ColorPickerUI/Settings/SettingItem.cs +++ b/src/modules/colorPicker/ColorPickerUI/Settings/SettingItem`1.cs @@ -6,7 +6,6 @@ using System.ComponentModel; namespace ColorPicker.Settings { - [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 : INotifyPropertyChanged { private T _value; diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs similarity index 96% rename from src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs index ddc193812d..833f869b50 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs @@ -16,7 +16,6 @@ namespace Wox.Infrastructure.Storage /// Storage object using binary data /// Normally, it has better performance, but not readable /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")] public class BinaryStorage : IStorage { // This storage helper returns whether or not to delete the binary storage items diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository`1.cs similarity index 68% rename from src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/IRepository`1.cs index 2e1f1921d8..3da126589a 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository`1.cs @@ -1,22 +1,21 @@ -// 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.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 - { - void Add(T insertedItem); - - void Remove(T removedItem); - - bool Contains(T item); - - void Set(IList list); - - bool Any(); - } -} +// 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.Storage +{ + public interface IRepository + { + void Add(T insertedItem); + + void Remove(T removedItem); + + bool Contains(T item); + + void Set(IList list); + + bool Any(); + } +} diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IStorage`1.cs similarity index 76% rename from src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/IStorage`1.cs index 82b7c84d2c..ec73368a87 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IStorage`1.cs @@ -1,23 +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. - -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 - { - /// - /// Saves the data - /// - /// data to be saved - void Save(T data); - - /// - /// Attempts to load data, otherwise it will return the default provided - /// - /// default data value - /// The loaded data or default - T TryLoad(T defaultData); - } -} +// 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.Storage +{ + public interface IStorage + { + /// + /// Saves the data + /// + /// data to be saved + void Save(T data); + + /// + /// Attempts to load data, otherwise it will return the default provided + /// + /// default data value + /// The loaded data or default + T TryLoad(T defaultData); + } +} diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs similarity index 95% rename from src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs index 1bd2552748..08046eb2d4 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs @@ -13,7 +13,6 @@ namespace Wox.Infrastructure.Storage /// /// Serialize object using json format. /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")] public class JsonStorage { private readonly JsonSerializerSettings _serializerSettings; diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs similarity index 90% rename from src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs index 7c89a89b8e..736405df1b 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs @@ -1,89 +1,88 @@ -// 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; -using System.Collections; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using Wox.Infrastructure.Logger; - -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 - /// of the data structure. Currently this is implemented as a list for it's simplicity. - /// - /// typeof - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Generic, file is named correctly")] - public class ListRepository : IRepository, IEnumerable - { - public IList Items { get { return _items.Values.ToList(); } } - - private ConcurrentDictionary _items = new ConcurrentDictionary(); - - public ListRepository() - { - } - - public void Set(IList items) - { - // enforce that internal representation - try - { - _items = new ConcurrentDictionary(items.ToDictionary(i => i.GetHashCode())); - } - catch (ArgumentException e) - { - Log.Info($"|LisRepository.Set| Trying to insert a duplicate item", e.Message); - } - } - - public bool Any() - { - return _items.Any(); - } - - public void Add(T insertedItem) - { - if (!_items.TryAdd(insertedItem.GetHashCode(), insertedItem)) - { - Log.Error($"|ListRepository.Add| Item Already Exists <{insertedItem}>"); - } - } - - public void Remove(T removedItem) - { - if (!_items.TryRemove(removedItem.GetHashCode(), out _)) - { - Log.Error($"|ListRepository.Remove| Item Not Found <{removedItem}>"); - } - } - - public ParallelQuery AsParallel() - { - return _items.Values.AsParallel(); - } - - public bool Contains(T item) - { - return _items.ContainsKey(item.GetHashCode()); - } - - public IEnumerator GetEnumerator() - { - return _items.Values.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return _items.GetEnumerator(); - } - - public int Count() - { - return _items.Count; - } - } -} +// 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; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using Wox.Infrastructure.Logger; + +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 + /// of the data structure. Currently this is implemented as a list for it's simplicity. + /// + /// typeof + public class ListRepository : IRepository, IEnumerable + { + public IList Items { get { return _items.Values.ToList(); } } + + private ConcurrentDictionary _items = new ConcurrentDictionary(); + + public ListRepository() + { + } + + public void Set(IList items) + { + // enforce that internal representation + try + { + _items = new ConcurrentDictionary(items.ToDictionary(i => i.GetHashCode())); + } + catch (ArgumentException e) + { + Log.Info($"|LisRepository.Set| Trying to insert a duplicate item", e.Message); + } + } + + public bool Any() + { + return _items.Any(); + } + + public void Add(T insertedItem) + { + if (!_items.TryAdd(insertedItem.GetHashCode(), insertedItem)) + { + Log.Error($"|ListRepository.Add| Item Already Exists <{insertedItem}>"); + } + } + + public void Remove(T removedItem) + { + if (!_items.TryRemove(removedItem.GetHashCode(), out _)) + { + Log.Error($"|ListRepository.Remove| Item Not Found <{removedItem}>"); + } + } + + public ParallelQuery AsParallel() + { + return _items.Values.AsParallel(); + } + + public bool Contains(T item) + { + return _items.ContainsKey(item.GetHashCode()); + } + + public IEnumerator GetEnumerator() + { + return _items.Values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _items.GetEnumerator(); + } + + public int Count() + { + return _items.Count; + } + } +} diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs similarity index 80% rename from src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs index 9843f9c978..6f3e259a10 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs @@ -6,7 +6,6 @@ using System.IO; 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 : JsonStorage where T : new() { public PluginJsonStorage() diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs similarity index 76% rename from src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs rename to src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs index 7c0ceb1d6f..dc8cf91a2b 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs @@ -6,7 +6,6 @@ using System.IO; 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 : JsonStorage where T : new() { public WoxJsonStorage() diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/CustomPluginHotkey.cs similarity index 100% rename from src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs rename to src/modules/launcher/Wox.Infrastructure/UserSettings/CustomPluginHotkey.cs