# UpdateVerwaltungReadMe.ps1 - FINAL mit ERLEDIGTEN TODOs $ProjectDir = Split-Path $MyInvocation.MyCommand.Path -Parent $readmePath = Join-Path $ProjectDir "Verwaltung_ReadMe.txt" Write-Host "Aktualisiere ReadMe in: $ProjectDir" # ReadMe-Vorlage erstellen (falls nicht vorhanden) if (-not (Test-Path $readmePath)) { @" ===================================== NEUIGKEITEN - Version ##VERSION## ===================================== Build-Info: - Build-Typ: ##CUSTOM## - Erledigte TODOs: ##TODOS## Installation: ##BUILD_DATE## ===================================== "@ | Out-File $readmePath -Encoding UTF8 Write-Host "✅ ReadMe-Vorlage erstellt!" } # 1. VERSION aus AssemblyInfo.cs $version = "1.0.0.0" $assemblyInfoPath = Join-Path $ProjectDir "Properties\AssemblyInfo.cs" if (Test-Path $assemblyInfoPath) { $assemblyContent = Get-Content $assemblyInfoPath -Raw -ErrorAction SilentlyContinue if ($assemblyContent -match 'AssemblyVersion\s*\(\s*"([^"]+)"\s*\)') { $version = $matches[1] Write-Host "✓ Version: $version" } } # 2. ERLEDIGTE TODOs sammeln $doneTodos = @() $csFiles = Get-ChildItem -Path $ProjectDir -Recurse -Filter "*.cs" -ErrorAction SilentlyContinue foreach ($file in $csFiles) { $content = Get-Content $file.FullName -Raw -ErrorAction SilentlyContinue # ERLEDIGTE TODOs: DONE oder [x] $doneMatches = [regex]::Matches($content, '//\s*(?:DONE|TODO:\s*\[x\])\s*(.+?)(?=\r?\n|$)', 'IgnoreCase') foreach ($match in $doneMatches) { $doneText = $match.Groups[1].Value.Trim() $doneTodos += "✅ $doneText [$($file.Name)]" } } # 3. Custom-Text mit DONE-Status if ($doneTodos.Count -gt 0) { $custom = "Erledigte TODOs: $($doneTodos.Count)" $todosText = ($doneTodos -join "`n") } else { $custom = "Keine erledigten TODOs" $todosText = "Noch keine Aufgaben abgeschlossen" } $buildDate = Get-Date -Format "dd.MM.yyyy HH:mm" # 4. Platzhalter ersetzen $content = Get-Content $readmePath -Raw -Encoding UTF8 -ErrorAction SilentlyContinue $content = $content -replace "##VERSION##", $version ` -replace "##CUSTOM##", $custom ` -replace "##TODOS##", $todosText ` -replace "##BUILD_DATE##", $buildDate Set-Content $readmePath $content -Encoding UTF8 Write-Host "✓ ReadMe aktualisiert!" Write-Host " Version: $version" Write-Host " Erledigte TODOs: $($doneTodos.Count)"