Skip to content

Commit 140e2a0

Browse files
committed
Merge branch 'dev' into add_dedicated_programplugin_logger
2 parents 3cf4b4e + c89ab4e commit 140e2a0

File tree

14 files changed

+60
-33
lines changed

14 files changed

+60
-33
lines changed

Plugins/HelloWorldCSharp/plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"Language":"csharp",
99
"Website":"https://github.com/Wox-launcher/Wox",
1010
"ExecuteFileName":"HelloWorldCSharp.dll",
11-
"IcoPath":"app.png"
11+
"IcoPath":"app.png",
12+
"Disabled": true
1213
}

Plugins/Wox.Plugin.BrowserBookmark/Commands/Bookmarks.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ internal static class Bookmarks
88
{
99
internal static bool MatchProgram(Bookmark bookmark, string queryString)
1010
{
11-
if (StringMatcher.FuzzySearch(queryString, bookmark.Name, new MatchOption()).IsSearchPrecisionScoreMet()) return true;
12-
if (StringMatcher.FuzzySearch(queryString, bookmark.PinyinName, new MatchOption()).IsSearchPrecisionScoreMet()) return true;
13-
if (StringMatcher.FuzzySearch(queryString, bookmark.Url, new MatchOption()).IsSearchPrecisionScoreMet()) return true;
11+
if (StringMatcher.FuzzySearch(queryString, bookmark.Name).IsSearchPrecisionScoreMet()) return true;
12+
if (StringMatcher.FuzzySearch(queryString, bookmark.PinyinName).IsSearchPrecisionScoreMet()) return true;
13+
if (StringMatcher.FuzzySearch(queryString, bookmark.Url).IsSearchPrecisionScoreMet()) return true;
1414

1515
return false;
1616
}

Plugins/Wox.Plugin.Everything/plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"Language":"csharp",
99
"Website":"http://www.wox.one",
1010
"IcoPath":"Images\\find.png",
11-
"ExecuteFileName":"Wox.Plugin.Everything.dll"
11+
"ExecuteFileName":"Wox.Plugin.Everything.dll",
12+
"Disabled": true
1213
}

Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
3030
_settings.ProgramSuffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator);
3131
string msg = context.API.GetTranslation("wox_plugin_program_update_file_suffixes");
3232
MessageBox.Show(msg);
33+
34+
DialogResult = true;
3335
}
3436
}
3537
}

Plugins/Wox.Plugin.Program/Views/ProgramSetting.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ private void btnReindex_Click(object sender, RoutedEventArgs e)
102102

103103
private void BtnProgramSuffixes_OnClick(object sender, RoutedEventArgs e)
104104
{
105-
ProgramSuffixes p = new ProgramSuffixes(context, _settings);
106-
p.ShowDialog();
105+
var p = new ProgramSuffixes(context, _settings);
106+
if (p.ShowDialog() ?? false)
107+
{
108+
ReIndexing();
109+
}
107110
}
108111

109112
private void programSourceView_DragEnter(object sender, DragEventArgs e)

Wox.Core/Plugin/PluginManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static Query QueryInit(string text) //todo is that possible to move it in
135135
var rawQuery = string.Join(Query.TermSeperater, terms);
136136
var actionKeyword = string.Empty;
137137
var search = rawQuery;
138-
List<string> actionParameters = terms.ToList();
138+
var actionParameters = terms.ToList();
139139
if (terms.Length == 0) return null;
140140
if (NonGlobalPlugins.ContainsKey(terms[0]) &&
141141
!Settings.Plugins[NonGlobalPlugins[terms[0]].Metadata.ID].Disabled)

Wox.Infrastructure/FuzzyMatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private FuzzyMatcher(string query, MatchOption opt)
1616

1717
public static FuzzyMatcher Create(string query)
1818
{
19-
return new FuzzyMatcher(query, new MatchOption());
19+
return new FuzzyMatcher(query, StringMatcher.DefaultMatchOption);
2020
}
2121

2222
public static FuzzyMatcher Create(string query, MatchOption opt)

