diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..9e62ee1
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,13 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: linycv
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
\ No newline at end of file
diff --git a/.github/workflows/chocolately.yml b/.github/workflows/chocolately.yml
deleted file mode 100644
index e455daf..0000000
--- a/.github/workflows/chocolately.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-name: sync to chocolately
-
-on:
- release:
- types: [published]
-
- workflow_dispatch:
-
-jobs:
- build:
- runs-on: windows-latest
-
- steps:
- - uses: actions/checkout@v3
- with:
- ref: chocolatey
-
- - name: Config and Push
- run: |
- rm .git -Recurse -Force -Confirm:$false
- $response=curl.exe -s https://api.github.com/repos/lin-ycv/everythingpowertoys/releases/latest
- $browser=($response | select-string "browser_").Line
- if($browser.Count -gt 1){ $browser=$browser[$browser.Count-1] }
- $url=$browser.Split("`"")[3]
- $ver=($response | select-string '"name":').Line[0].Split("`"")[3].Split(" ")[0].substring(1)
- Invoke-WebRequest $url -O e.zip
- $sum=(Get-FileHash e.zip -Algorithm SHA256).Hash
- rm e.zip
- echo $ver $url $sum
- Get-ChildItem *.* -Recurse | ForEach { (Get-Content $_) | ForEach {$_ -Replace '_VERSION_', $ver} | ForEach {$_ -Replace '_URL_', $url} | ForEach {$_ -Replace '_CRC_', $sum} | Set-Content $_ }
- if([System.IO.File]::Exists("$PWD\1")) { rm 1 }
- choco pack
- ls
- choco apikey --key ${{ secrets.CHOCOLATEY }} --source https://push.chocolatey.org/
- choco push everythingpowertoys.$ver.nupkg --source https://push.chocolatey.org/
diff --git a/.github/workflows/packageManagers.yml b/.github/workflows/packageManagers.yml
new file mode 100644
index 0000000..53a6aa7
--- /dev/null
+++ b/.github/workflows/packageManagers.yml
@@ -0,0 +1,50 @@
+name: sync to choco and winget
+
+on:
+ release:
+ types: [published]
+
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: chocolatey
+
+ - name: Config and Push
+ run: |
+ rm .git -Recurse -Force -Confirm:$false
+ $response=curl.exe -s https://api.github.com/repos/lin-ycv/everythingpowertoys/releases/latest
+
+ $ver = ($response | select-string '"tag_name":').Line.split("`"")[3].Trim('v')
+
+ $zip = ($browser | Where-Object { $_ -like "*.zip`"" } | Select-Object -Last 1).Split("`"")[3]
+ $exe = ($browser | Where-Object { $_ -like "*.exe`"" } | Select-Object -Last 1).Split("`"")[3]
+
+ $pattern = '(?s)(?<=).*?(?=)'
+ $hash = (($response | select-string '"body"').Line | Select-String -Pattern $pattern | ForEach-Object { $_.Matches.Value.Trim() }).Split("\r\n")
+ $ziphash = ($hash | select-string "ZIP").Line.Split('|')[1]
+ $exehash = ($hash | select-string "EXE").Line.Split('|')[1]
+
+ # chocolatey
+ echo $ver $zip $ziphash
+ Get-ChildItem *.* -Recurse | ForEach { (Get-Content $_) | ForEach {$_ -Replace '_VERSION_', $ver} | ForEach {$_ -Replace '_URL_', $zip} | ForEach {$_ -Replace '_CRC_', $ziphash} | Set-Content $_ }
+ if([System.IO.File]::Exists("$PWD\1")) { rm 1 }
+ choco pack
+ ls
+ choco apikey --key ${{ secrets.CHOCOLATEY }} --source https://push.chocolatey.org/
+ choco push everythingpowertoys.$ver.nupkg --source https://push.chocolatey.org/
+
+ # winget
+ $wingetPackage = "lin-ycv.EverythingPowerToys"
+ echo $wingetPackage $ver $exe $exehash
+ # rm -Path .\* -Recurse -Force
+ Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
+ git clone -b winget https://github.com/lin-ycv/EverythingPowerToys.git --depth 1
+ rm .git -Recurse -Force -Confirm:$false
+ Get-ChildItem *.* -Recurse | ForEach { (Get-Content $_) | ForEach {$_ -Replace '_VERSION_', $ver} | ForEach {$_ -Replace '_URL_', $exe} | ForEach {$_ -Replace '_CRC_', $exehash} | Set-Content $_ }
+ .\wingetcreate submit -p "New version: lin-ycv.EverythingPowerToys version $ver" -t ${{ secrets.GITTOKEN }} .\lin-ycv.EverythingPowerToys.yaml
\ No newline at end of file
diff --git a/Everything.cs b/Everything.cs
index 278e999..a08de7a 100644
--- a/Everything.cs
+++ b/Everything.cs
@@ -41,7 +41,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (orgqry.Contains(':'))
{
- fStringBuilder sb = new();
+ StringBuilder sb = new();
foreach (var kv in setting.Filters)
{
if (query.Contains(kv.Key, StringComparison.OrdinalIgnoreCase))
diff --git a/Main.cs b/Main.cs
index 855f50d..45d8a3f 100644
--- a/Main.cs
+++ b/Main.cs
@@ -1,19 +1,13 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Reflection;
-using System.Text.Json;
using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Controls;
using Community.PowerToys.Run.Plugin.Everything.Properties;
-using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library;
-using Wox.Infrastructure;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
-using Wox.Plugin.Common;
using Wox.Plugin.Logger;
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
@@ -116,7 +110,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
_setting = _storage.Load();
_setting.Getfilters();
if (_setting.Updates)
- Task.Run(() => new Update(Assembly.GetExecutingAssembly().GetName().Version, _setting));
+ Task.Run(() => new Update().UpdateAsync(Assembly.GetExecutingAssembly().GetName().Version, _setting));
_everything = new Everything(_setting);
}
@@ -137,7 +131,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
_everything.UpdateSettings(_setting);
- if (_contextMenuLoader != null) _contextMenuLoader.Update(_setting);
+ _contextMenuLoader?.Update(_setting);
Save();
}
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 58e8f86..0f1f736 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -349,6 +349,19 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to New version available for EverythingPowerToys.
+ ///Clicking 'No' will disable future notice for this version.
+ ///
+ ///Installed: {0}
+ ///Latest: {1}.
+ ///
+ public static string UpdateAvailable {
+ get {
+ return ResourceManager.GetString("UpdateAvailable", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Check for updates.
///
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 801c83a..35256ac 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -214,6 +214,13 @@
Set Ctrl+C to copy file/folder, Ctrl+Alt+C to copy path.
+
+ New version available for EverythingPowerToys.
+Clicking 'No' will disable future notice for this version.
+
+Installed: {0}
+Latest: {1}
+
Check for updates
diff --git a/Properties/Resources.zh.resx b/Properties/Resources.zh.resx
index 14c363e..407d6ec 100644
--- a/Properties/Resources.zh.resx
+++ b/Properties/Resources.zh.resx
@@ -184,4 +184,11 @@
啟用時檢查是否有更新
+
+ EverythingPowerToys有新版可以安裝
+按 '否' 不再通知這版的更新
+
+安裝版本:{0}
+最新版本:{1}
+
\ No newline at end of file
diff --git a/README.md b/README.md
index bcc42bd..7b13e0c 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Everything for PowerToys Run
[![GitHub repo size](https://img.shields.io/github/repo-size/lin-ycv/everythingpowertoys)](#)
-[![GitHub release (release name instead of tag name)](https://img.shields.io/github/v/release/lin-ycv/everythingpowertoys?include_prereleases)](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
+[![GitHub release (release name instead of tag name)](https://img.shields.io/github/v/release/lin-ycv/everythingpowertoys)](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
[![Chocolatey Version](https://img.shields.io/chocolatey/v/everythingpowertoys)](https://community.chocolatey.org/packages/everythingpowertoys)
[![GitHub all releases](https://img.shields.io/github/downloads/lin-ycv/EverythingPowerToys/total)](https://github.com/lin-ycv/EverythingPowerToys/releases/)
[![GitHub release (latest by date)](https://img.shields.io/github/downloads/lin-ycv/everythingpowertoys/latest/total)](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
@@ -10,15 +10,18 @@ This repo is to be used with the [PowerToys repo](https://github.com/microsoft/P
Dev instructions are in the wiki.
#### Install instructions
-1. Download the latest release from [here](https://github.com/lin-ycv/EverythingPowerToys/releases/latest).
-2. Unzip.
-3. Copy the `Everything` folder to `%LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins`.
-4. Restart PowerToys.
+There are now 4 different methods of installation, chose the one you prefer:
+1) WinGet (Recommended) : `winget install lin-ycv.EverythingPowerToys`
+2) Chocolatey : `choco install everythingpowertoys`
+3) Self-Extraction Installer (EXE) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
+4) Manual Installation (ZIP) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
+
+Detailed explanations and instructions are on the [release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
#### Requirements
* [PowerToys](https://learn.microsoft.com/en-us/windows/powertoys/)
* [Everything](https://www.voidtools.com/) (non-lite version) needs to be installed separately and **running**.
- * *if you are on 1.5 alpha, you need to [Disable 1.5a Instance](http://www.voidtools.com/forum/viewtopic.php?f=12&t=9799#instance)*
+ * *if you are on 1.5 alpha, you need to [Disable alpha Instance](https://github.com/lin-ycv/EverythingPowerToys/issues/74#issuecomment-1892511067)*
-[![Stargazers over time](https://starchart.cc/lin-ycv/EverythingPowerToys.svg)](https://starchart.cc/lin-ycv/EverythingPowerToys)
+[![Stargazers over time](https://starchart.cc/lin-ycv/EverythingPowerToys.svg?variant=adaptive&axis=%23797979)](https://starchart.cc/lin-ycv/EverythingPowerToys)
diff --git a/Update.cs b/Update.cs
index af3648f..96cfc5e 100644
--- a/Update.cs
+++ b/Update.cs
@@ -1,36 +1,67 @@
using System;
using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading.Tasks;
using System.Windows;
-using System.Xml;
-using Microsoft.Win32;
-using Wox.Infrastructure.Storage;
+using Community.PowerToys.Run.Plugin.Everything.Properties;
namespace Community.PowerToys.Run.Plugin.Everything
{
internal sealed class Update
{
- internal Update(Version v, Settings s)
+ internal async Task UpdateAsync(Version v, Settings s)
{
+ string apiUrl = "https://api.github.com/repos/lin-ycv/EverythingPowerToys/releases/latest";
try
{
- XmlDocument doc = new XmlDocument();
- doc.Load("https://img.shields.io/github/v/release/lin-ycv/everythingpowertoys");
- Version latest = Version.Parse(doc.GetElementsByTagName("title")[0].InnerXml.Split(':', StringSplitOptions.TrimEntries)[1].AsSpan(1));
- if (latest > v && latest.ToString() != s.Skip)
+ using HttpClient httpClient = new();
+ httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0");
+
+ HttpResponseMessage response = await httpClient.GetAsync(apiUrl);
+ if (response.IsSuccessStatusCode)
{
- MessageBoxResult mbox = MessageBox.Show($"New version available for EverythingPowerToys.\nClicking 'No' will disable future notice for this version.\n\nInstalled:\t {v}\nLatest:\t {latest}", "Download Update?", MessageBoxButton.YesNoCancel);
- if (mbox == MessageBoxResult.Yes)
+ using JsonDocument jsonDocument = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
+ JsonElement root = jsonDocument.RootElement;
+ Version latest = Version.TryParse(root.GetProperty("tag_name").GetString().AsSpan(1), out var vNumber)
+ ? vNumber
+ : Version.Parse(root.GetProperty("tag_name").GetString());
+ if (latest > v && latest.ToString() != s.Skip)
{
- ProcessStartInfo p = new ProcessStartInfo("https://github.com/lin-ycv/EverythingPowerToys/releases/latest")
+ MessageBoxResult mbox = MessageBox.Show(string.Format(CultureInfo.InvariantCulture, Resources.UpdateAvailable, v, latest), "Updater", MessageBoxButton.YesNoCancel);
+ if (mbox == MessageBoxResult.Yes && root.TryGetProperty("assets", out JsonElement assets))
{
- UseShellExecute = true,
- Verb = "Open",
- };
- Process.Start(p);
- }
- else if (mbox == MessageBoxResult.No)
- {
- s.Skip = latest.ToString();
+ string[] nameUrl = [string.Empty, string.Empty];
+ foreach (JsonElement asset in assets.EnumerateArray())
+ {
+ if (asset.TryGetProperty("browser_download_url", out JsonElement downUrl) && downUrl.ToString().EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
+ {
+ nameUrl[0] = asset.GetProperty("name").ToString();
+ nameUrl[1] = downUrl.ToString();
+ }
+ }
+
+ byte[] fileContent = await httpClient.GetByteArrayAsync(nameUrl[1]);
+ string fileName = Path.Combine(Path.GetTempPath(), nameUrl[0]);
+ File.WriteAllBytes(fileName, fileContent);
+ using Process updater = Process.Start(fileName);
+ updater.WaitForExit();
+ if (updater.ExitCode == 1)
+ {
+ ProcessStartInfo p = new("https://github.com/lin-ycv/EverythingPowerToys/releases/latest")
+ {
+ UseShellExecute = true,
+ Verb = "Open",
+ };
+ Process.Start(p);
+ }
+ }
+ else if (mbox == MessageBoxResult.No)
+ {
+ s.Skip = latest.ToString();
+ }
}
}
}