# Bouwt een .wgt voor Apps2Samsung sideload (ZIP met forward-slash paden). $ErrorActionPreference = "Stop" Add-Type -AssemblyName System.IO.Compression Add-Type -AssemblyName System.IO.Compression.FileSystem $root = $PSScriptRoot $www = Resolve-Path (Join-Path $root "www") $config = Join-Path $www "config.xml" if (-not (Test-Path $config)) { throw "config.xml ontbreekt in www/" } [xml]$xml = Get-Content $config $version = $xml.widget.version if (-not $version) { $version = "1.0.0" } $dist = Join-Path $root "..\android-tv\dist" New-Item -ItemType Directory -Force -Path $dist | Out-Null $outPath = Join-Path $dist "vonas-mediacluster-tizen-$version.wgt" if (Test-Path $outPath) { Remove-Item $outPath -Force } $fs = [IO.File]::Open($outPath, [IO.FileMode]::Create) $zip = New-Object IO.Compression.ZipArchive($fs, [IO.Compression.ZipArchiveMode]::Create) try { Get-ChildItem $www -Recurse -File | ForEach-Object { $rel = $_.FullName.Substring($www.Path.Length).TrimStart("\").Replace("\", "/") [IO.Compression.ZipFileExtensions]::CreateEntryFromFile( $zip, $_.FullName, $rel, [IO.Compression.CompressionLevel]::Optimal ) | Out-Null } } finally { $zip.Dispose() $fs.Dispose() } $size = [math]::Round((Get-Item $outPath).Length / 1KB, 1) Write-Host "OK: $outPath ($size KB)" Write-Host "Installeer via Apps2Samsung → Custom WGT/TPK."