From 6af1903d8c461a02cd94d461a756164d0a3bc888 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 15:55:02 -0700 Subject: [PATCH 01/15] Fixed #58: Multi-line commands rendering wrong --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index e0e27cd..07eb4bd 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using OutGridView.Models; using Terminal.Gui; @@ -164,6 +165,11 @@ private static string GetPaddedString(List strings, int[] colWidths, int builder.Append(' '); } + // Replace any newlines with encoded newline (`n) + // Note we can't use Environment.Newline because we don't know that the + // Command honors that. + strings[i] = strings[i].Replace("\n", "`n"); + // If the string won't fit in the column, append an ellipsis. if (strings[i].Length > colWidths[i]) { From a69373eae9534aaf1a771f372982b5ea03ecc6de Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:00:25 -0700 Subject: [PATCH 02/15] Fixed #58 - Newlines in commands render incorrectly --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 07eb4bd..19deced 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Text.RegularExpressions; using OutGridView.Models; using Terminal.Gui; From f155262ca88adaab5c49c16fd232b789d6c32abe Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:30:01 -0700 Subject: [PATCH 03/15] Added debug instructions to readme --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 073a375..5672e70 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,35 @@ Get-Process | Out-ConsoleGridView > NOTE: If you change the code and rebuild the project, you'll need to launch a > _new_ PowerShell process since the dll is already loaded and can't be unloaded. +### Debugging in Visual Studio Code + + +```powershell +PS C:\path\to\GraphicalTools> code . +``` + +Build by hitting `Ctrl-Shift-b` in VS Code. + +To debug: + +In a Powershell session in the `c:\path\to\GraphicalTools` directory, run `pwsh` (thus nesting powershell). + +Then do the folowing: + +```powershell +Import-Module .\module\Microsoft.PowerShell.ConsoleGuiTools +$pid +``` + +This will import the latest built DLL and output the process ID you'll need for debugging. Copy this ID to the clipboard. + +In VScode, set your breakpoints, etc... Then hit `F5`. In the VScode search box, paste the value printed by `$pid`. You'll see something like `pwsh.exe 18328`. Click that and the debug session will start. + +In the Powershell session run your commands; breakpoints will be hit, etc... + +When done, run `exit` to exit the nested PowerShell and run `pwsh` again. This unloads the DLL. Repeat. + + ## Contributions Welcome! We would love to incorporate community contributions into this project. If you would like to From 440833ea33563e47efbb1c2558be67fd125291ef Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:31:28 -0700 Subject: [PATCH 04/15] Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 19deced..e784836 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -167,6 +167,7 @@ private static string GetPaddedString(List strings, int[] colWidths, int // Replace any newlines with encoded newline (`n) // Note we can't use Environment.Newline because we don't know that the // Command honors that. + strings[i] = strings[i].Replace("\r\n", "`r`n"); strings[i] = strings[i].Replace("\n", "`n"); // If the string won't fit in the column, append an ellipsis. From dd2e765f705d9914aee7ad1b4e6cde2eeafcc432 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 19:45:23 -0700 Subject: [PATCH 05/15] simplified stripping of newline/linefeed --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index e784836..2692d5b 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -164,10 +164,10 @@ private static string GetPaddedString(List strings, int[] colWidths, int builder.Append(' '); } - // Replace any newlines with encoded newline (`n) + // Replace any newlines with encoded newline/linefeed (`n or `r) // Note we can't use Environment.Newline because we don't know that the // Command honors that. - strings[i] = strings[i].Replace("\r\n", "`r`n"); + strings[i] = strings[i].Replace("\r", "`r"); strings[i] = strings[i].Replace("\n", "`n"); // If the string won't fit in the column, append an ellipsis. From 806d974f682d23ee6e5e0f5b81ea7fe929e58db6 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 9 Mar 2021 09:46:07 -0700 Subject: [PATCH 06/15] Updated build deps and dealt with breaking change in api --- .../GridViewDataSource.cs | 6 ++++-- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs index f8047ce..d4a24ca 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs @@ -20,14 +20,16 @@ public GridViewDataSource(List itemList) GridViewRowList = itemList; } - public bool IsMarked(int item) => GridViewRowList[item].IsMarked; + public int Length { get; } - public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width) + public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width, int start) { container.Move(col, line); RenderUstr(driver, GridViewRowList[item].DisplayString, col, line, width); } + public bool IsMarked(int item) => GridViewRowList[item].IsMarked; + public void SetMark(int item, bool value) { GridViewRowList[item].IsMarked = value; diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 8bedf20..7da34c1 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -5,8 +5,8 @@ - - + + From 317842c779cfab9f0f2e3976b67fe934281a1fb8 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Thu, 1 Apr 2021 13:04:45 -0700 Subject: [PATCH 07/15] updated to latest terminal.gui package --- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 7da34c1..0bbd007 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -6,7 +6,7 @@ - + From 7a6965ad125d17b324c82f5e34fdfe6d246b08c4 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 27 Apr 2021 13:39:38 -0700 Subject: [PATCH 08/15] updated to Terminal.Gui 1.0.0-rc.11 --- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 0bbd007..0fd8162 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -6,7 +6,7 @@ - + From 29a0d72bf1249774fe489e64330d7704348dc87c Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Tue, 1 Dec 2020 14:17:26 -0800 Subject: [PATCH 09/15] Update NuGet.config (#130) --- NuGet.config | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/NuGet.config b/NuGet.config index 95d304d..16746d6 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,9 +1,10 @@ - + - - - - - - + + + + + + + From 7f801bdc5468c1ea6e7b17c555cb68605e95475f Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Mon, 21 Dec 2020 10:21:23 -0800 Subject: [PATCH 10/15] move to compliance repo (#128) * move to compliance repo * first attempt at release * add stages * move pool * remove pkges task * add variable group * try copying files * remove extra extract * copy to signed dir * change tsa name * move to PowerShell@2 * use new syntax * change path * idk * idk * move to publish task * try these agents * ConsoleGuiTools asset.json * try different directory * stuff * publish artifacts --- .vsts-ci/azure-pipelines-release.yml | 286 +++++++++--------- .vsts-ci/misc-analysis.yml | 17 +- .vsts-ci/templates/credscan.yml | 31 -- ...icrosoft.PowerShell.ConsoleGuiTools.csproj | 2 +- .../ModuleLayout.psd1 | 6 +- ...Microsoft.PowerShell.GraphicalTools.csproj | 2 +- .../ModuleLayout.psd1 | 6 +- .../ApplicationData.cs | 0 .../DataTable.cs | 0 .../DataTableColumn.cs | 0 .../DataTableRow.cs | 0 ...soft.PowerShell.OutGridView.Models.csproj} | 0 .../OutputModeOptions.cs | 0 .../Serializers.cs | 0 src/OutGridView.Gui/OutGridView.Gui.csproj | 2 +- 15 files changed, 158 insertions(+), 194 deletions(-) delete mode 100644 .vsts-ci/templates/credscan.yml rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/ApplicationData.cs (100%) rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/DataTable.cs (100%) rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/DataTableColumn.cs (100%) rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/DataTableRow.cs (100%) rename src/{OutGridView.Models/OutGridView.Models.csproj => Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj} (100%) rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/OutputModeOptions.cs (100%) rename src/{OutGridView.Models => Microsoft.PowerShell.OutGridView.Models}/Serializers.cs (100%) diff --git a/.vsts-ci/azure-pipelines-release.yml b/.vsts-ci/azure-pipelines-release.yml index 0e5f301..d330c5b 100644 --- a/.vsts-ci/azure-pipelines-release.yml +++ b/.vsts-ci/azure-pipelines-release.yml @@ -1,3 +1,6 @@ +# NOTE: +# We stop signing GraphicalTools now since we aren't doing anymore work on it until MAUI + name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr) variables: @@ -31,155 +34,136 @@ trigger: - /LICENSE.txt - /CODE_OF_CONDUCT.md -jobs: -- job: 'ReleaseBuild' - displayName: Release Build - pool: - vmImage: 'vs2017-win2016' - steps: - - template: templates/ci-general.yml - -- job: 'SignBuild' - displayName: Signing Build - dependsOn: 'ReleaseBuild' - pool: - name: 'Package ES CodeHub Lab E' - demands: DotNetFramework - steps: - - powershell: | - Get-ChildItem -Path env: - displayName: Capture environment - condition: succeededOrFailed() - - - task: PkgESSetupBuild@10 - displayName: 'Package ES - Setup Build' - inputs: - productName: GraphicalTools - - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - downloadType: specific - - - task: PowerShell@1 - displayName: 'Extract build zip' - inputs: - scriptType: inlineScript - inlineScript: | - Expand-Archive -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\GraphicalTools\Microsoft.PowerShell.GraphicalTools-Windows_NT.zip" -DestinationPath "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.GraphicalTools" +resources: + repositories: + - repository: ComplianceRepo + type: github + endpoint: ComplianceGHRepo + name: PowerShell/compliance + +stages: +- stage: Build + displayName: Build + jobs: + - job: 'ReleaseBuild' + displayName: Release Build + pool: + vmImage: 'windows-latest' + steps: + - template: templates/ci-general.yml + - pwsh: | + Get-ChildItem -Recurse '$(Build.SourcesDirectory)' + displayName: Capture downloaded artifacts + - publish: '$(Build.SourcesDirectory)\src\Microsoft.PowerShell.ConsoleGuiTools\obj\project.assets.json' + artifact: ConsoleGuiToolsAssetsJson + displayName: Publish ConsoleGuiTools project.assets.json + + - job: 'SignBuild' + displayName: Signing Build + dependsOn: 'ReleaseBuild' + pool: + name: 'Package ES Standard Build' + demands: DotNetFramework + variables: + - group: ESRP + steps: + - powershell: | + Get-ChildItem -Path env: + displayName: Capture environment + condition: succeededOrFailed() + + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + downloadType: specific + + - pwsh: | Expand-Archive -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\GraphicalTools\Microsoft.PowerShell.ConsoleGuiTools-Windows_NT.zip" -DestinationPath "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.ConsoleGuiTools" - - - task: PkgESCodeSign@10 - displayName: 'CodeSign tools/releaseBuild/signing.xml' - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - signConfigXml: tools/releaseBuild/signing.xml - inPathRoot: '$(Build.ArtifactStagingDirectory)' - outPathRoot: '$(Build.ArtifactStagingDirectory)\Signed' - - - task: PowerShell@1 - displayName: 'Copy signed files to unsigned folder' - inputs: - scriptType: inlineScript - inlineScript: | - $signed="$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Signed\*" - $notSigned="$env:BUILD_ARTIFACTSTAGINGDIRECTORY" - Copy-Item $signed $notSigned -Recurse -Force - - - task: PowerShell@1 - displayName: 'Create catalog file' - inputs: - scriptType: inlineScript - inlineScript: | - $signedDir = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.GraphicalTools\Microsoft.PowerShell.GraphicalTools" - New-FileCatalog -CatalogFilePath "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.GraphicalTools\Microsoft.PowerShell.GraphicalTools.cat" -Path "$signedDir" - $signedDir = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.ConsoleGuiTools\Microsoft.PowerShell.ConsoleGuiTools" - New-FileCatalog -CatalogFilePath "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.ConsoleGuiTools\Microsoft.PowerShell.ConsoleGuiTools.cat" -Path "$signedDir" - - - task: PkgESCodeSign@10 - displayName: 'CodeSign tools/releaseBuild/FileCatalogSigning.xml' - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - signConfigXml: tools/releaseBuild/FileCatalogSigning.xml - inPathRoot: '$(Build.ArtifactStagingDirectory)' - outPathRoot: '$(Build.ArtifactStagingDirectory)' - - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' - - - task: AntiMalware@3 - inputs: - InputType: 'Basic' - ScanType: 'CustomScan' - FileDirPath: '$(Build.ArtifactStagingDirectory)' - EnableServices: false - SupportLogOnError: false - TreatSignatureUpdateFailureAs: 'Warning' - SignatureFreshness: 'UpToDate' - TreatStaleSignatureAs: 'Error' - - - task: PoliCheck@1 - condition: succeededOrFailed() - inputs: - targetType: F - optionsFC: 0 - optionsXS: 0 - optionsPE: '1|2|3|4' - optionsHMENABLE: 0 - optionsFTPATH: '$(Build.SourcesDirectory)\tools\terms\FileTypeSet.xml' - # toolVersion: 5.8.2.1 - - - task: CredScan@2 - condition: succeededOrFailed() - - - task: BinSkim@3 - condition: succeededOrFailed() - inputs: - InputType: 'Basic' - Function: 'analyze' - AnalyzeRecurse: true - AnalyzeTarget: '$(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.*Tools.dll;$(Build.ArtifactStagingDirectory)\OutGridView*.dll' - - # Publish results as artifacts - - task: PublishSecurityAnalysisLogs@3 - condition: succeededOrFailed() - inputs: - ArtifactName: 'CodeAnalysisLogs' - ArtifactType: 'Container' - - # Publish to TSA server - - task: TSAUpload@1 - condition: succeededOrFailed() - continueOnError: true - inputs: - tsaVersion: 'TsaV2' - codebase: 'Existing' - tsaEnvironment: 'PROD' - codeBaseName: 'PowerShell_GraphicalTools_20190809' - uploadAPIScan: false - uploadBinSkim: true - uploadCredScan: true - uploadFortifySCA: false - uploadFxCop: false - uploadModernCop: false - uploadPoliCheck: true - uploadPREfast: false - uploadRoslyn: false - uploadTSLint: false - uploadAsync: true - - - task: PowerShell@1 - displayName: 'Upload Artifacts' - condition: succeededOrFailed() - inputs: - scriptType: inlineScript - inlineScript: 'Write-Host "##vso[artifact.upload containerfolder=Microsoft.PowerShell.GraphicalTools-Signed;artifactname=Microsoft.PowerShell.GraphicalTools-Signed]$(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.GraphicalTools\Microsoft.PowerShell.GraphicalTools"' - - - task: PowerShell@1 - displayName: 'Upload Artifacts' - condition: succeededOrFailed() - inputs: - scriptType: inlineScript - inlineScript: 'Write-Host "##vso[artifact.upload containerfolder=Microsoft.PowerShell.ConsoleGuiTools-Signed;artifactname=Microsoft.PowerShell.ConsoleGuiTools-Signed]$(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools\Microsoft.PowerShell.ConsoleGuiTools"' + displayName: 'Extract build zip' + + - template: EsrpSign.yml@ComplianceRepo + parameters: + # the folder which contains the binaries to sign + buildOutputPath: $(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools + # the location to put the signed output + signOutputPath: $(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools-Signed + # the certificate ID to use + certificateId: "CP-230012" + # The file pattern to use + # If not using minimatch: comma separated, with * supported + # If using minimatch: newline separated, with !, **, and * supported. + # See link in the useMinimatch comments. + pattern: 'Microsoft.PowerShell.*.dll,Microsoft.PowerShell.*.psd1,Microsoft.PowerShell.*.psm1' + # decides if the task should use minimatch for the pattern matching. + # https://github.com/isaacs/minimatch#features + useMinimatch: false + + - pwsh: | + $signed="$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.ConsoleGuiTools-Signed\*" + $notSigned="$env:BUILD_ARTIFACTSTAGINGDIRECTORY\Microsoft.PowerShell.ConsoleGuiTools" + Copy-Item $signed $notSigned -Recurse -Force -Verbose + displayName: 'Copy signed files to unsigned folder' + + - template: EsrpSign.yml@ComplianceRepo + parameters: + # the folder which contains the binaries to sign + buildOutputPath: $(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools + # the location to put the signed output + signOutputPath: $(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools-Signed + # the certificate ID to use + certificateId: "CP-231522" + # The file pattern to use + # If not using minimatch: comma separated, with * supported + # If using minimatch: newline separated, with !, **, and * supported. + # See link in the useMinimatch comments. + pattern: 'NStack.dll,Terminal.Gui.dll' + # decides if the task should use minimatch for the pattern matching. + # https://github.com/isaacs/minimatch#features + useMinimatch: false + + - pwsh: | + $signed="$(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools-Signed\*" + $notSigned="$(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools" + Copy-Item $signed $notSigned -Recurse -Force -Verbose + displayName: 'Copy signed files to unsigned folder' + + - publish: $(Build.ArtifactStagingDirectory)\Microsoft.PowerShell.ConsoleGuiTools + artifact: Microsoft.PowerShell.ConsoleGuiTools-Signed + displayName: 'Upload Artifacts' + condition: succeededOrFailed() + +- stage: compliance + displayName: Compliance + dependsOn: Build + jobs: + - job: Compliance_Job + pool: + name: Package ES Standard Build + steps: + - checkout: self + - checkout: ComplianceRepo + - download: current + artifact: Microsoft.PowerShell.ConsoleGuiTools-Signed + - download: current + artifact: ConsoleGuiToolsAssetsJson + + - pwsh: | + Get-ChildItem -Recurse '$(Pipeline.Workspace)' + displayName: Capture downloaded artifacts + + - template: assembly-module-compliance.yml@ComplianceRepo + parameters: + # binskim + AnalyzeTarget: '$(Pipeline.Workspace)\Microsoft.PowerShell.ConsoleGuiTools-Signed\*.dll' + AnalyzeSymPath: 'SRV*' + # component-governance + sourceScanPath: '$(Pipeline.Workspace)\ConsoleGuiToolsAssetsJson' + # credscan + suppressionsFile: '' + # TermCheck + optionsRulesDBPath: '' + optionsFTPath: '' + # tsa-upload + codeBaseName: 'PSGraphicalTools_20201123' + # selections + APIScan: false # set to false when not using Windows APIs. diff --git a/.vsts-ci/misc-analysis.yml b/.vsts-ci/misc-analysis.yml index e8ccba8..c9dc67b 100644 --- a/.vsts-ci/misc-analysis.yml +++ b/.vsts-ci/misc-analysis.yml @@ -12,8 +12,19 @@ pr: - master resources: -- repo: self - clean: true + repositories: + - repository: ComplianceRepo + type: github + endpoint: ComplianceGHRepo + name: PowerShell/compliance jobs: -- template: templates/credscan.yml +- job: Compliance_Job + pool: + vmImage: windows-latest + steps: + - checkout: self + clean: true + - checkout: ComplianceRepo + clean: true + - template: ci-compliance.yml@ComplianceRepo diff --git a/.vsts-ci/templates/credscan.yml b/.vsts-ci/templates/credscan.yml deleted file mode 100644 index eb711c8..0000000 --- a/.vsts-ci/templates/credscan.yml +++ /dev/null @@ -1,31 +0,0 @@ -parameters: - pool: 'Hosted VS2017' - jobName: 'credscan' - displayName: Secret Scan - -jobs: -- job: ${{ parameters.jobName }} - pool: - name: ${{ parameters.pool }} - - displayName: ${{ parameters.displayName }} - - steps: - - powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" - displayName: Set Build Name for Non-PR - condition: ne(variables['Build.Reason'], 'PullRequest') - - - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 - displayName: 'Scan for secrets' - inputs: - debugMode: false - - - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 - displayName: 'Publish Secret Scan Logs to Build Artifacts' - continueOnError: true - - - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1 - displayName: 'Check for failures' - inputs: - CredScan: true - ToolLogsNotFoundAction: Error diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 897219a..8bedf20 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ModuleLayout.psd1 b/src/Microsoft.PowerShell.ConsoleGuiTools/ModuleLayout.psd1 index 80e976a..48c9432 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ModuleLayout.psd1 +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ModuleLayout.psd1 @@ -8,9 +8,9 @@ 'publish/NStack.dll' ) - 'OutGridView.Models' = @( - 'publish/OutGridView.Models.dll', - 'publish/OutGridView.Models.pdb' + 'Microsoft.PowerShell.OutGridView.Models' = @( + 'publish/Microsoft.PowerShell.OutGridView.Models.dll', + 'publish/Microsoft.PowerShell.OutGridView.Models.pdb' ) } diff --git a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj index 8c3e9e2..45b17d0 100644 --- a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj +++ b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Microsoft.PowerShell.GraphicalTools/ModuleLayout.psd1 b/src/Microsoft.PowerShell.GraphicalTools/ModuleLayout.psd1 index 2de7f61..dddfb29 100644 --- a/src/Microsoft.PowerShell.GraphicalTools/ModuleLayout.psd1 +++ b/src/Microsoft.PowerShell.GraphicalTools/ModuleLayout.psd1 @@ -7,9 +7,9 @@ "publish/Microsoft.PowerShell.GraphicalTools.psm1" ) - 'OutGridView.Models' = @( - 'publish/OutGridView.Models.dll', - 'publish/OutGridView.Models.pdb' + 'Microsoft.PowerShell.OutGridView.Models' = @( + 'publish/Microsoft.PowerShell.OutGridView.Models.dll', + 'publish/Microsoft.PowerShell.OutGridView.Models.pdb' ) } diff --git a/src/OutGridView.Models/ApplicationData.cs b/src/Microsoft.PowerShell.OutGridView.Models/ApplicationData.cs similarity index 100% rename from src/OutGridView.Models/ApplicationData.cs rename to src/Microsoft.PowerShell.OutGridView.Models/ApplicationData.cs diff --git a/src/OutGridView.Models/DataTable.cs b/src/Microsoft.PowerShell.OutGridView.Models/DataTable.cs similarity index 100% rename from src/OutGridView.Models/DataTable.cs rename to src/Microsoft.PowerShell.OutGridView.Models/DataTable.cs diff --git a/src/OutGridView.Models/DataTableColumn.cs b/src/Microsoft.PowerShell.OutGridView.Models/DataTableColumn.cs similarity index 100% rename from src/OutGridView.Models/DataTableColumn.cs rename to src/Microsoft.PowerShell.OutGridView.Models/DataTableColumn.cs diff --git a/src/OutGridView.Models/DataTableRow.cs b/src/Microsoft.PowerShell.OutGridView.Models/DataTableRow.cs similarity index 100% rename from src/OutGridView.Models/DataTableRow.cs rename to src/Microsoft.PowerShell.OutGridView.Models/DataTableRow.cs diff --git a/src/OutGridView.Models/OutGridView.Models.csproj b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj similarity index 100% rename from src/OutGridView.Models/OutGridView.Models.csproj rename to src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj diff --git a/src/OutGridView.Models/OutputModeOptions.cs b/src/Microsoft.PowerShell.OutGridView.Models/OutputModeOptions.cs similarity index 100% rename from src/OutGridView.Models/OutputModeOptions.cs rename to src/Microsoft.PowerShell.OutGridView.Models/OutputModeOptions.cs diff --git a/src/OutGridView.Models/Serializers.cs b/src/Microsoft.PowerShell.OutGridView.Models/Serializers.cs similarity index 100% rename from src/OutGridView.Models/Serializers.cs rename to src/Microsoft.PowerShell.OutGridView.Models/Serializers.cs diff --git a/src/OutGridView.Gui/OutGridView.Gui.csproj b/src/OutGridView.Gui/OutGridView.Gui.csproj index f17c0c1..e8e8818 100644 --- a/src/OutGridView.Gui/OutGridView.Gui.csproj +++ b/src/OutGridView.Gui/OutGridView.Gui.csproj @@ -24,7 +24,7 @@ - + From a91750ea9ca0b3cdad6503866893ed0100849ce5 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Thu, 4 Mar 2021 07:30:10 -0800 Subject: [PATCH 11/15] disable mouse tracking when ocgv closes (#135) --- .../ConsoleGui.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index a78f573..2ad6f0d 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -322,11 +322,15 @@ public void Dispose() { if (!Console.IsInputRedirected) { - // By emitting this, we fix an issue where arrow keys don't work in the console - // because .NET requires application mode to support Arrow key escape sequences - // Esc[?1h - Set cursor key to application mode - // See http://ascii-table.com/ansi-escape-sequences-vt-100.php - Console.Write("\u001b[?1h"); + // By emitting this, we fix two issues: + // 1. An issue where arrow keys don't work in the console because .NET + // requires application mode to support Arrow key escape sequences. + // Esc[?1h sets the cursor key to application mode + // See http://ascii-table.com/ansi-escape-sequences-vt-100.php + // 2. An issue where moving the mouse causes characters to show up because + // mouse tracking is still on. Esc[?1003l turns it off. + // See https://www.xfree86.org/current/ctlseqs.html#Mouse%20Tracking + Console.Write("\u001b[?1h\u001b[?1003l"); } } } From 869f68837ac257e9135f0fdf5407c28279591a19 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 9 Mar 2021 09:46:07 -0700 Subject: [PATCH 12/15] Updated build deps and dealt with breaking change in api --- .../GridViewDataSource.cs | 6 ++++-- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs index f8047ce..d4a24ca 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs @@ -20,14 +20,16 @@ public GridViewDataSource(List itemList) GridViewRowList = itemList; } - public bool IsMarked(int item) => GridViewRowList[item].IsMarked; + public int Length { get; } - public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width) + public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width, int start) { container.Move(col, line); RenderUstr(driver, GridViewRowList[item].DisplayString, col, line, width); } + public bool IsMarked(int item) => GridViewRowList[item].IsMarked; + public void SetMark(int item, bool value) { GridViewRowList[item].IsMarked = value; diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 8bedf20..7da34c1 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -5,8 +5,8 @@ - - + + From cd760a3136e5c1a5f81e1cf43204064a2659f5a3 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Thu, 1 Apr 2021 13:04:45 -0700 Subject: [PATCH 13/15] updated to latest terminal.gui package --- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 7da34c1..0bbd007 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -6,7 +6,7 @@ - + From ae01241fe1155666a2684dbf8c42570b35d319c8 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 27 Apr 2021 13:39:38 -0700 Subject: [PATCH 14/15] updated to Terminal.Gui 1.0.0-rc.11 --- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 0bbd007..0fd8162 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -6,7 +6,7 @@ - + From 645614e99cd72b1ce5947cf5f9d84b4972f6a152 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 28 Apr 2021 15:49:46 -0700 Subject: [PATCH 15/15] Updated to Terminal.Gui 1.0! --- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 0fd8162..c957b30 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -6,7 +6,7 @@ - +