Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mastersign committed Mar 30, 2023
2 parents 6f9a494 + c644a6d commit a43df6d
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 24 deletions.
4 changes: 2 additions & 2 deletions BenchManager/BenchCLI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.22.4.0")]
[assembly: AssemblyFileVersion("0.22.4.0")]
[assembly: AssemblyVersion("0.22.5.0")]
[assembly: AssemblyFileVersion("0.22.5.0")]
3 changes: 3 additions & 0 deletions BenchManager/BenchDashboard/BenchDashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@
<None Include="Resources\missing_app.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\bash_16.png" />
<None Include="Resources\pwsh.ico" />
<None Include="Resources\pwsh_16.png" />
<None Include="Resources\ok.ico" />
<None Include="Resources\ok_outline_16.png" />
<None Include="Resources\update_apps_16.png" />
Expand Down
10 changes: 10 additions & 0 deletions BenchManager/BenchDashboard/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,16 @@ public string PowerShellPath
}
}

public string PowerShellCorePath
{
get
{
return Path.Combine(
Config.Apps[AppKeys.PowerShellCore].Dir,
@"pwsh.exe");
}
}

public string BashPath
{
get
Expand Down
20 changes: 17 additions & 3 deletions BenchManager/BenchDashboard/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 30 additions & 5 deletions BenchManager/BenchDashboard/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private void CoreBusyChangedHandler(object sender, EventArgs e)
private void AppStateChangedHandler(object sender, EventArgs e)
{
if (core.Busy) return;
UpdateShellButtons();
InitializeAppLauncherList();
InitializeStatusStrip();
}
Expand Down Expand Up @@ -208,11 +209,10 @@ private async void InitializeTopPanel()
UpdateShellButtons();
var cmdImg = await ExtractIcon(core.CmdPath, "CMD");
var psImg = await ExtractIcon(core.PowerShellPath, "PowerShell");
var imageResDllPath = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\System32\imageres.dll");
var bashImg = await ExtractIcon(imageResDllPath, "Bash", 95);
btnShellCmd.Image = cmdImg ?? Resources.missing_app_16;
btnShellPowerShell.Image = psImg ?? Resources.missing_app_16;
btnShellBash.Image = bashImg ?? Resources.missing_app_16;
btnShellPowerShellCore.Image = Resources.pwsh_16;
btnShellBash.Image = Resources.bash_16;
}

private static Task<Bitmap> ExtractIcon(string path, string name, int index = 0)
Expand Down Expand Up @@ -240,12 +240,15 @@ private void UpdateShellButtons()
{
btnShellCmd,
btnShellPowerShell,
btnShellPowerShellCore,
btnShellBash,
};
var buttonEnabled = new[]
{
core.Config.GetBooleanValue(ConfigPropertyKeys.QuickAccessCmd, true),
core.Config.GetBooleanValue(ConfigPropertyKeys.QuickAccessPowerShell, false),
core.Config.GetBooleanValue(ConfigPropertyKeys.QuickAccessPowerShellCore, false)
&& core.Config.Apps[AppKeys.PowerShellCore]?.IsActive == true,
core.Config.GetBooleanValue(ConfigPropertyKeys.QuickAccessBash, false),
};
var x = buttons[0].Left;
Expand Down Expand Up @@ -321,7 +324,27 @@ private void ShellPowerShellHandler(object sender, EventArgs e)
{
new SimpleExecutionHost().StartProcess(core.Env,
core.Config.GetStringValue(ConfigPropertyKeys.ProjectRootDir),
core.PowerShellPath, "", result => { }, ProcessMonitoring.ExitCode);
core.PowerShellPath, "-ExecutionPolicy RemoteSigned", result => { }, ProcessMonitoring.ExitCode);
}

