Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,59 +0,0 @@
|
|||
function Send-MorseCode
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([string])]
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
Position=0)]
|
||||
[string]
|
||||
$Message,
|
||||
|
||||
[switch]
|
||||
$ShowCode
|
||||
)
|
||||
|
||||
Begin
|
||||
{
|
||||
$morseCode = @{
|
||||
a = ".-" ; b = "-..." ; c = "-.-." ; d = "-.."
|
||||
e = "." ; f = "..-." ; g = "--." ; h = "...."
|
||||
i = ".." ; j = ".---" ; k = "-.-" ; l = ".-.."
|
||||
m = "--" ; n = "-." ; o = "---" ; p = ".--."
|
||||
q = "--.-" ; r = ".-." ; s = "..." ; t = "-"
|
||||
u = "..-" ; v = "...-" ; w = ".--" ; x = "-..-"
|
||||
y = "-.--" ; z = "--.." ; 0 = "-----"; 1 = ".----"
|
||||
2 = "..---"; 3 = "...--"; 4 = "....-"; 5 = "....."
|
||||
6 = "-...."; 7 = "--..."; 8 = "---.."; 9 = "----."
|
||||
}
|
||||
}
|
||||
Process
|
||||
{
|
||||
foreach ($word in $Message)
|
||||
{
|
||||
$word.Split(" ",[StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
|
||||
|
||||
foreach ($char in $_.ToCharArray())
|
||||
{
|
||||
if ($char -in $morseCode.Keys)
|
||||
{
|
||||
foreach ($code in ($morseCode."$char").ToCharArray())
|
||||
{
|
||||
if ($code -eq ".") {$duration = 250} else {$duration = 750}
|
||||
|
||||
[System.Console]::Beep(1000, $duration)
|
||||
Start-Sleep -Milliseconds 50
|
||||
}
|
||||
|
||||
if ($ShowCode) {Write-Host ("{0,-6}" -f ("{0,6}" -f $morseCode."$char")) -NoNewLine}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ShowCode) {Write-Host}
|
||||
}
|
||||
|
||||
if ($ShowCode) {Write-Host}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
Send-MorseCode -Message "S.O.S" -ShowCode
|
||||
|
|
@ -1 +0,0 @@
|
|||
"S.O.S", "Goodbye, cruel world!" | Send-MorseCode -ShowCode
|
||||
Loading…
Add table
Add a link
Reference in a new issue