Wox.Infrastructure/StringMatcher.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ namespace Wox.Infrastructure
88
{
99
public static class StringMatcher
1010
{
11+
public static MatchOption DefaultMatchOption = new MatchOption();
12+
1113
public static string UserSettingSearchPrecision { get; set; }
1214

1315
[Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")]
1416
public static int Score(string source, string target)
1517
{
1618
if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target))
1719
{
18-
return FuzzySearch(target, source, new MatchOption()).Score;
20+
return FuzzySearch(target, source, DefaultMatchOption).Score;
1921
}
2022
else
2123
{
@@ -26,12 +28,12 @@ public static int Score(string source, string target)
2628
[Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")]
2729
public static bool IsMatch(string source, string target)
2830
{
29-
return FuzzySearch(target, source, new MatchOption()).Score > 0;
31+
return FuzzySearch(target, source, DefaultMatchOption).Score > 0;
3032
}
3133

3234
public static MatchResult FuzzySearch(string query, string stringToCompare)
3335
{
34-
return FuzzySearch(query, stringToCompare, new MatchOption());
36+
return FuzzySearch(query, stringToCompare, DefaultMatchOption);
3537
}
3638

3739
/// <summary>
@@ -41,7 +43,7 @@ public static MatchResult FuzzySearch(string query, string stringToCompare, Matc
4143
{
4244
if (string.IsNullOrEmpty(stringToCompare) || string.IsNullOrEmpty(query)) return new MatchResult { Success = false };
4345

44-
query.Trim();
46+
query = query.Trim();
4547

4648
var len = stringToCompare.Length;
4749
var compareString = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
@@ -98,9 +100,9 @@ private static int CalScore(string query, string stringToCompare, int firstIndex
98100
var score = 100 * (query.Length + 1) / ((1 + firstIndex) + (matchLen + 1));
99101
//a match with less characters assigning more weights
100102
if (stringToCompare.Length - query.Length < 5)
101-
score = score + 20;
103+
score += 20;
102104
else if (stringToCompare.Length - query.Length < 10)
103-
score = score + 10;
105+
score += 10;
104106

105107
return score;
106108
}
@@ -139,10 +141,10 @@ public static int ScoreForPinyin(string source, string target)
139141
{
140142
var combination = Alphabet.PinyinComination(source);
141143
var pinyinScore = combination
142-
.Select(pinyin => FuzzySearch(target, string.Join("", pinyin), new MatchOption()).Score)
144+
.Select(pinyin => FuzzySearch(target, string.Join("", pinyin)).Score)
143145
.Max();
144146
var acronymScore = combination.Select(Alphabet.Acronym)
145-
.Select(pinyin => FuzzySearch(target, pinyin, new MatchOption()).Score)
147+
.Select(pinyin => FuzzySearch(target, pinyin).Score)
146148
.Max();
147149
var score = Math.Max(pinyinScore, acronymScore);
148150
return score;
@@ -163,8 +165,9 @@ public class MatchResult
163165
{
164166
public bool Success { get; set; }
165167
public int Score { get; set; }
168+
166169
/// <summary>
167-
/// hightlight string
170+
/// highlight string
168171
/// </summary>
169172
public string Value { get; set; }
170173
}

Wox.Infrastructure/UserSettings/PluginSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void UpdatePluginSettings(List<PluginMetadata> metadatas)
2929
ID = metadata.ID,
3030
Name = metadata.Name,
3131
ActionKeywords = metadata.ActionKeywords,
32-
Disabled = false
32+
Disabled = metadata.Disabled
3333
};
3434
}
3535
}

Wox.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public bool HideNotifyIcon
6666
}
6767
}
6868
public bool LeaveCmdOpen { get; set; }
69-
public bool HideWhenDeactive { get; set; }
69+
public bool HideWhenDeactive { get; set; } = true;
7070
public bool RememberLastLaunchLocation { get; set; }
7171
public bool IgnoreHotkeysOnFullscreen { get; set; }
7272

0 commit comments

Comments
 (0)