mirror of
https://github.com/Grace-Solutions/PSMinIO.git
synced 2026-07-26 06:48:13 +00:00
f420effc84
✅ ZipArchiveBuilder - Core compression engine: • Built on System.IO.Compression (.NET Standard 2.0 built-in) • Real-time progress tracking with events • Start/end time tracking with duration calculation • Size metrics (compressed/uncompressed) and compression ratios • FileSystemInfo support (FileInfo, DirectoryInfo) • Append support via ZipArchiveMode.Update • Compression efficiency calculations ✅ ZipBuilder - PowerShell integration layer: • ThreadSafeProgressCollector integration • Multi-layer progress tracking (Zip + File levels) • Verbose logging with comprehensive metrics • ZipCreationResult object for PowerShell output • Event-driven progress reporting ✅ New-MinIOZipArchive cmdlet - Well-structured PowerShell interface: • Files parameter set: FileInfo[] support for multiple files • Directory parameter set: DirectoryInfo with recursive options • File filtering: InclusionFilter/ExclusionFilter ScriptBlocks • Compression levels: Optimal, Fastest, NoCompression • Archive modes: Create, Update (for appending) • BasePath parameter for custom entry name control • Force parameter for overwriting existing archives • PassThru parameter for detailed result objects ✅ Advanced features: • Progress tracking: Real-time speed and ETA calculations • Metrics: Compression ratio, space saved, processing time • File filtering: ScriptBlock-based inclusion/exclusion • Path handling: Cross-platform compatibility • Error handling: Comprehensive validation and recovery • Memory efficiency: 80KB buffer for optimal throughput ✅ Integration benefits: • No external dependencies (uses built-in .NET compression) • Thread-safe operations compatible with PSMinIO architecture • Consistent with existing progress tracking patterns • Minimal footprint aligning with project preferences • Enterprise-grade functionality with comprehensive metrics Architecture: Built on System.IO.Compression with custom progress tracking, providing superior zip functionality with PowerShell-native integration.
52 lines
2.2 KiB
PowerShell
52 lines
2.2 KiB
PowerShell
# Force update the PSMinIO DLL with the enhanced version
|
|
|
|
Write-Host "=== Updating PSMinIO DLL ===" -ForegroundColor Cyan
|
|
|
|
try {
|
|
# Stop all PowerShell processes to release the DLL
|
|
Write-Host "1. Stopping PowerShell processes..." -ForegroundColor Yellow
|
|
Get-Process | Where-Object {$_.ProcessName -like "*powershell*" -or $_.ProcessName -like "*pwsh*"} | ForEach-Object {
|
|
Write-Host " Stopping process: $($_.ProcessName) (PID: $($_.Id))" -ForegroundColor Gray
|
|
try {
|
|
$_ | Stop-Process -Force -ErrorAction SilentlyContinue
|
|
} catch {
|
|
Write-Host " Could not stop process $($_.Id): $($_.Exception.Message)" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
# Wait a moment for processes to fully stop
|
|
Start-Sleep -Seconds 3
|
|
|
|
# Copy the new DLL
|
|
Write-Host "2. Copying enhanced DLL..." -ForegroundColor Yellow
|
|
$sourceDLL = "bin\Release\netstandard2.0\PSMinIO.dll"
|
|
$targetDLL = "Module\PSMinIO\bin\PSMinIO.dll"
|
|
|
|
if (Test-Path $sourceDLL) {
|
|
Copy-Item $sourceDLL $targetDLL -Force
|
|
Write-Host "✅ DLL updated successfully!" -ForegroundColor Green
|
|
|
|
# Verify the copy
|
|
$sourceSize = (Get-Item $sourceDLL).Length
|
|
$targetSize = (Get-Item $targetDLL).Length
|
|
Write-Host " Source size: $($sourceSize) bytes" -ForegroundColor Gray
|
|
Write-Host " Target size: $($targetSize) bytes" -ForegroundColor Gray
|
|
|
|
if ($sourceSize -eq $targetSize) {
|
|
Write-Host "✅ File sizes match - copy successful!" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "⚠️ File sizes don't match - copy may have failed!" -ForegroundColor Yellow
|
|
}
|
|
} else {
|
|
Write-Host "❌ Source DLL not found: $sourceDLL" -ForegroundColor Red
|
|
Write-Host " Run 'dotnet build PSMinIO.csproj --configuration Release' first" -ForegroundColor Yellow
|
|
}
|
|
|
|
} catch {
|
|
Write-Host "❌ Update failed: $($_.Exception.Message)" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host "`n=== Update Complete ===" -ForegroundColor Cyan
|
|
Write-Host "You can now test the enhanced functionality with:" -ForegroundColor Yellow
|
|
Write-Host " .\scripts\Test-50-Files-Upload.ps1 -Verbose" -ForegroundColor White
|