[PowerRename][ImageResizer] Tier1 Win11 Context menu (#19000)

* Test win11 tier1 context menu

* Try to test signing

* Cleanup

* Cleanup project file

* Sign dll
Add PowerToys preffix
Add assets to installer

* expect.txt

* Switch to named pipes
Unregister package on uninstall
Remove unneeded files
Cleanup

* Bring back check if package registered but use per-user method

* Fix win11 check

* expect.txt

* Check if package already registered

* Revert "Check if package already registered"

FindPackages() method needs admin privileges.

This reverts commit 5af584fed4.

* Fix PowerRename args checking

* Cleanup assets

* Tier1 context menu ImageResizer
Minor cleanups
Move logic to package.h

* [WIP] Signing and installer
Expect.txt

* Localized context menu title

* Retarget everything 10.0.18362.0 -> 10.0.19041.0

* Address PR comments
 - check if selection renamable
 - minor cleanup
 - struct initialization

* Fix ImageResizerLib project configuration

* More Windows version updates

* Remove unneeded file & try fix resource build error

* Add Microsoft.PowerToys prefix to packages

* Test

* Fix convert-resx-to-rc.ps1 script issue causing resource files compile error

Don't generate empty STRINGTABLE for resx files without data

* Avoid duplicate context menu items

* [BugReportTool] Report installed context menu packages
This commit is contained in:
Stefan Markovic
2022-06-30 22:10:14 +02:00
committed by GitHub
parent a0eacca17f
commit e637902892
148 changed files with 3163 additions and 384 deletions

View File

@@ -7,6 +7,8 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions;
using System.IO.Pipes;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ImageResizer.Properties;
@@ -24,16 +26,8 @@ namespace ImageResizer.Models
public static ResizeBatch FromCommandLine(TextReader standardInput, string[] args)
{
var batch = new ResizeBatch();
// NB: We read these from stdin since there are limits on the number of args you can have
string file;
if (standardInput != null)
{
while ((file = standardInput.ReadLine()) != null)
{
batch.Files.Add(file);
}
}
const string pipeNamePrefix = "\\\\.\\pipe\\";
string pipeName = null;
for (var i = 0; i < args?.Length; i++)
{
@@ -42,10 +36,48 @@ namespace ImageResizer.Models
batch.DestinationDirectory = args[++i];
continue;
}
else if (args[i].Contains(pipeNamePrefix))
{
pipeName = args[i].Substring(pipeNamePrefix.Length);
continue;
}
batch.Files.Add(args[i]);
}
if (string.IsNullOrEmpty(pipeName))
{
// NB: We read these from stdin since there are limits on the number of args you can have
string file;
if (standardInput != null)
{
while ((file = standardInput.ReadLine()) != null)
{
batch.Files.Add(file);
}
}
}
else
{
using (NamedPipeClientStream pipeClient =
new NamedPipeClientStream(".", pipeName, PipeDirection.In))
{
// Connect to the pipe or wait until the pipe is available.
pipeClient.Connect();
using (StreamReader sr = new StreamReader(pipeClient, Encoding.Unicode))
{
string file;
// Display the read text to the console
while ((file = sr.ReadLine()) != null)
{
batch.Files.Add(file);
}
}
}
}
return batch;
}