diff --git a/windows/assemble.ps1 b/windows/assemble.ps1 new file mode 100644 index 00000000000..77385b56100 --- /dev/null +++ b/windows/assemble.ps1 @@ -0,0 +1,13 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'FIXME'; + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/async_wrapper.ps1 b/windows/async_wrapper.ps1 new file mode 100644 index 00000000000..77385b56100 --- /dev/null +++ b/windows/async_wrapper.ps1 @@ -0,0 +1,13 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'FIXME'; + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/command.ps1 b/windows/command.ps1 new file mode 100644 index 00000000000..77385b56100 --- /dev/null +++ b/windows/command.ps1 @@ -0,0 +1,13 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'FIXME'; + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/copy.ps1 b/windows/copy.ps1 new file mode 100644 index 00000000000..77385b56100 --- /dev/null +++ b/windows/copy.ps1 @@ -0,0 +1,13 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'FIXME'; + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/file.ps1 b/windows/file.ps1 new file mode 100644 index 00000000000..77385b56100 --- /dev/null +++ b/windows/file.ps1 @@ -0,0 +1,13 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'FIXME'; + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/ping.ps1 b/windows/ping.ps1 new file mode 100644 index 00000000000..02560873f5d --- /dev/null +++ b/windows/ping.ps1 @@ -0,0 +1,17 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'pong'; +If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data') +{ + $data = $params.data; +} + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name ping -Value $data; +echo $result | ConvertTo-Json; diff --git a/windows/slurp.ps1 b/windows/slurp.ps1 new file mode 100644 index 00000000000..93a698491fc --- /dev/null +++ b/windows/slurp.ps1 @@ -0,0 +1,33 @@ +#!powershell +# WANT_JSON + +$params = '{}' | ConvertFrom-Json; +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$src = ''; +If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'src') +{ + $src = $params.src; +} +Else +{ + If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'path') + { + $src = $params.path; + } +} +If (-not $src) +{ + +} + +$bytes = [System.IO.File]::ReadAllBytes($src); +$content = [System.Convert]::ToBase64String($bytes); + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name content -Value $content; +$result | Add-Member -MemberType NoteProperty -Name encoding -Value 'base64'; +echo $result | ConvertTo-Json; diff --git a/windows/stat.ps1 b/windows/stat.ps1 new file mode 100644 index 00000000000..f779b2531e3 --- /dev/null +++ b/windows/stat.ps1 @@ -0,0 +1,51 @@ +#!powershell +# WANT_JSON + +$params = '{}' | ConvertFrom-Json; +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$path = ''; +If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'path') +{ + $path = $params.path; +} + +$get_md5 = $TRUE; +If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'get_md5') +{ + $get_md5 = $params.get_md5; +} + +$stat = '{}' | ConvertFrom-Json; +If (Test-Path $path) +{ + $stat | Add-Member -MemberType NoteProperty -Name exists -Value $TRUE; + $info = Get-Item $path; + If ($info.Directory) # Only files have the .Directory attribute. + { + $stat | Add-Member -MemberType NoteProperty -Name isdir -Value $FALSE; + $stat | Add-Member -MemberType NoteProperty -Name size -Value $info.Length; + } + Else + { + $stat | Add-Member -MemberType NoteProperty -Name isdir -Value $TRUE; + } +} +Else +{ + $stat | Add-Member -MemberType NoteProperty -Name exists -Value $FALSE; +} + +If ($get_md5 -and $stat.exists -and -not $stat.isdir) +{ + $path_md5 = (Get-FileHash -Path $path -Algorithm MD5).Hash.ToLower(); + $stat | Add-Member -MemberType NoteProperty -Name md5 -Value $path_md5; +} + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name stat -Value $stat; +$result | Add-Member -MemberType NoteProperty -Name changed -Value $FALSE; +echo $result | ConvertTo-Json; diff --git a/windows/win_ping b/windows/win_ping new file mode 100644 index 00000000000..f64134454db --- /dev/null +++ b/windows/win_ping @@ -0,0 +1,87 @@ +#!powershell +# WANT_JSON + +If ($args.Length -gt 0) +{ + $params = Get-Content $args[0] | ConvertFrom-Json; +} + +$data = 'pong'; +If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data') +{ + $data = $params.data; +} + +$result = '{}' | ConvertFrom-Json; +$result | Add-Member -MemberType NoteProperty -Name ping -Value $data; +echo $result | ConvertTo-Json; + +# _______ _ _ +# |__ __| | (_) +# | | | |__ _ ___ +# | | | '_ \| / __| +# | | | | | | \__ \ +# __|_| |_| |_|_|___/ +# |_ _| +# | | ___ +# | | / __| +# _| |_\__ \ +# |___/\|___/ +# / \ +# / /\ \ +# / ____ \ +# /_/ \_\ +# | | +# | | __ _ _ __ __ _ ___ +# | | / _` | '__/ _` |/ _ \ +# | |___| (_| | | | (_| | __/ +# |______\__,_|_| \__, |\___| +# __/ | +# ____ _ |___/ +# | _ \| | | | +# | |_) | | ___ ___| | __ +# | _ <| |/ _ \ / __| |/ / +# | |_) | | (_) | (__| < +# |____/|_|\___/ \___|_|\_\ +# / __ \ / _| +# | | | | |_ +# | | | | _| +# | |__| | | +# \____/|_| __ __ +# / ____| | / _|/ _| +# | (___ | |_ _ _| |_| |_ +# \___ \| __| | | | _| _| +# ____) | |_| |_| | | | | +# |_____/ \__|\__,_|_| |_| +# | | | | +# | |_ _ ___| |_ +# _ | | | | / __| __| +# | |__| | |_| \__ \ |_ +# \____/_\__,_|___/\__| +# |__ __| +# | | ___ +# | |/ _ \ +# | | (_) | +# __|_|\___/ _ +# | \/ | | | +# | \ / | __ _| | _____ +# | |\/| |/ _` | |/ / _ \ +# | | | | (_| | < __/ +# |_|__|_|\__,_|_|\_\___| +# |__ __| | +# | | | |__ ___ +# | | | '_ \ / _ \ +# | | | | | | __/ +# __|_|_ |_| |_|\___| +# | ____(_) | +# | |__ _| | ___ +# | __| | | |/ _ \ +# | | | | | __/ +# |_|__ |_|_|\___| +# | _ \(_) +# | |_) |_ __ _ __ _ ___ _ __ +# | _ <| |/ _` |/ _` |/ _ \ '__| +# | |_) | | (_| | (_| | __/ | +# |____/|_|\__, |\__, |\___|_| +# __/ | __/ | +# |___/ |___/