private void ShellPowerShellCoreHandler(object sender, EventArgs e)
{
var pwshPath = core.PowerShellCorePath;
if (File.Exists(pwshPath))
{
new SimpleExecutionHost().StartProcess(core.Env,
core.Config.GetStringValue(ConfigPropertyKeys.ProjectRootDir),
pwshPath, "-ExecutionPolicy RemoteSigned", result => { }, ProcessMonitoring.ExitCode);
}
else
{
MessageBox.Show(
"The executable of PowerShell was not found."
+ Environment.NewLine + Environment.NewLine
+ pwshPath,
"Running PowerShell...",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

private void ShellBashHandler(object sender, EventArgs e)
Expand Down Expand Up @@ -413,8 +436,10 @@ private void KeyDownDownHandler(object sender, KeyEventArgs e)
AutoSetupHandler(this, EventArgs.Empty);
else if (e.KeyCode == Keys.C && e.Modifiers == Keys.Alt)
ShellCmdHandler(this, EventArgs.Empty);
else if (e.KeyCode == Keys.P && e.Modifiers == Keys.Alt)
else if (e.KeyCode == Keys.W && e.Modifiers == Keys.Alt)
ShellPowerShellHandler(this, EventArgs.Empty);
else if (e.KeyCode == Keys.P && e.Modifiers == Keys.Alt)
ShellPowerShellCoreHandler(this, EventArgs.Empty);
else if (e.KeyCode == Keys.B && e.Modifiers == Keys.Alt)
ShellBashHandler(this, EventArgs.Empty);
}
Expand Down
4 changes: 2 additions & 2 deletions BenchManager/BenchDashboard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.22.4.0")]
[assembly: AssemblyFileVersion("0.22.4.0")]
[assembly: AssemblyVersion("0.22.5.0")]
[assembly: AssemblyFileVersion("0.22.5.0")]
22 changes: 21 additions & 1 deletion BenchManager/BenchDashboard/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions BenchManager/BenchDashboard/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,10 @@
<data name="log_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\log_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pwsh_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pwsh_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bash_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bash_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file modified BenchManager/BenchDashboard/Resources/bash.ico
Binary file not shown.
Binary file added BenchManager/BenchDashboard/Resources/bash_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BenchManager/BenchDashboard/Resources/pwsh.ico
Binary file not shown.
Binary file added BenchManager/BenchDashboard/Resources/pwsh_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions BenchManager/BenchLib/AppKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ public static class AppKeys

/// <summary>The app ID of NuGet.</summary>
public const string NuGet = "Bench.NuGet";

/// <summary>The app ID of PowerShell</summary>
public const string PowerShellCore = "Bench.PowerShellCore";
}
}
24 changes: 18 additions & 6 deletions BenchManager/BenchLib/BenchTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1703,13 +1703,13 @@ private static void CreateBenchDashboardLauncher(BenchConfiguration config)
}

private static void CreateActionLauncher(BenchConfiguration config, string label, string binFile, string icon = null,
string targetDir = null)
string targetDir = null, string arguments = null)
{
var launcherDir = targetDir ?? config.GetStringValue(ConfigPropertyKeys.LauncherDir);
var binDir = config.GetStringValue(ConfigPropertyKeys.BenchBin);
var shortcut = Path.Combine(launcherDir, label + ".lnk");
var target = Path.Combine(binDir, binFile);
FileSystem.CreateShortcut(shortcut, target, null, config.BenchRootDir, icon ?? target);
FileSystem.CreateShortcut(shortcut, target, arguments, config.BenchRootDir, icon ?? target);
}

