Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 27 additions & 39 deletions apps/zipper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function Invoke-Unzip {
}

# =====================================================================
# WINDOW LAYOUT (fails silently): this window right + on top, Explorer left
# WINDOW LAYOUT (fails silently): this window right, Explorer left
# =====================================================================
$WinApi = @'
using System;
Expand Down Expand Up @@ -561,7 +561,7 @@ function Set-WindowLayout {
$root = [ZipperWin]::GetAncestor($console, 3)
if ($root -ne [IntPtr]::Zero) { $console = $root }
[void][ZipperWin]::ShowWindow($console, 9)
[void][ZipperWin]::SetWindowPos($console, [IntPtr](-1), $area.Right - $width, $area.Top, $width, $height, 0x40)
[void][ZipperWin]::SetWindowPos($console, [IntPtr]::Zero, $area.Right - $width, $area.Top, $width, $height, 0x40)
}

$windows = [ZipperWin]::ExplorerWindows()
Expand All @@ -578,14 +578,6 @@ function Set-WindowLayout {
} catch { return [IntPtr]::Zero }
}

function Reset-WindowLayout($console) {
try {
if ($console -and $console -ne [IntPtr]::Zero) {
[void][ZipperWin]::SetWindowPos($console, [IntPtr](-2), 0, 0, 0, 0, 0x13) # not topmost; keep size/position
}
} catch {}
}

# =====================================================================
# MENU
# =====================================================================
Expand Down Expand Up @@ -651,38 +643,34 @@ function Set-WindowRight {
# <<< layout
Set-WindowRight
Clear-Host
$Console = Set-WindowLayout
[void](Set-WindowLayout)
$SevenZip = $null
$last = ''
try {
$Settings = Import-Settings
while ($true) {
Say ""
Say " =============================================" 'Cyan'
Say " ZIPPER" 'Cyan'
Say " =============================================" 'Cyan'
Say ""
Say " 1 - Zip" 'White'
Say " 2 - Unzip" 'White'
Say " 3 - Settings" 'White'
Say " 0 - Quit" 'White'
Say ""
$choice = Read-MenuKey 'Choose 0-3' '0123' $last
if ($choice -eq '0') { break }
if ($choice -eq '3') {
if (@(Show-Settings) -contains 'quit') { break }
Clear-Host
continue
}
if (-not $SevenZip) { $SevenZip = Get-SevenZip }
if ($SevenZip) {
if ($choice -eq '1') { Invoke-Zip } else { Invoke-Unzip }
}
$last = $choice
Say ""
$Settings = Import-Settings
while ($true) {
Say ""
Say " =============================================" 'Cyan'
Say " ZIPPER" 'Cyan'
Say " =============================================" 'Cyan'
Say ""
Say " 1 - Zip" 'White'
Say " 2 - Unzip" 'White'
Say " 3 - Settings" 'White'
Say " 0 - Quit" 'White'
Say ""
$choice = Read-MenuKey 'Choose 0-3' '0123' $last
if ($choice -eq '0') { break }
if ($choice -eq '3') {
if (@(Show-Settings) -contains 'quit') { break }
Clear-Host
continue
}
} finally {
Reset-WindowLayout $Console
if (-not $SevenZip) { $SevenZip = Get-SevenZip }
if ($SevenZip) {
if ($choice -eq '1') { Invoke-Zip } else { Invoke-Unzip }
}
$last = $choice
Say ""
}
# Quit closes this window, not just the menu (errors above skip this and leave it open)
[Environment]::Exit(0)
Loading