# Script para agregar automáticamente el método NombreCategoria param( [string]$FilePath, [string]$Category ) if (-not (Test-Path $FilePath)) { Write-Error "File not found: $FilePath" return } $content = Get-Content $FilePath -Raw # Buscar el patrón del método NombreClase $pattern = '(\s+public static string NombreClase\(\)\s+\{\s+return ".*?";\s+\})' if ($content -match $pattern) { $nombreclaseMethod = $matches[1] $newMethod = @" $nombreclaseMethod public static string NombreCategoria() { return "$Category"; } "@ $newContent = $content -replace [regex]::Escape($nombreclaseMethod), $newMethod # Verificar que no ya existe el método NombreCategoria if ($content -notmatch 'public static string NombreCategoria\(\)') { Set-Content $FilePath -Value $newContent -NoNewline Write-Host "✓ Updated: $FilePath" } else { Write-Host "- Skipped (already has NombreCategoria): $FilePath" } } else { Write-Warning "Could not find NombreClase method in: $FilePath" }