private static void CreateActionLaunchers(BenchConfiguration config)
Expand All @@ -1719,19 +1719,31 @@ private static void CreateActionLaunchers(BenchConfiguration config)
if (!IsDashboardSupported)
{
CreateActionLauncher(config, "Bench CLI", "bench.exe");
CreateActionLauncher(config, "Bench CLI", "bench.exe", null, config.BenchRootDir);
CreateActionLauncher(config, "Bench CLI", "bench.exe",
targetDir: config.BenchRootDir);
}
if (config.GetBooleanValue(ConfigPropertyKeys.QuickAccessCmd, true))
{
CreateActionLauncher(config, "Command Line", "bench-cmd.cmd", @"%SystemRoot%\System32\cmd.exe");
CreateActionLauncher(config, "Bench Command Line", "bench-cmd.cmd",
icon: @"%SystemRoot%\System32\cmd.exe");
}
if (config.GetBooleanValue(ConfigPropertyKeys.QuickAccessPowerShell, false))
{
CreateActionLauncher(config, "PowerShell", "bench-ps.cmd", @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe");
CreateActionLauncher(config, "Bench Windows PowerShell", "bench-ps.cmd",
icon: @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe");
}
var pwshApp = config.Apps[AppKeys.PowerShellCore];
if (config.GetBooleanValue(ConfigPropertyKeys.QuickAccessPowerShellCore, true)
&& pwshApp != null && pwshApp.IsActive)
{
CreateActionLauncher(config, "Bench PowerShell", "bench-pwsh.cmd",
icon: Path.Combine(
config.GetStringValue(ConfigPropertyKeys.AppsInstallDir), pwshApp.Dir, pwshApp.Exe));
}
if (config.GetBooleanValue(ConfigPropertyKeys.QuickAccessBash, false))
{
CreateActionLauncher(config, "Bash", "bench-bash.cmd", @"%SystemRoot%\System32\imageres.dll,95");
CreateActionLauncher(config, "Bench Bash", "bench-bash.cmd",
icon: Path.Combine(config.GetStringValue(ConfigPropertyKeys.BenchBin), "bash.ico"));
}
}

Expand Down
1 change: 1 addition & 0 deletions BenchManager/BenchLib/ConfigPropertyKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static class ConfigPropertyKeys
public const string WizzardSelectedApps = "WizzardSelectedApps";
public const string QuickAccessCmd = "QuickAccessCmd";
public const string QuickAccessPowerShell = "QuickAccessPowerShell";
public const string QuickAccessPowerShellCore = "QuickAccessPowerShellCore";
public const string QuickAccessBash = "QuickAccessBash";

public const string DashboardSetupAppListColumns = "DashboardSetupAppListColumns";
Expand Down
4 changes: 2 additions & 2 deletions BenchManager/BenchLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.22.4.0")]
[assembly: AssemblyFileVersion("0.22.4.0")]
[assembly: AssemblyVersion("0.22.5.0")]
[assembly: AssemblyFileVersion("0.22.5.0")]
2 changes: 1 addition & 1 deletion BenchManager/scripts/bench-ps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CALL "%~dp0\..\..\env.cmd"

IF "_%1_" == "__" (
ECHO.BENCH v%BENCH_VERSION% PowerShell
ECHO.BENCH v%BENCH_VERSION% Windows PowerShell
ECHO.
powershell -NoLogo -NoProfile -ExecutionPolicy Unrestricted -NoExit
GOTO:EOF
Expand Down
11 changes: 11 additions & 0 deletions BenchManager/scripts/bench-pwsh.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@ECHO OFF
CALL "%~dp0\..\..\env.cmd"

IF "_%1_" == "__" (
ECHO.BENCH v%BENCH_VERSION% PowerShell
ECHO.
pwsh -NoLogo -NoProfile -ExecutionPolicy Unrestricted -NoExit
GOTO:EOF
)

pwsh -NoLogo -NoProfile -ExecutionPolicy Unrestricted %*
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ Add a link to the GitHub diff like

[Unreleased]: https://github.com/winbench/bench/compare/master...dev

## [0.22.5] - 2023-03-30

[0.22.5]: https://github.com/winbench/bench/compare/v0.22.4...v0.22.5

### Added
* Config property `QuickAccessPowerShellCore`
* PowerShell Core button in quick access toolbar
* `bootstrap` folder with Windows PowerShell scripts for bootstrapping a Bench environment

### Changed
* New bash icon in quick access toolbar
* Hotkey for Windows PowerShell changed from Alt+P to Alt+W

## [0.22.4] - 2020-01-06

[0.22.4]: https://github.com/winbench/bench/compare/v0.22.3...v0.22.4
Expand Down
5 changes: 5 additions & 0 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ $mode = $Mode
$target = "Clean;Build"
$verbosity = $MsBuildVerbosity
$msbuildPaths = @(
"${env:ProgramFiles}\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
Expand Down Expand Up @@ -60,9 +63,11 @@ $buildArtifacts = @(
"BenchDashboard\bin\$mode\BenchDashboard.exe",
"BenchDashboard\bin\$mode\BenchDashboard.exe.config",
"BenchDashboard\bin\$mode\ConEmu.WinForms.dll",
"BenchDashboard\Resources\bash.ico",
"packages\HtmlAgilityPack.1.8.11\lib\Net45\HtmlAgilityPack.dll",
"scripts\bench-cmd.cmd",
"scripts\bench-ps.cmd",
"scripts\bench-pwsh.cmd",
"scripts\bench-bash.cmd",
"scripts\runps.cmd"
)
Expand Down
2 changes: 1 addition & 1 deletion res/bench-install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SetLocal
:: https://winbench.org/guide/setup/
::

SET VERSION=0.22.4
SET VERSION=0.22.5
SET TAG=v%VERSION%
SET ROOT=%~dp0
IF [%1] NEQ [] SET ROOT=%~dpnx1\
Expand Down
Loading

0 comments on commit a43df6d

Please sign in to comment.