# ===================================== # Skript: UpdateVerwaltungReadMe.ps1 - mit INSTALL-REMINDER # ===================================== $ProjectDir = Split-Path $MyInvocation.MyCommand.Path -Parent $readmePath = Join-Path $ProjectDir "Verwaltung_ReadMe.txt" Write-Host "Aktualisiere ReadMe in: $ProjectDir" # ReadMe-Vorlage (falls nicht vorhanden) if (-not (Test-Path $readmePath)) { @" ===================================== NEUIGKEITEN - Version ##VERSION## ===================================== Build-Info: - Build-Typ: ##CUSTOM## - Erledigte TODOs: ##DONE_COUNT## - Offene TODOs: ##OPEN_COUNT## - Install-Reminders: ##REMINDER_COUNT## ##DONE_TODOS## ##OPEN_TODOS## ##INSTALL_REMINDERS## Installation: ##BUILD_DATE## ===================================== "@ | Out-File $readmePath -Encoding UTF8 Write-Host "✅ ReadMe-Vorlage erstellt!" } # Version bestimmen $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" } } # Dateien durchsuchen $openTodos = @() $doneTodos = @() $installReminders = @() $csFiles = Get-ChildItem -Path $ProjectDir -Recurse -Filter "*.cs" -ErrorAction SilentlyContinue foreach ($file in $csFiles) { $content = Get-Content $file.FullName -Raw -ErrorAction SilentlyContinue # TODO erkennen $openMatches = [regex]::Matches($content, '//\s*(TODO|todo:|TODO\[[^x]\])\s*:?\s*(.+?)(?=\r?\n|//|$)', 'IgnoreCase') foreach ($match in $openMatches) { $txt = $match.Groups[2].Value.Trim() if ($txt) { $openTodos += "🔄 $txt [$($file.Name)]" } } # DONE erkennen $doneMatches = [regex]::Matches($content, '//\s*(DONE|TODO:\s*\[x\])\s*(.+?)(?=\r?\n|//|$)', 'IgnoreCase') foreach ($match in $doneMatches) { $txt = $match.Groups[2].Value.Trim() if ($txt) { $doneTodos += "✅ $txt [$($file.Name)]" } } # INSTALL-REMINDER erkennen $reminderMatches = [regex]::Matches($content, '//\s*INSTALL-REMINDER\s*:?\s*(.+?)(?=\r?\n|//|$)', 'IgnoreCase') foreach ($match in $reminderMatches) { $txt = $match.Groups[1].Value.Trim() if ($txt) { $installReminders += "⚙️ $txt [$($file.Name)]" } } } # Duplikate entfernen $openTodos = $openTodos | Sort-Object | Get-Unique $doneTodos = $doneTodos | Sort-Object | Get-Unique $installReminders = $installReminders | Sort-Object | Get-Unique # Formatierte Abschnitte $doneSection = if ($doneTodos.Count -gt 0) { @("=== ✅ ERLEDIGTE TODOs ($($doneTodos.Count)) ===") + ($doneTodos | ForEach-Object { "- $_" }) } else { @("Keine erledigten TODOs") } $openSection = if ($openTodos.Count -gt 0) { @("=== 🔄 OFFENE TODOs ($($openTodos.Count)) ===") + ($openTodos | ForEach-Object { "- $_" }) } else { @("Keine offenen TODOs 🎉") } $installSection = if ($installReminders.Count -gt 0) { @("=== ⚙️ INSTALL-REMINDER ($($installReminders.Count)) ===") + ($installReminders | ForEach-Object { "- $_" }) } else { @("Keine Install-Reminder vorhanden ✅") } # Textaufbereitung $doneText = $doneSection -join "`r`n" $openText = $openSection -join "`r`n" $installText = $installSection -join "`r`n" $custom = "Release Build" $buildDate = Get-Date -Format "dd.MM.yyyy HH:mm" # ReadMe aufbauen $readmeContent = @" ===================================== NEUIGKEITEN - Version $version ===================================== Build-Info: - Build-Typ: $custom - Erledigte TODOs: $($doneTodos.Count) - Offene TODOs: $($openTodos.Count) - Install-Reminders: $($installReminders.Count) $installText `r`n$doneText `r`n$openText Installation: $buildDate ===================================== "@ # Schreiben $readmeContent | Out-File $readmePath -Encoding UTF8 Write-Host "✅ Verwaltung_ReadMe.txt erfolgreich aktualisiert!"