diff --git a/Plugins/HelloWorldCSharp/App.config b/Plugins/HelloWorldCSharp/App.config deleted file mode 100644 index ecdcf8a54..000000000 --- a/Plugins/HelloWorldCSharp/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj index b98733caf..8c16ff5aa 100644 --- a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj +++ b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj @@ -37,7 +37,6 @@ - PreserveNewest diff --git a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj index 95766d08e..7b289a51c 100644 --- a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj +++ b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj @@ -32,7 +32,6 @@ - PreserveNewest diff --git a/Plugins/Wox.Plugin.BrowserBookmark/app.config b/Plugins/Wox.Plugin.BrowserBookmark/app.config deleted file mode 100644 index 09d35ec8f..000000000 --- a/Plugins/Wox.Plugin.BrowserBookmark/app.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - diff --git a/Plugins/Wox.Plugin.Folder/Main.cs b/Plugins/Wox.Plugin.Folder/Main.cs index c6c2d2254..dbed786e3 100644 --- a/Plugins/Wox.Plugin.Folder/Main.cs +++ b/Plugins/Wox.Plugin.Folder/Main.cs @@ -19,6 +19,7 @@ namespace Wox.Plugin.Folder private string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory"; + private static string _fileExplorerProgramName = "explorer"; private static List _driverNames; private PluginInitContext _context; @@ -102,7 +103,7 @@ namespace Wox.Plugin.Folder { try { - Process.Start("explorer", path); + Process.Start(_fileExplorerProgramName, path); return true; } catch (Exception ex) @@ -254,7 +255,7 @@ namespace Wox.Plugin.Folder { try { - Process.Start("explorer", filePath); + Process.Start(_fileExplorerProgramName, filePath); } catch (Exception ex) { @@ -285,7 +286,7 @@ namespace Wox.Plugin.Folder Score = 500, Action = c => { - Process.Start("explorer", search); + Process.Start(_fileExplorerProgramName, search); return true; } }; diff --git a/Plugins/Wox.Plugin.Program/Programs/FileSystemFolderSourceShallow.cs b/Plugins/Wox.Plugin.Program/Programs/FileSystemFolderSourceShallow.cs deleted file mode 100644 index fe4a5761b..000000000 --- a/Plugins/Wox.Plugin.Program/Programs/FileSystemFolderSourceShallow.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Wox.Infrastructure.Storage.UserSettings; - -namespace Wox.Plugin.SystemPlugins.Program.ProgramSources { - //TODO: Consider Removing - - /// - /// - /// - public class FileSystemFolderSourceShallow : FileSystemProgramSource { - //private static Dictionary parentDirectories = new Dictionary(); - - - public FileSystemFolderSourceShallow(string baseDirectory) - : base(baseDirectory) { } - - public FileSystemFolderSourceShallow(ProgramSource source) - : base(source) { } - - public override List LoadPrograms() { - List list = new List(); - - foreach (var Folder in Directory.GetDirectories(BaseDirectory)) { - list.Add(CreateEntry(Folder)); - } - - - foreach (string file in Directory.GetFiles(base.BaseDirectory)) { - if (Suffixes.Any(o => file.EndsWith("." + o))) { - list.Add(CreateEntry(file)); - } - } - - return list; - } - - - public override string ToString() { - return typeof(UserStartMenuProgramSource).Name; - } - - - /* - public class FolderSource : IProgramSource { - private PluginInitContext context; - public string Location { get; set; } - public int BonusPoints { get; set; } - - public FolderSource(string Location) { - this.Location = Location; - } - - public List LoadPrograms() { - List results = new List(); - - if (Directory.Exists(Location)) { - // show all child directory - if (Location.EndsWith("\\") || Location.EndsWith("/")) { - var dirInfo = new DirectoryInfo(Location); - var dirs = dirInfo.GetDirectories(); - - var parentDirKey = Location.TrimEnd('\\', '/'); - if (!parentDirectories.ContainsKey(parentDirKey)) - parentDirectories.Add(parentDirKey, dirs); - - foreach (var dir in dirs) { - if ((dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) - continue; - - var dirPath = dir.FullName; - Result result = new Result { - Title = dir.Name, - IcoPath = "Images/folder.png", - Action = (c) => { - context.ChangeQuery(dirPath); - return false; - } - }; - results.Add(result); - } - - if (results.Count == 0) { - Result result = new Result { - Title = "Open this directory", - SubTitle = "No files in this directory", - IcoPath = "Images/folder.png", - Action = (c) => { - Process.Start(Location); - return true; - } - }; - results.Add(result); - } - } - else { - Result result = new Result { - Title = "Open this directory", - SubTitle = string.Format("path: {0}", Location), - Score = 50, - IcoPath = "Images/folder.png", - Action = (c) => { - Process.Start(Location); - return true; - } - }; - results.Add(result); - } - - } - - // change to search in current directory - var parentDir = Path.GetDirectoryName(Location); - if (!string.IsNullOrEmpty(parentDir) && results.Count == 0) { - parentDir = parentDir.TrimEnd('\\', '/'); - if (parentDirectories.ContainsKey(parentDir)) { - - var dirs = parentDirectories[parentDir]; - var queryFileName = Path.GetFileName(Location).ToLower(); - var fuzzy = FuzzyMatcher.Create(queryFileName); - foreach (var dir in dirs) { - if ((dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) - continue; - - var matchResult = fuzzy.Evaluate(dir.Name); - if (!matchResult.Success) - continue; - - var dirPath = dir.FullName; - Result result = new Result { - Title = dir.Name, - IcoPath = "Images/folder.png", - Score = matchResult.Score, - Action = (c) => { - context.ChangeQuery(dirPath); - return false; - } - }; - results.Add(result); - } - } - } - - - throw new Exception("Debug this!"); - } - - } - */ - } -} diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 762b11e0e..1ec54a9c1 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -39,10 +39,6 @@ - - - - .\AppxPackagingTlb.dll diff --git a/Wox.Infrastructure/Properties/AssemblyInfo.cs b/Wox.Infrastructure/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b48a6ef58 --- /dev/null +++ b/Wox.Infrastructure/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Wox")] +[assembly: InternalsVisibleTo("Wox.Core")] +[assembly: InternalsVisibleTo("Wox.Test")] \ No newline at end of file diff --git a/Wox.Infrastructure/StringMatcher.cs b/Wox.Infrastructure/StringMatcher.cs index 2e86289cf..442c1e9dd 100644 --- a/Wox.Infrastructure/StringMatcher.cs +++ b/Wox.Infrastructure/StringMatcher.cs @@ -19,7 +19,7 @@ namespace Wox.Infrastructure _alphabet = alphabet; } - public static StringMatcher Instance { get; set; } + public static StringMatcher Instance { get; internal set; } [Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] public static int Score(string source, string target) diff --git a/Wox.Infrastructure/UserSettings/Settings.cs b/Wox.Infrastructure/UserSettings/Settings.cs index b73c5878a..7714768f0 100644 --- a/Wox.Infrastructure/UserSettings/Settings.cs +++ b/Wox.Infrastructure/UserSettings/Settings.cs @@ -28,7 +28,7 @@ namespace Wox.Infrastructure.UserSettings public bool ShouldUsePinyin { get; set; } = true; - public StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular; + internal StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular; [JsonIgnore] public string QuerySearchPrecisionString diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 539d295ff..3d87ba99f 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -52,10 +52,6 @@ - - - - PreserveNewest diff --git a/Wox.Plugin/PluginInitContext.cs b/Wox.Plugin/PluginInitContext.cs index ece2781e0..efa7d442a 100644 --- a/Wox.Plugin/PluginInitContext.cs +++ b/Wox.Plugin/PluginInitContext.cs @@ -4,7 +4,7 @@ namespace Wox.Plugin { public class PluginInitContext { - public PluginMetadata CurrentPluginMetadata { get; set; } + public PluginMetadata CurrentPluginMetadata { get; internal set; } /// /// Public APIs for plugin invocation diff --git a/Wox.Plugin/PluginMetadata.cs b/Wox.Plugin/PluginMetadata.cs index 78a036b3c..64b8b032c 100644 --- a/Wox.Plugin/PluginMetadata.cs +++ b/Wox.Plugin/PluginMetadata.cs @@ -24,7 +24,7 @@ namespace Wox.Plugin public string PluginDirectory { get { return _pluginDirectory; } - set + internal set { _pluginDirectory = value; ExecuteFilePath = Path.Combine(value, ExecuteFileName); diff --git a/Wox.Plugin/PluginPair.cs b/Wox.Plugin/PluginPair.cs index 56dcde620..f00888964 100644 --- a/Wox.Plugin/PluginPair.cs +++ b/Wox.Plugin/PluginPair.cs @@ -2,8 +2,8 @@ { public class PluginPair { - public IPlugin Plugin { get; set; } - public PluginMetadata Metadata { get; set; } + public IPlugin Plugin { get; internal set; } + public PluginMetadata Metadata { get; internal set; } diff --git a/Wox.Plugin/Properties/AssemblyInfo.cs b/Wox.Plugin/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b48a6ef58 --- /dev/null +++ b/Wox.Plugin/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Wox")] +[assembly: InternalsVisibleTo("Wox.Core")] +[assembly: InternalsVisibleTo("Wox.Test")] \ No newline at end of file diff --git a/Wox.Plugin/Query.cs b/Wox.Plugin/Query.cs index 8288c8757..e6ada021b 100644 --- a/Wox.Plugin/Query.cs +++ b/Wox.Plugin/Query.cs @@ -23,7 +23,7 @@ namespace Wox.Plugin /// Raw query, this includes action keyword if it has /// We didn't recommend use this property directly. You should always use Search property. /// - public string RawQuery { get; set; } + public string RawQuery { get; internal set; } /// /// Search part of a query. @@ -31,7 +31,7 @@ namespace Wox.Plugin /// Since we allow user to switch a exclusive plugin to generic plugin, /// so this property will always give you the "real" query part of the query /// - public string Search { get; set; } + public string Search { get; internal set; } /// /// The raw query splited into a string array. @@ -96,10 +96,10 @@ namespace Wox.Plugin public override string ToString() => RawQuery; [Obsolete("Use ActionKeyword, this property will be removed in v1.3.0")] - public string ActionName { get; set; } + public string ActionName { get; internal set; } [Obsolete("Use Search instead, this property will be removed in v1.3.0")] - public List ActionParameters { get; set; } + public List ActionParameters { get; internal set; } [Obsolete("Use Search instead, this method will be removed in v1.3.0")] public string GetAllRemainingParameter() => Search; diff --git a/Wox.Plugin/Result.cs b/Wox.Plugin/Result.cs index 981669309..6e0559d35 100644 --- a/Wox.Plugin/Result.cs +++ b/Wox.Plugin/Result.cs @@ -55,7 +55,7 @@ namespace Wox.Plugin /// /// Only resulsts that originQuery match with curren query will be displayed in the panel /// - public Query OriginQuery { get; set; } + internal Query OriginQuery { get; set; } /// /// Plugin directory @@ -122,6 +122,6 @@ namespace Wox.Plugin /// /// Plugin ID that generated this result /// - public string PluginID { get; set; } + public string PluginID { get; internal set; } } } \ No newline at end of file diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj index 6239fb00c..8c6d6f88c 100644 --- a/Wox.Plugin/Wox.Plugin.csproj +++ b/Wox.Plugin/Wox.Plugin.csproj @@ -58,8 +58,4 @@ - - - - \ No newline at end of file diff --git a/Wox/App.config b/Wox/App.config deleted file mode 100644 index 414689788..000000000 --- a/Wox/App.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -
- - - - - - - - - https://github.com/Wox-launcher/Wox - - - - diff --git a/Wox/Helper/SingleInstance.cs b/Wox/Helper/SingleInstance.cs index 3ee967d51..4b933eedf 100644 --- a/Wox/Helper/SingleInstance.cs +++ b/Wox/Helper/SingleInstance.cs @@ -9,6 +9,7 @@ using System.Runtime.Serialization.Formatters; using System.Security; using System.Text; using System.Threading; +using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; @@ -244,12 +245,12 @@ namespace Wox.Helper singleInstanceMutex = new Mutex(true, applicationIdentifier, out firstInstance); if (firstInstance) { - CreateRemoteService(channelName); + _ = CreateRemoteService(channelName); return true; } else { - SignalFirstInstance(channelName); + _ = SignalFirstInstance(channelName); return false; } } @@ -321,7 +322,7 @@ namespace Wox.Helper /// Once receives signal from client, will activate first instance. ///
/// Application's IPC channel name. - private static async void CreateRemoteService(string channelName) + private static async Task CreateRemoteService(string channelName) { using (NamedPipeServerStream pipeServer = new NamedPipeServerStream(channelName, PipeDirection.In)) { @@ -347,7 +348,7 @@ namespace Wox.Helper /// /// Command line arguments for the second instance, passed to the first instance to take appropriate action. /// - private static async void SignalFirstInstance(string channelName) + private static async Task SignalFirstInstance(string channelName) { // Create a client pipe connected to server using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", channelName, PipeDirection.Out))