Skip to content

Commit

Permalink
Base Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasliddledba committed May 17, 2018
0 parents commit 70448a5
Show file tree
Hide file tree
Showing 30 changed files with 874 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
InstallUtil.InstallLog
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Contributing Guidelines

The project accepts contributions via GitHub pull requests. This document outlines the process to help get your contribution accepted.

### Reporting a Bug

This repository is used by developers for maintaining project. If your issue is in another tool, please use the issue tracker that repository.

Please use the Issues feature of this repo to report issues.

### How to Contribute

1. Fork this repository, develop and test your change.
1. Submit a pull request w/o compiling an bin/*.exe. This will be compiled on merge

***NOTE***: In order to make testing and merging of PRs easier, please submit changes to in separate PRs.

#### Technical requirements

* Must for written for Windows 2012 or higher
* Updates to the README.md `Thanks` section if you are reusing code
* Images should not have any major security vulnerabilities
* Must be up-to-date with the latest stable `kubectl` features/client version
* Only leverage `kubectl` stable version

#### Documentation requirements

* Must include an in-depth `README.md`, including:
* Usage examples for new features

#### Merge approval and release process

A maintainer reviews the submission, and start a validation job in the CI to verify the technical requirements. A maintainer may add "LGTM" (Looks Good To Me) or an equivalent comment to indicate that a PR is acceptable. Any change requires at least one LGTM. No pull requests can be merged until at least one maintainer signs off with an LGTM.

Once the PR has been merged, the release job will automatically run in the CI to package and release `bin/kubectxwin.exe`

### Support Channels

The best I have right now are issues with labels. More to come
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Thomas Liddle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions PS2EXE-GUI/BuildExamples.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
powershell -nop -ep ByPass "%~dp0BuildExamples.ps1"
13 changes: 13 additions & 0 deletions PS2EXE-GUI/BuildExamples.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Markus Scholtes, DEVK 2017
# Create examples in subdir "Examples"

$SCRIPTPATH = Split-Path $SCRIPT:MyInvocation.MyCommand.Path -parent
ls "$SCRIPTPATH\Examples\*.ps1" | %{
."$SCRIPTPATH\ps2exe.ps1" "$($_.Fullname)" "$($_.Fullname -replace '.ps1','.exe')" -verbose
."$SCRIPTPATH\ps2exe.ps1" "$($_.Fullname)" "$($_.Fullname -replace '.ps1','-GUI.exe')" -verbose -noConsole
}

Remove-Item "$SCRIPTPATH\Examples\Progress.exe*"
Remove-Item "$SCRIPTPATH\Examples\ScreenBuffer-GUI.exe*"

$NULL = Read-Host "Press enter to exit"
270 changes: 270 additions & 0 deletions PS2EXE-GUI/Changes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
PS2EXE-GUI v0.5.0.10
Changes:
- Get-Credential is assuming a generic login so no "\user" is returned if domain name is not set

List of changes (line numbers are from PS2EXE-GUI v0.5.0.9):
line 8 - adjusted version number
line 21 - adjusted version number
line 463 - checks for PSCredentialTypes.Generic instead of PSCredentialTypes.Domain now
line 1903 - adjusted version number



PS2EXE-GUI v0.5.0.9
Changes:
- added takeover of caption and message for $host.UI.PromptForCredential and Get-Credential.

List of changes (line numbers are from PS2EXE-GUI v0.5.0.8):
line 8 - adjusted version number
line 21 - adjusted version number
lines 389 to 392 - removed comments
line 437 - added Unicode coding
line 458 - changed comment
line 461 - inserted message and caption takeover
line 474 - changed comment
line 1905 - adjusted version number



PS2EXE-GUI v0.5.0.8
Changes:
- $ERRORACTIONPREFERENCE = 'Stop' bug corrected. The last error is not swallowed anymore.

List of changes (line numbers are from PS2EXE-GUI v0.5.0.7):
line 8 - adjusted version number
line 21 - adjusted version number
line 1905 - adjusted version number
line 2167 - inserted expression to retrieve last error



PS2EXE-GUI v0.5.0.7
Changes:
- parameter parsing bug corrected. A slash is not accepted as an introducing character for named parameters anymore.

List of changes (line numbers are from PS2EXE-GUI v0.5.0.6):
line 8 - adjusted version number
line 21 - adjusted version number
line 1905 - adjusted version number
line 2102 - corrected regular expression for parameter parsing



PS2EXE-GUI v0.5.0.6
Changes:
- button texts for input corrected, tries now to use localized strings for OK and Cancel

List of changes (line numbers are from PS2EXE-GUI v0.5.0.5):
line 8 - adjusted version number
line 21 - adjusted version number
lines 906 to 959 - get localized strings for OK and Cancel in input bix
lines 975 to 986 - translated some comments
line 1809 - adjusted version number



PS2EXE-GUI v0.5.0.5
Changes:
- new parameters -title, -description, -company, -product, -copyright, -trademark and -version to set meta data (as can be seen in the properties dialog in tab "Details" in Windows Explorer)
- new parameter -requireAdmin generates an executable that requires administrative rights and forces the UAC dialog (if UAC is enabled)
- new parameter -virtualize generates an executable that uses application virtualization when accessing protected system file system folders or registry
- several minor fixes

List of changes (line numbers are from PS2EXE-GUI v0.5.0.4):
line 1 - introduced new parameters, spread parameters over 4 lines for better readability
line 5 - adjusted version number
line 18 - adjusted version number
line 26 - shortened expression
line 32 - shortened expression
lines 54 to 60 - help text for new parameters
line 119 - inserted check that -requireAdmin and -virtualize are not provided together
line 152 - inserted new parameters for powershell v2
lines 153 to 155 - prevent call to powershell v2 ps2exe when psexe is compiled itself
line 168 - shortened expression
line 174 - shortened expression
line 180 - inserted value checks for new parameters
lines 251 to 252 - inserted compiler options for new parameters
line 303 - inserted compiler directives for new parameters
line 1809 - adjusted version number
line 2006 to 2036 - corrected bug in parameter computation ("number in parameter name")
line 2054 - translated comment
lines 2107 to 2110 - removed comments
lines 2146 to 2151 - corrected encoding for write of config file
line 2161 - appended deletion of manifest file (if generated before)



PS2EXE-GUI v0.5.0.4
Changes:
- corrected input handler: advanced parameters ([CmdletBinding()]) are working for compiled scripts now
- implemented input pipeline (only of strings) for compiled scripts (only Powershell V3 and above), e.g, Get-ChildItem | CompiledScript.exe
- Powershell V2 (or PS2EXE with switch -runtime20) compiles with .Net V3.5x compiler rather than with .Net V2.0 compiler now (there is no Microsoft support for .Net V2 anymore, so I won't do either)
- implemented missing console screen functions to move, get and set screen blocks (see example ScreenBuffer.ps1)
- several minor fixes

List of changes (line numbers are from PS2EXE-GUI v0.5.0.3):
line 5 - adjusted version number
line 18 - adjusted version number
lines 186 to 193 - check for V3.5 compiler, warning if only V2 compiler found
line 407 - inserted pinvoke definitions for new screen functions
lines 519 to 522 - implemented GetBufferContents method
lines 588 to 591 - implemented ScrollBufferContents method
line 598 - correction of block size in SetBufferContents(Rectangle, BufferCell) method
lines 606 to 609 - implemented SetBufferContents(Coordinats, BufferCell[,]) method
lines 1157 to 1160 - exception displays actual error message instead of fixed text
lines 1226 to 1229 - exception displays actual error message instead of fixed text
line 1664 - adjusted version number
line 1701 - inserted pinvoke definitions for string pipeline functions
lines 1765 to 1769 - corrected input handler and inserted input string pipeline
lines 1771 to 1774 - better variable name for output collection
line 1876 - corrected parameter
line 1878 - modifications for input string pipeline



PS2EXE-GUI v0.5.0.3
Changes:
- Write-Progress implemented for GUI output (parameter -noConsole), nesting of progresses is ignored
- removed unnecessary parameter -runtime30 (there is no such thing as a 3.x runtime)
- if -runtime20 and -runtime40 is supplied together an error message is generated now
- two references to Console removed from -noConsole mode for better stability

List of changes (line numbers are from PS2EXE-GUI v0.5.0.2):
line 1 - removed parameter -runtime30
line 5 - adjusted version number
line 18 - adjusted version number
lines 26 to 28 - check for runtime40 instead of runtime30
lines 38 to 66 - overworked help text
lines 121 to 135 - removed runtime30
lines 163 to 175 - removed runtime30
line 205 - reference to ConsoleHost only in console mode now
lines 208 to 213 - removed runtime30
lines 217 to 233 - removed runtime30
line 254 - removed unnecessary comment
line 956 - inserted new class ProgressForm for display of a progress bar in GUI mode
line 1421 - inserted new variable for WriteProgess in GUI mode
lines 1422 to 1425 - method WriteProgress implemented for GUI mode
line 1519 - adjusted version number
lines 1641 to 1645 - replaced Console.WriteLine with MessageBox.Show for GUI mode
line 1768 - corrected typo
lines 1817 to 1821 - removed runtime30



PS2EXE-GUI v0.5.0.2
Changes:
- STA or MTA mode is used corresponding to the powershell version when not specified (V3 or higher: STA, V2: MTA)
This prevents problems with COM and some graphic dialogs
- icon file is seeked in the correct directory

List of changes (line numbers are from PS2EXE-GUI v0.5.0.1):
line 5 - adjusted version number
line 18 - adjusted version number
lines 111 to 115 - overworked routine to get icon file path
line 174 - when no -STA or -MTA switch is given, the threading apartment is set here according to the powershell version



PS2EXE-GUI v0.5.0.1
Changes:
- PROGRESS handler removed

List of changes (line numbers are from PS2EXE-GUI v0.5.0.0):
line 5 - adjusted version number
line 18 - adjusted version number
lines 1600 to 1603 - removed handler for progress stream, resulted in progress output converted to string (e.g.: "parent = -1 id = 0 act = Activity stat = State cur = pct = -1 sec = -1 type = Completed")



PS2EXE-GUI v0.5.0.0

Changes by Markus Scholtes:
- treats Powershell 5 or above like Powershell 4
- Unused classes ReadKeyForm and CredentialForm in console output removed
- remove dead code
- System.Windows.Forms and System.Drawing are loaded for GUI output
- Write methods use MessageBox.Show in GUI output
- InputBox class introduced which is used for Readline, Read LineasSecureString and Prompt with GUI output
- ChoiceBox-Klasse introduced which is used for PromptForChoice with GUI output
- ReadKeyBox-Klasse introduced which is used for ReadKey with GUI output
- Prompt accepts SecureString and PSCredential as field types now
- Prompt: when conversion of input fails, the prompt reappears
- PromptForPassword: corrected string overflow in 32 bit runtime
- PromptForCredential for console: computer name is used, user name is demanded when needed
- PromptForChoice accepts help texts and default values now
- the console output methods do not use black background and white foreground, but use the actual colors now
- missing methods WriteLine() and WriteLine(ConsoleColor, ConsoleColor, String) added
- method SetBufferContents for Clear-Host added
- method KeyAvailable added
- method BufferSize for GUI output corrected
- in GUI output the class Console is not called anymore
- input and output file are seeked and generated in the correct directory
- check that input file is not the same as the output file
- doubled VERBOSE and WARNING handler removed
- new, corrected and much expanded parser for command line parameters
- several small fixes
- revision of help and error texts

What is still missing:
Write-Progress


List of changes (line numbers are from PS2EXE v0.5.0.0):
lines 38 to 70 - updated help text
line 74 - powershell versions greater than 4 are treated like version 4
lines 94 to 107 - corrected generation of absolute file paths
line 108 - added check whether input file is the same as output file
line 140 - added icon file parameter for runtime 2.0
line 167 - omitted, no need for Set-Location
lines 207 to 208 - omitted, full paths already retrieved
lines 253 to 272 - omitted
lines 280 to 342 - omitted
line 414 - corrected StringBuilder constructor for 32 bit environments
line 430 - allocated enough space for long user or domain names
lines 447 to 561 - omitted
lines 564 to 582 - moved to beginning of c# code
line 579 - added Forms and Drawing namespaces in GUI mode
line 586 - removed variable CONSOLE, added variables to store console colors for GUI environment
lines 588 to 598 - added GUI support for BackgroundColor
lines 600 to 614 - corrected dummy size for BufferSize for GUI, so WriteLine is called
lines 616 to 627 - added GUI support for CursorPosition
lines 629 to 639 - added GUI support for CursorSize
line 643 - removed exception
lines 646 to 656 - added GUI support for ForegroundColor
lines 663 to 669 - implemented KeyAvailable
lines 671 to 674 - added GUI support for MaxPhysicalWindowSize
lines 676 to 679 - added GUI support for MaxWindowSize
line 694 - added support for NUMLOCK
lines 698 to 700 - added working GUI support for ReadKey
lines 709 to 712 - implemented, even Clear-Host works now
lines 719 to 733 - added GUI support for WindowPosition
lines 735 to 749 - added GUI support for WindowSize
lines 751 to 761 - added GUI support for WindowTitle
line 762 - added classes for input boxes, choice boxes and read key boxes
line 765 - removed constant CONSOLE
line 772 - initializing of screen colors added
lines 775 to 856 - Prompt: added GUI support, added secure text, added help messages
lines 858 to 906 - PromptForChoice: added GUI support
lines 908 to 937 - PromptForCredential: corrected handling of readonly user names
lines 939 to 964 - PromptForCredential: corrected handling of readonly user names
line 973 - added private variables for input boxes
lines 974 to 977 - added GUI support for ReadLine
lines 979 to 986 - ReadLineAsSecureString: implemented password input in console and GUI
lines 988 to 993 - Write: corrected color management, added GUI support
lines 995 to 1000 - Write: corrected color management, added GUI support
lines 1002 to 1007 - WriteDebugLine: corrected color management, added GUI support
lines 1009 to 1014 - WriteErrorLine: corrected color management, added GUI support
line 1016 - added function WriteLine(ConsoleColor, ConsoleColor, string)
line 1016 - added function WriteLine()
lines 1016 to 1021 - WriteLine: removed color management, added GUI support
lines 1028 to 1033 - WriteVerboseLine: corrected color management, added GUI support
lines 1035 to 1040 - WriteWarningLine: corrected color management, added GUI support
line 1047 - removed constant CONSOLE
line 1110 - set correct version number
line 1150 - removed constant CONSOLE
line 1193 to 1206 - removed Console.CancelKeyPress in case there is no console
line 1213 to 1216 - removed handler for verbose stream, resulted in double verbose output
line 1217 to 1220 - removed handler for warning stream, resulted in double warning output
line 1275 to 1280 - inserted a much improved routine to retrieve parameters (still faulty in some situations)
lines 1299 to 1303 - exception is displayed in a message box when there is no console
lines 1305 to 1309 - wait text is displayed in a message box when there is no console
Binary file added PS2EXE-GUI/Examples/Basisdemo.ps1
Binary file not shown.
Binary file added PS2EXE-GUI/Examples/Choice.ps1
Binary file not shown.
Binary file added PS2EXE-GUI/Examples/Confirm.ps1
Binary file not shown.
14 changes: 14 additions & 0 deletions PS2EXE-GUI/Examples/Get-ScriptPath.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Example script to retrieve path to script

# When compiled with PS2EXE the variable MyCommand contains no path anymore

if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript")
{ # Powershell script
$ScriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}
else
{ # PS2EXE compiled script
$ScriptPath = Split-Path -Parent -Path ([Environment]::GetCommandLineArgs()[0])
}

"Directory of executable file: " + $ScriptPath
Binary file added PS2EXE-GUI/Examples/Output.ps1
Binary file not shown.
Binary file added PS2EXE-GUI/Examples/Parameter.ps1
Binary file not shown.
23 changes: 23 additions & 0 deletions PS2EXE-GUI/Examples/Process-Pipeline.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Example script to process pipeline

# Type of pipeline object gets lost for compiled scripts, pipeline objects are always strings

[CmdletBinding()]
Param(
[parameter(Mandatory=$FALSE, ValueFromPipeline=$TRUE)] [AllowEmptyString()]$Pipeline
)
BEGIN
{
"Reading pipeline as array of strings"
$COUNTER = 0
}
PROCESS
{
if ($Pipeline -eq $NULL)
{ Write-Output "No element found in the pipeline" }
else
{
$COUNTER++
Write-Output "$COUNTER`: $Pipeline"
}
}
Loading

0 comments on commit 70448a5

Please sign in to comment.