Fix PR Comments

This commit is contained in:
Barbara Kudiess 2020-03-03 14:25:59 -08:00
parent d2faf6b7f1
commit e6d5d7cba4
20 changed files with 31 additions and 232 deletions

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View file

@ -37,7 +37,6 @@
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View file

@ -32,7 +32,6 @@
</PropertyGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
</providers>
</entityFramework>
</configuration>

View file

@ -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<string> _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;
}
};

View file

@ -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
/// <summary>
///
/// </summary>
public class FileSystemFolderSourceShallow : FileSystemProgramSource {
//private static Dictionary<string, DirectoryInfo[]> parentDirectories = new Dictionary<string, DirectoryInfo[]>();
public FileSystemFolderSourceShallow(string baseDirectory)
: base(baseDirectory) { }
public FileSystemFolderSourceShallow(ProgramSource source)
: base(source) { }
public override List<Program> LoadPrograms() {
List<Program> list = new List<Program>();
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<Program> LoadPrograms() {
List<Result> results = new List<Result>();
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!");
}
}
*/
}
}

View file

@ -39,10 +39,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Compile Remove="Programs\FileSystemFolderSourceShallow.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="AppxPackagingTlb">
<HintPath>.\AppxPackagingTlb.dll</HintPath>

View file

@ -0,0 +1,5 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Wox")]
[assembly: InternalsVisibleTo("Wox.Core")]
[assembly: InternalsVisibleTo("Wox.Test")]

View file

@ -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)

View file

@ -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

View file

@ -52,10 +52,6 @@
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Update="pinyindb\pinyin_gwoyeu_mapping.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View file

@ -4,7 +4,7 @@ namespace Wox.Plugin
{
public class PluginInitContext
{
public PluginMetadata CurrentPluginMetadata { get; set; }
public PluginMetadata CurrentPluginMetadata { get; internal set; }
/// <summary>
/// Public APIs for plugin invocation

View file

@ -24,7 +24,7 @@ namespace Wox.Plugin
public string PluginDirectory
{
get { return _pluginDirectory; }
set
internal set
{
_pluginDirectory = value;
ExecuteFilePath = Path.Combine(value, ExecuteFileName);

View file

@ -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; }

View file

@ -0,0 +1,5 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Wox")]
[assembly: InternalsVisibleTo("Wox.Core")]
[assembly: InternalsVisibleTo("Wox.Test")]

View file

@ -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.
/// </summary>
public string RawQuery { get; set; }
public string RawQuery { get; internal set; }
/// <summary>
/// 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
/// </summary>
public string Search { get; set; }
public string Search { get; internal set; }
/// <summary>
/// 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<string> ActionParameters { get; set; }
public List<string> ActionParameters { get; internal set; }
[Obsolete("Use Search instead, this method will be removed in v1.3.0")]
public string GetAllRemainingParameter() => Search;

View file

@ -55,7 +55,7 @@ namespace Wox.Plugin
/// <summary>
/// Only resulsts that originQuery match with curren query will be displayed in the panel
/// </summary>
public Query OriginQuery { get; set; }
internal Query OriginQuery { get; set; }
/// <summary>
/// Plugin directory
@ -122,6 +122,6 @@ namespace Wox.Plugin
/// <summary>
/// Plugin ID that generated this result
/// </summary>
public string PluginID { get; set; }
public string PluginID { get; internal set; }
}
}

View file

@ -58,8 +58,4 @@
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>

View file

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<configuration>
<!--https://msdn.microsoft.com/en-us/library/dd409252(v=vs.110).aspx-->
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Wox.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
<applicationSettings>
<Wox.Properties.Settings>
<setting name="GithubRepo" serializeAs="String">
<value>https://github.com/Wox-launcher/Wox</value>
</setting>
</Wox.Properties.Settings>
</applicationSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>

View file

@ -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.
/// </summary>
/// <param name="channelName">Application's IPC channel name.</param>
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
/// <param name="args">
/// Command line arguments for the second instance, passed to the first instance to take appropriate action.
/// </param>
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))