diff --git a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs index d7d789b073..643f897c41 100644 --- a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs +++ b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs @@ -167,7 +167,7 @@ namespace Wox.Infrastructure if (word.Length > 40) { - //Skip strings that are too long string for Pinyin conversion. + // Skip strings that are too long string for Pinyin conversion. return false; } diff --git a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs index ecb0c51b95..79a7ebd83f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -18,7 +18,7 @@ namespace Wox.Infrastructure.Exception return CreateExceptionReport(exception); } - //todo log /display line by line + // todo log /display line by line private static string CreateExceptionReport(System.Exception ex) { var sb = new StringBuilder(); @@ -96,12 +96,10 @@ namespace Wox.Infrastructure.Exception else if (string.IsNullOrEmpty(ass.Location)) { sb.Append("location is null or empty"); - } else { sb.Append(ass.Location); - } sb.AppendLine(")"); @@ -151,9 +149,7 @@ namespace Wox.Infrastructure.Exception else if (install == "1") result.Add(string.Format("{0} {1} {2}", versionKeyName, subKeyName, name)); } - } - } } } @@ -179,7 +175,6 @@ namespace Wox.Infrastructure.Exception { return new List(); } - } } } diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs index e52f12340e..3aca7fbee3 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs @@ -10,6 +10,7 @@ namespace Wox.Infrastructure.FileSystemHelper public class FileVersionInfoWrapper : IFileVersionInfoWrapper { public FileVersionInfoWrapper() { } + public FileVersionInfo GetVersionInfo(string path) { if (File.Exists(path)) diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs index 66c5bf13dc..2fc9a10568 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs @@ -9,6 +9,7 @@ namespace Wox.Infrastructure.FileSystemHelper public interface IFileVersionInfoWrapper { FileVersionInfo GetVersionInfo(string path); + string FileDescription { get; set; } } } diff --git a/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs b/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs index abb528ffae..ee91809cdd 100644 --- a/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs +++ b/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs @@ -12,15 +12,19 @@ namespace Wox.Infrastructure.Hotkey public class HotkeyModel { public bool Alt { get; set; } + public bool Shift { get; set; } + public bool Win { get; set; } + public bool Ctrl { get; set; } + public Key CharKey { get; set; } Dictionary specialSymbolDictionary = new Dictionary { - {Key.Space, "Space"}, - {Key.Oem3, "~"} + { Key.Space, "Space" }, + { Key.Oem3, "~" } }; public ModifierKeys ModifierKeys @@ -54,7 +58,6 @@ namespace Wox.Infrastructure.Hotkey public HotkeyModel() { - } public HotkeyModel(string hotkeyString) @@ -119,7 +122,6 @@ namespace Wox.Infrastructure.Hotkey } catch (ArgumentException) { - } } } diff --git a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs index a2981bd5c5..d765fcbf3f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs +++ b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs @@ -27,6 +27,7 @@ namespace Wox.Infrastructure.Http } public static HttpProxy Proxy { private get; set; } + public static IWebProxy WebProxy() { if (Proxy != null && Proxy.Enabled && !string.IsNullOrEmpty(Proxy.Server)) diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs index 7d229d3dca..834fda62b7 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs @@ -26,6 +26,7 @@ namespace Wox.Infrastructure.Image var i = _data[path]; return i; } + set { _data[path] = value; @@ -89,5 +90,4 @@ namespace Wox.Infrastructure.Image Usage = new ConcurrentDictionary(usage); } } - } diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs index 54f85f3951..2d04a74195 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs @@ -48,7 +48,6 @@ namespace Wox.Infrastructure.Image { return null; } - } } } diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs index 1d84caa038..d631f1a787 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs @@ -69,7 +69,7 @@ namespace Wox.Infrastructure.Image _storage.Save(ImageCache.GetUsageAsDictionary()); } - //Todo : Update it with icons specific to each theme. + // Todo : Update it with icons specific to each theme. public static void UpdateIconPath(Theme theme) { if (theme == Theme.Light || theme == Theme.HighContrastWhite) @@ -93,6 +93,7 @@ namespace Wox.Infrastructure.Image } public ImageType ImageType { get; } + public ImageSource ImageSource { get; } } @@ -138,14 +139,13 @@ namespace Wox.Infrastructure.Image { /* Directories can also have thumbnails instead of shell icons. * Generating thumbnails for a bunch of folders while scrolling through - * results from Everything makes a big impact on performance and - * Wox responsibility. + * results from Everything makes a big impact on performance and + * Wox responsibility. * - Solution: just load the icon */ type = ImageType.Folder; image = WindowsThumbnailProvider.GetThumbnail(path, Constant.ThumbnailSize, Constant.ThumbnailSize, ThumbnailOptions.IconOnly); - } else if (File.Exists(path)) { @@ -159,9 +159,9 @@ namespace Wox.Infrastructure.Image } else { - /* Although the documentation for GetImage on MSDN indicates that + /* Although the documentation for GetImage on MSDN indicates that * if a thumbnail is available it will return one, this has proved to not - * be the case in many situations while testing. + * be the case in many situations while testing. * - Solution: explicitly pass the ThumbnailOnly flag */ image = WindowsThumbnailProvider.GetThumbnail(path, Constant.ThumbnailSize, diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs index a10c759855..b2561982c9 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs @@ -50,11 +50,13 @@ namespace Wox.Infrastructure.Image out IntPtr ppv); void GetParent(out IShellItem ppsi); + void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName); + void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs); + void Compare(IShellItem psi, uint hint, out int piOrder); } -; internal enum SIGDN : uint { @@ -105,9 +107,9 @@ namespace Wox.Infrastructure.Image private int height; public int Width { set { width = value; } } + public int Height { set { height = value; } } } -; public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options) { diff --git a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs index 7f4f5c1fe5..f2cfe14f91 100644 --- a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs +++ b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs @@ -12,6 +12,7 @@ namespace Wox.Infrastructure { private static readonly Dictionary Count = new Dictionary(); private static readonly object Locker = new object(); + /// /// This stopwatch will appear only in Debug mode /// diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs index 3c8f37bb4d..833f869b50 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs @@ -37,6 +37,7 @@ namespace Wox.Infrastructure.Storage public T TryLoad(T defaultData) { _storageHelper = new StoragePowerToysVersionInfo(FilePath, BINARY_STORAGE); + // Depending on the version number of the previously installed PT Run, delete the cache if it is found to be incompatible if (_storageHelper.clearCache) { @@ -72,7 +73,7 @@ namespace Wox.Infrastructure.Storage private T Deserialize(FileStream stream, T defaultData) { - //http://stackoverflow.com/questions/2120055/binaryformatter-deserialize-gives-serializationexception + // http://stackoverflow.com/questions/2120055/binaryformatter-deserialize-gives-serializationexception AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; BinaryFormatter binaryFormatter = new BinaryFormatter { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs index 8cf72f906e..86c3cdf853 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs @@ -11,15 +11,22 @@ namespace Wox.Infrastructure.Storage { // Events to watch out for event FileSystemEventHandler Created; + event FileSystemEventHandler Deleted; + event FileSystemEventHandler Changed; + event RenamedEventHandler Renamed; // Properties of File System watcher Collection Filters { get; set; } + bool EnableRaisingEvents { get; set; } + NotifyFilters NotifyFilter { get; set; } + string Path { get; set; } + bool IncludeSubdirectories { get; set; } } } diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs index 9bdfdec88c..3c571ed651 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs @@ -9,9 +9,13 @@ 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/ISavable.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs index 872ab0d3f5..760f1cf24c 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs @@ -5,7 +5,7 @@ namespace Wox.Infrastructure.Storage { /// - /// Save plugin settings/cache, + /// Save plugin settings/cache, /// todo should be merged into a abstract class instead of separate interface /// public interface ISavable diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs index 61ea32bd1e..08046eb2d4 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs @@ -17,10 +17,13 @@ namespace Wox.Infrastructure.Storage { private readonly JsonSerializerSettings _serializerSettings; private T _data; + // need a new directory name public const string DirectoryName = "Settings"; public const string FileSuffix = ".json"; + public string FilePath { get; set; } + public string DirectoryPath { get; set; } // This storage helper returns whether or not to delete the json storage items @@ -41,6 +44,7 @@ namespace Wox.Infrastructure.Storage public T Load() { _storageHelper = new StoragePowerToysVersionInfo(FilePath, JSON_STORAGE); + // Depending on the version number of the previously installed PT Run, delete the cache if it is found to be incompatible if (_storageHelper.clearCache) { @@ -108,6 +112,7 @@ namespace Wox.Infrastructure.Storage var backupName = $"{originName}-{timestamp}{FileSuffix}"; var backupPath = Path.Combine(directory, backupName); File.Copy(FilePath, backupPath, true); + // todo give user notification for the backup process } diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs index 291f2c6502..bde5692b41 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs @@ -13,7 +13,7 @@ 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. + /// of the data structure. Currently this is implemented as a list for it's simplicity. /// /// public class ListRepository : IRepository, IEnumerable @@ -24,12 +24,11 @@ namespace Wox.Infrastructure.Storage public ListRepository() { - } public void Set(IList items) { - //enforce that internal representation + // enforce that internal representation try { _items = new ConcurrentDictionary(items.ToDictionary(i => i.GetHashCode())); @@ -51,7 +50,6 @@ namespace Wox.Infrastructure.Storage { Log.Error($"|ListRepository.Add| Item Already Exists <{insertedItem}>"); } - } public void Remove(T removedItem) diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs index d0f6be88af..84811cbf4f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs @@ -13,6 +13,7 @@ namespace Wox.Infrastructure.Storage public bool clearCache = false; private String currentPowerToysVersion = String.Empty; + private String FilePath { get; set; } = String.Empty; // As of now this information is not pertinent but may be in the future @@ -102,6 +103,7 @@ namespace Wox.Infrastructure.Storage public StoragePowerToysVersionInfo(String AssociatedFilePath, int type) { FilePath = GetFilePath(AssociatedFilePath, type); + // Get the previous version of PowerToys and cache Storage details from the CacheDetails.json storage file String previousVersion = GetPreviousVersion(); currentPowerToysVersion = Microsoft.PowerToys.Settings.UI.Lib.Utilities.Helper.GetProductVersion(); diff --git a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs index 839ef26415..d6b6104965 100644 --- a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using static Wox.Infrastructure.StringMatcher; [assembly: InternalsVisibleToAttribute("Microsoft.Plugin.Program.UnitTests")] + namespace Wox.Infrastructure { public class StringMatcher @@ -225,7 +226,7 @@ namespace Wox.Infrastructure private static int CalculateSearchScore(string query, string stringToCompare, int firstIndex, int matchLen, bool allSubstringsContainedInCompareString) { // A match found near the beginning of a string is scored more than a match found near the end - // A match is scored more if the characters in the patterns are closer to each other, + // A match is scored more if the characters in the patterns are closer to each other, // while the score is lower if they are more spread out var score = 100 * (query.Length + 1) / ((1 + firstIndex) + (matchLen + 1)); @@ -301,6 +302,7 @@ namespace Wox.Infrastructure public int RawScore { get { return _rawScore; } + set { _rawScore = value; diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs index 375dc50d65..c7ad85b3bb 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs @@ -7,9 +7,13 @@ namespace Wox.Infrastructure.UserSettings public class HttpProxy { public bool Enabled { get; set; } = false; + public string Server { get; set; } + public int Port { get; set; } + public string UserName { get; set; } + public string Password { get; set; } } } diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs index 39239d76a5..f02353beb8 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs @@ -9,6 +9,7 @@ namespace Wox.Infrastructure.UserSettings public class CustomPluginHotkey : BaseModel { public string Hotkey { get; set; } + public string ActionKeyword { get; set; } } } diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs index a7077fd7ed..33fba61acf 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs @@ -43,7 +43,9 @@ namespace Wox.Infrastructure.UserSettings public class Plugin { public string ID { get; set; } + public string Name { get; set; } + public List ActionKeywords { get; set; } // a reference of the action keywords from plugin manager /// diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs index 289a5e3f6f..ebc36301af 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs @@ -15,6 +15,7 @@ namespace Wox.Infrastructure.UserSettings { private string _hotkey = "Alt + Space"; private string _previousHotkey = ""; + public string PreviousHotkey { get @@ -29,6 +30,7 @@ namespace Wox.Infrastructure.UserSettings { return _hotkey; } + set { if (_hotkey != value) @@ -41,14 +43,23 @@ namespace Wox.Infrastructure.UserSettings } public string Language { get; set; } = "en"; + public string Theme { get; set; } = "Dark"; + public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; + public string QueryBoxFontStyle { get; set; } + public string QueryBoxFontWeight { get; set; } + public string QueryBoxFontStretch { get; set; } + public string ResultFont { get; set; } = FontFamily.GenericSansSerif.Name; + public string ResultFontStyle { get; set; } + public string ResultFontWeight { get; set; } + public string ResultFontStretch { get; set; } /// @@ -62,6 +73,7 @@ namespace Wox.Infrastructure.UserSettings public string QuerySearchPrecisionString { get { return QuerySearchPrecision.ToString(); } + set { try @@ -87,15 +99,18 @@ namespace Wox.Infrastructure.UserSettings public bool AutoUpdates { get; set; } = false; public double WindowLeft { get; set; } + public double WindowTop { get; set; } private int _maxResultsToShow = 4; + public int MaxResultsToShow { get { return _maxResultsToShow; } + set { if (_maxResultsToShow != value) @@ -111,6 +126,7 @@ namespace Wox.Infrastructure.UserSettings // Order defaults to 0 or -1, so 1 will let this property appear last [JsonProperty(Order = 1)] public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); + public ObservableCollection CustomPluginHotkeys { get; set; } = new ObservableCollection(); [Obsolete] @@ -120,14 +136,19 @@ namespace Wox.Infrastructure.UserSettings public OpacityMode OpacityMode { get; set; } = OpacityMode.Normal; public bool DontPromptUpdateMsg { get; set; } + public bool EnableUpdateLog { get; set; } public bool StartWoxOnSystemStartup { get; set; } = true; + public bool HideOnStartup { get; set; } + bool _hideNotifyIcon { get; set; } + public bool HideNotifyIcon { get { return _hideNotifyIcon; } + set { _hideNotifyIcon = value; @@ -136,10 +157,13 @@ namespace Wox.Infrastructure.UserSettings } public bool LeaveCmdOpen { get; set; } + public bool HideWhenDeactivated { get; set; } = true; + public bool ClearInputOnLaunch { get; set; } = false; public bool RememberLastLaunchLocation { get; set; } + public bool IgnoreHotkeysOnFullscreen { get; set; } public HttpProxy Proxy { get; set; } = new HttpProxy(); diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.cs b/src/modules/launcher/Wox.Infrastructure/Wox.cs index 2a0a161f70..49d00b49bb 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.cs +++ b/src/modules/launcher/Wox.Infrastructure/Wox.cs @@ -22,6 +22,7 @@ namespace Wox.Infrastructure public static bool IsPortableMode; public const string PortableFolderName = "UserData"; public static string PortableDataPath = Path.Combine(ProgramDirectory, PortableFolderName); + public static string DetermineDataDirectory() { if (Directory.Exists(PortableDataPath))