# ============================================================================ # RMS TECH - WARZONE BOOST / Otimizacao para COD Warzone # Interface + logica · by @rms.tech · distribuicao gratuita / free to share # Executado pelo RMS-TECH-WARZONE-BOOST.bat (nao rode este .ps1 direto). # ============================================================================ $ErrorActionPreference = 'Stop' # --- pasta do script / script folder ------------------------------------ $ScriptDir = $PSScriptRoot if (-not $ScriptDir) { $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path } try { Set-Location -LiteralPath $ScriptDir } catch {} try { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 } catch {} # --- liga cores ANSI 24-bit no console classico / enable truecolor ----- if (-not $env:WT_SESSION) { try { Add-Type -Namespace RmsVT -Name Native -MemberDefinition '[DllImport("kernel32.dll")] public static extern IntPtr GetStdHandle(int h); [DllImport("kernel32.dll")] public static extern bool GetConsoleMode(IntPtr h, out uint m); [DllImport("kernel32.dll")] public static extern bool SetConsoleMode(IntPtr h, uint m);' $hOut = [RmsVT.Native]::GetStdHandle(-11) $cmode = [uint32]0 [void][RmsVT.Native]::GetConsoleMode($hOut, [ref]$cmode) [void][RmsVT.Native]::SetConsoleMode($hOut, $cmode -bor 0x0004) } catch {} } # --- tamanho da janela / window size (best effort) -------------------- try { $ui = $Host.UI.RawUI $mx = $ui.MaxPhysicalWindowSize $cols = [Math]::Min(104, [int]$mx.Width) $rws = [Math]::Min(46, [int]$mx.Height) $bs = $ui.BufferSize; if ($bs.Width -lt $cols) { $bs.Width = $cols }; $bs.Height = 3000; $ui.BufferSize = $bs $ws = $ui.WindowSize; $ws.Width = $cols; $ws.Height = $rws; $ui.WindowSize = $ws } catch {} # --- paleta / palette -------------------------------------------------- $ESC = [char]27 $RS = "$ESC[0m" $BLD = "$ESC[1m" function fg ($r, $g, $b) { "$ESC[38;2;$r;$g;${b}m" } function bgc ($r, $g, $b) { "$ESC[48;2;$r;$g;${b}m" } $CY = fg 90 210 255 $MG = fg 200 100 255 $GR = fg 90 230 150 $RD = fg 255 100 115 $YL = fg 255 205 100 $DM = fg 120 126 145 $WH = fg 236 239 246 $TX = fg 205 210 226 $DOT = [char]183 $PTR = [char]187 $AUP = [char]24 $ADN = [char]25 # --- banner (fonte ANSI Shadow, chars CP437-safe) ------------------- $RMS = @( '██████╗ ███╗ ███╗███████╗', '██╔══██╗████╗ ████║██╔════╝', '██████╔╝██╔████╔██║███████╗', '██╔══██╗██║╚██╔╝██║╚════██║', '██║ ██║██║ ╚═╝ ██║███████║', '╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝') $TECH = @( '████████╗███████╗ ██████╗██╗ ██╗', '╚══██╔══╝██╔════╝██╔════╝██║ ██║', ' ██║ █████╗ ██║ ███████║', ' ██║ ██╔══╝ ██║ ██╔══██║', ' ██║ ███████╗╚██████╗██║ ██║', ' ╚═╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝') function GradBlock ($arr, $c1, $c2, $ind) { $n = $arr.Count for ($i = 0; $i -lt $n; $i++) { if ($n -le 1) { $q = 0 } else { $q = $i / ($n - 1) } $cr = [int]($c1[0] + ($c2[0] - $c1[0]) * $q) $cg = [int]($c1[1] + ($c2[1] - $c1[1]) * $q) $cb = [int]($c1[2] + ($c2[2] - $c1[2]) * $q) Write-Host ((' ' * $ind) + (fg $cr $cg $cb) + $arr[$i] + $RS) } } function Header { try { Clear-Host } catch {} Write-Host '' GradBlock $RMS @(95, 215, 255) @(150, 130, 255) 6 GradBlock $TECH @(150, 130, 255) @(210, 95, 255) 6 Write-Host '' Write-Host (' ' + $DM + ('─' * 58) + $RS) Write-Host (' ' + $WH + $BLD + 'WARZONE BOOST' + $RS + $DM + " Otimizacao para COD Warzone $DOT COD Warzone Optimization" + $RS) Write-Host (' ' + $DM + 'by ' + $RS + $MG + $BLD + '@rms.tech' + $RS + $DM + " $DOT distribuicao gratuita" + $RS) Write-Host '' } # --- menu com setas / arrow-key menu ------------------------------- function Menu ($items, $title) { $sel = 0 $w = 58 while ($true) { Header if ($title) { Write-Host (' ' + $YL + $title + $RS); Write-Host '' } Write-Host (' ' + $DM + '┌' + ('─' * $w) + '┐' + $RS) Write-Host (' ' + $DM + '│' + (' ' * $w) + '│' + $RS) for ($i = 0; $i -lt $items.Count; $i++) { $lab = ' ' + $items[$i].Key + ' ' + $items[$i].Text if ($i -eq $sel) { $cell = ' ' + $PTR + ' ' + $lab $cell = $cell + (' ' * [Math]::Max(0, $w - $cell.Length)) Write-Host (' ' + $DM + '│' + $RS + (bgc 38 44 62) + (fg 130 232 255) + $BLD + $cell + $RS + $DM + '│' + $RS) } else { $cell = ' ' + $lab $cell = $cell + (' ' * [Math]::Max(0, $w - $cell.Length)) Write-Host (' ' + $DM + '│' + $RS + $TX + $cell + $RS + $DM + '│' + $RS) } } Write-Host (' ' + $DM + '│' + (' ' * $w) + '│' + $RS) Write-Host (' ' + $DM + '└' + ('─' * $w) + '┘' + $RS) Write-Host '' Write-Host (' ' + $DM + "$AUP $ADN" + $RS + $TX + ' navegar ' + $RS + $DM + 'Enter' + $RS + $TX + ' confirmar ' + $RS + $DM + 'Esc' + $RS + $TX + ' voltar' + $RS) $k = [Console]::ReadKey($true) if ($k.Key -eq 'UpArrow') { $sel = ($sel - 1 + $items.Count) % $items.Count; continue } if ($k.Key -eq 'DownArrow') { $sel = ($sel + 1) % $items.Count; continue } if ($k.Key -eq 'Enter') { return $items[$sel].Id } if ($k.Key -eq 'Escape') { return 'BACK' } foreach ($it in $items) { if ($it.Key -ne '' -and ([string]$k.KeyChar -eq [string]$it.Key)) { return $it.Id } } } } # --- helpers de status / status helpers --------------------------- function SLine ($txt) { Write-Host (' ' + $DM + ' ... ' + $RS + $TX + $txt + $RS) -NoNewline } function SOk ($txt) { Write-Host ("`r" + $ESC + '[2K' + ' ' + (bgc 30 90 55) + $GR + $BLD + ' OK ' + $RS + ' ' + $TX + $txt + $RS) } function SFail ($txt) { Write-Host ("`r" + $ESC + '[2K' + ' ' + (bgc 100 35 40) + $RD + $BLD + ' ERRO ' + $RS + ' ' + $TX + $txt + $RS) } function SWarn ($txt) { Write-Host ("`r" + $ESC + '[2K' + ' ' + (bgc 95 75 20) + $YL + $BLD + ' AVISO ' + $RS + ' ' + $TX + $txt + $RS) } function Bar ($total, $done) { $wd = 34 if ($total -le 0) { $f = 0 } else { $f = [int][Math]::Round($wd * $done / $total) } ' ' + $CY + ('█' * $f) + $DM + ('░' * ($wd - $f)) + $RS + $TX + (' {0}/{1}' -f $done, $total) + $RS } function GBox ($lines, $col) { $lines = @($lines) $w = 50 Write-Host (' ' + $col + $BLD + '╔' + ('═' * $w) + '╗' + $RS) foreach ($l in $lines) { $s = ' ' + $l if ($s.Length -gt $w) { $s = $s.Substring(0, $w) } $s = $s + (' ' * ($w - $s.Length)) Write-Host (' ' + $col + $BLD + '║' + $s + '║' + $RS) } Write-Host (' ' + $col + $BLD + '╚' + ('═' * $w) + '╝' + $RS) } function Pause2 { Write-Host '' Write-Host (' ' + $DM + 'pressione qualquer tecla para voltar ao menu...' + $RS) [void][Console]::ReadKey($true) } # --- executa reg.exe silencioso / run reg.exe quietly ------------ function RegRun { param([Parameter(ValueFromRemainingArguments = $true)] $a) $old = $ErrorActionPreference $ErrorActionPreference = 'SilentlyContinue' try { $null = & reg @a 2>&1 } catch {} $ok = ($LASTEXITCODE -eq 0) $ErrorActionPreference = $old return $ok } # --- caminho IFEO do COD Warzone / COD Warzone IFEO path --------------- $IFEO = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options' $IFEO_SHIP = "$IFEO\COD.exe" # --- lista de tweaks / tweak list ------------------------------- function Tweaks ($prio) { $games = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games' $pname = switch ([string]$prio) { '3' { 'High (3)' } '6' { 'Above Normal (6)' } default { "($prio)" } } @( @{ K = 'HKCU\System\GameConfigStore'; N = 'GameDVR_Enabled'; T = 'REG_DWORD'; D = '0'; L = 'Game DVR desligado' } @{ K = 'HKCU\System\GameConfigStore'; N = 'GameDVR_FSEBehaviorMode'; T = 'REG_DWORD'; D = '2'; L = 'FSE behavior mode = 2' } @{ K = 'HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling'; N = 'PowerThrottlingOff'; T = 'REG_DWORD'; D = '1'; L = 'Power Throttling desligado' } @{ K = 'HKLM\SOFTWARE\Microsoft\Windows\Dwm'; N = 'OverlayTestMode'; T = 'REG_DWORD'; D = '5'; L = 'DWM OverlayTestMode = 5' } @{ K = $games; N = 'GPU Priority'; T = 'REG_DWORD'; D = '8'; L = 'Games: GPU Priority = 8' } @{ K = $games; N = 'Priority'; T = 'REG_DWORD'; D = '6'; L = 'Games: Priority = 6' } @{ K = $games; N = 'Scheduling Category'; T = 'REG_SZ'; D = 'High'; L = 'Games: Scheduling Category = High' } @{ K = $games; N = 'SFIO Priority'; T = 'REG_SZ'; D = 'High'; L = 'Games: SFIO Priority = High' } @{ K = "$IFEO_SHIP\PerfOptions"; N = 'CpuPriorityClass'; T = 'REG_DWORD'; D = [string]$prio; L = ('Warzone (COD.exe): CPU prio = ' + $pname) } @{ K = "$IFEO_SHIP\PerfOptions"; N = 'IoPriority'; T = 'REG_DWORD'; D = '3'; L = 'Warzone (COD.exe): I/O prio = High' } ) } # --- tela de confirmacao / confirm screen -------------------- function Confirm ($prio) { Header $w = 58 Write-Host (' ' + $YL + 'Isto sera gravado no Registro do Windows:' + $RS) Write-Host '' $rows = @( 'GameConfigStore GameDVR_Enabled 0', 'GameConfigStore GameDVR_FSEBehaviorMode 2', 'PowerThrottling PowerThrottlingOff 1', 'Dwm OverlayTestMode 5', 'Tasks\Games GPU Priority 8', 'Tasks\Games Priority 6', 'Tasks\Games Scheduling Category High', 'Tasks\Games SFIO Priority High', ('IFEO COD.exe CpuPriorityClass ' + $prio), 'IFEO COD.exe IoPriority 3') Write-Host (' ' + $DM + '┌' + ('─' * $w) + '┐' + $RS) foreach ($r in $rows) { $s = ' ' + $r $s = $s + (' ' * [Math]::Max(0, $w - $s.Length)) Write-Host (' ' + $DM + '│' + $RS + $TX + $s + $RS + $DM + '│' + $RS) } Write-Host (' ' + $DM + '└' + ('─' * $w) + '┘' + $RS) Write-Host '' Write-Host (' ' + $DM + 'IFEO faz o Windows por o COD.exe em' + $RS) Write-Host (' ' + $DM + 'prioridade sozinho, toda vez que o jogo abre.' + $RS) Write-Host (' ' + $DM + 'Nada roda em fundo.' + $RS) Write-Host '' Write-Host (' ' + $DM + 'backup .reg em ' + $RS + (fg 170 176 196) + (Join-Path $ScriptDir 'Backup_RMS_WARZONE') + $RS) Write-Host '' Write-Host (' ' + (bgc 30 90 55) + $BLD + ' S ' + $RS + $TX + ' aplicar agora ' + $RS + (bgc 100 35 40) + $BLD + ' N ' + $RS + $TX + ' cancelar' + $RS) while ($true) { $k = [Console]::ReadKey($true) $c = [string]$k.KeyChar if ($c -match '^[sySY]$') { return $true } if ($c -match '^[nN]$' -or $k.Key -eq 'Escape') { return $false } } } # --- aplicar / apply --------------------------------------- function RunApply ($prio) { Header Write-Host (' ' + $WH + $BLD + "1 $DOT BACKUP" + $RS) Write-Host '' $stamp = Get-Date -Format 'yyyy-MM-dd_HH-mm-ss' $bkdir = Join-Path (Join-Path $ScriptDir 'Backup_RMS_WARZONE') $stamp New-Item -ItemType Directory -Force -Path $bkdir | Out-Null $bkeys = @( @{ K = 'HKCU\System\GameConfigStore'; F = 'GameConfigStore.reg' } @{ K = 'HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling'; F = 'PowerThrottling.reg' } @{ K = 'HKLM\SOFTWARE\Microsoft\Windows\Dwm'; F = 'Dwm.reg' } @{ K = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games'; F = 'Tasks_Games.reg' } @{ K = $IFEO_SHIP; F = 'IFEO_COD_exe.reg' } ) foreach ($x in $bkeys) { SLine $x.F Start-Sleep -Milliseconds 55 if (RegRun query $x.K) { if (RegRun export $x.K (Join-Path $bkdir $x.F) /y) { SOk ('backup ' + $x.F) } else { SWarn ('sem backup ' + $x.F) } } else { Set-Content -LiteralPath (Join-Path $bkdir ('MISSING_' + $x.F + '.txt')) -Value $x.K -Encoding ASCII SWarn ('nao existia, ok ' + $x.F) } } Write-Host '' Write-Host (' ' + $WH + $BLD + "2 $DOT APLICANDO / APPLYING" + $RS) Write-Host '' $tw = Tweaks $prio $done = 0; $fail = 0 foreach ($t in $tw) { SLine $t.L Start-Sleep -Milliseconds 70 if (RegRun add $t.K /v $t.N /t $t.T /d $t.D /f) { SOk $t.L; $done++ } else { SFail $t.L; $fail++ } } Write-Host '' Write-Host (Bar $tw.Count $done) Write-Host '' if ($fail -eq 0) { GBox @( "TWEAKS APLICADOS $DOT REINICIE O PC", "TWEAKS APPLIED $DOT RESTART YOUR PC", "COD Warzone: prioridade automatica ao abrir") $GR } else { GBox @("$fail item(s) falharam.", 'Feche e rode como administrador.') $YL } Write-Host '' Write-Host (' ' + $DM + 'backup: ' + $RS + (fg 170 176 196) + $bkdir + $RS) Write-Host '' Write-Host (' ' + $MG + $BLD + 'curtiu? compartilha com a galera e segue @rms.tech' + $RS) try { Start-Process 'https://otimizar.superpackultimate.com/?de=packs' } catch {} Pause2 } # --- restaurar / restore -------------------------------- function RunRestore { Header Write-Host (' ' + $WH + $BLD + 'RESTAURAR / RESTORE' + $RS) Write-Host '' $bkroot = Join-Path $ScriptDir 'Backup_RMS_WARZONE' if (-not (Test-Path -LiteralPath $bkroot)) { GBox @('Nenhum backup encontrado.', 'No backup found.') $RD Pause2; return } $latest = Get-ChildItem -LiteralPath $bkroot -Directory -ErrorAction SilentlyContinue | Sort-Object Name -Descending | Select-Object -First 1 if (-not $latest) { GBox @('Nenhum backup encontrado.', 'No backup found.') $RD Pause2; return } Write-Host (' ' + $DM + 'de / from: ' + $RS + (fg 170 176 196) + $latest.FullName + $RS) Write-Host '' Write-Host (' ' + $WH + $BLD + 'removendo valores adicionados / removing added values' + $RS) Write-Host '' foreach ($t in (Tweaks '0')) { SLine ('remover ' + $t.N) Start-Sleep -Milliseconds 40 [void](RegRun delete $t.K /v $t.N /f) SOk ('removido ' + $t.N) } Write-Host '' Write-Host (' ' + $WH + $BLD + 'reimportando originais / re-importing originals' + $RS) Write-Host '' $imported = 0 Get-ChildItem -LiteralPath $latest.FullName -Filter *.reg -ErrorAction SilentlyContinue | ForEach-Object { SLine ('import ' + $_.Name) Start-Sleep -Milliseconds 40 if (RegRun import $_.FullName) { SOk ('import ' + $_.Name); $imported++ } else { SFail ('import ' + $_.Name) } } if ($imported -eq 0) { Write-Host (' ' + $DM + ' (nenhum .reg neste backup)' + $RS) } if (Test-Path -LiteralPath (Join-Path $latest.FullName 'MISSING_PowerThrottling.reg.txt')) { [void](RegRun delete 'HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling' /f) SWarn 'chave PowerThrottling removida (nao existia antes)' } if (Test-Path -LiteralPath (Join-Path $latest.FullName 'MISSING_IFEO_COD_exe.reg.txt')) { [void](RegRun delete $IFEO_SHIP /f) SWarn 'chave IFEO removida (nao existia antes) COD.exe' } Write-Host '' GBox @("RESTAURADO $DOT REINICIE O PC", "RESTORED $DOT RESTART YOUR PC") $GR Pause2 } # ============================================================================ # PRESET "RMS FPS" - ajusta a config do Call of Duty (s.1.0.cod*.txt*) # ============================================================================ $CodDir = Join-Path $env:LOCALAPPDATA 'Activision\Call of Duty\players' $CodBkRoot = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'RMS-backup-config-cod' $CodProc = '^(cod\d*|blackops.*|modernwarfare.*|warzone.*)$' # grupos: On = ligado por padrao. Voce liga/desliga no menu do preset. $CodGroups = [ordered]@{ GPU = @{ On = $true; Title = 'GPU / FPS' } PROT = @{ On = $true; Title = 'Proteger as edicoes' } MEM = @{ On = $false; Title = 'Memoria de video (placa de 10 GB ou mais)' } IMG = @{ On = $false; Title = 'Imagem (perde qualidade visual)' } } # M = Set (define) ou Lower (so reduz a qualidade, nunca sobe) function CodTweaks { @( @{ G = 'GPU'; M = 'Lower'; N = 'SubdivisionLevel'; V = '1' } @{ G = 'GPU'; M = 'Set'; N = 'Tessellation'; V = '0_Off' } @{ G = 'GPU'; M = 'Lower'; N = 'ParticleQuality'; V = 'low' } @{ G = 'GPU'; M = 'Set'; N = 'VolumetricQuality'; V = 'QUALITY_LOW' } @{ G = 'GPU'; M = 'Lower'; N = 'AmbientLightingQuality'; V = 'Low' } @{ G = 'GPU'; M = 'Lower'; N = 'WeatherGridVolumesQuality'; V = 'Low' } @{ G = 'GPU'; M = 'Set'; N = 'ShaderQuality'; V = 'Low' } @{ G = 'GPU'; M = 'Set'; N = 'DeferredPhysics'; V = 'Low Quality' } @{ G = 'GPU'; M = 'Set'; N = 'ScreenSpaceShadowQuality'; V = 'Off' } @{ G = 'GPU'; M = 'Set'; N = 'ReflectionProbeHalfResolution'; V = 'true' } @{ G = 'GPU'; M = 'Set'; N = 'ReflectionProbeRelighting'; V = '1' } @{ G = 'GPU'; M = 'Lower'; N = 'CorpseLimit'; V = '2' } @{ G = 'PROT'; M = 'Set'; N = 'ConfigCloudStorageEnabled'; V = 'false' } @{ G = 'PROT'; M = 'Set'; N = 'DisableHWChangeDetection'; V = 'true' } @{ G = 'MEM'; M = 'Set'; N = 'VideoMemoryScaleMP'; V = '0.85' } @{ G = 'IMG'; M = 'Set'; N = 'DLSSModelUI'; V = 'CNN' } @{ G = 'IMG'; M = 'Set'; N = 'ModelQuality'; V = 'Low Quality' } @{ G = 'IMG'; M = 'Lower'; N = 'TerrainQuality'; V = 'Low' } @{ G = 'IMG'; M = 'Lower'; N = 'ShadowQuality'; V = 'Low' } ) } function CodGameRunning { return (@(Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -match $CodProc }).Count -gt 0) } function CodFiles { if (-not (Test-Path -LiteralPath $CodDir)) { return @() } return @(Get-ChildItem -LiteralPath $CodDir -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -match '^s\.1\.0\.cod\d+\.txt[01]?$' } | Sort-Object LastWriteTime) } function CodIsNum ($s) { $d = 0.0 return [double]::TryParse([string]$s, [Globalization.NumberStyles]::Float, [Globalization.CultureInfo]::InvariantCulture, [ref]$d) } function CodNum ($s) { return [double]::Parse([string]$s, [Globalization.NumberStyles]::Float, [Globalization.CultureInfo]::InvariantCulture) } # le o comentario da linha: "one of a, b, c" / "min to max" function CodParseComment ($cm) { $r = @{ Kind = 'none'; List = @(); Min = 0.0; Max = 0.0 } if (-not $cm) { return $r } $t = ($cm -replace '^\s*//\s*', '').Trim() if ($t -match '^one of (.+)$') { $items = @() foreach ($p in ($Matches[1] -split ',')) { $q = $p.Trim(); if ($q -ne '') { $items += $q } } $r.Kind = 'list'; $r.List = $items return $r } if ($t -match '^(-?\d+(?:\.\d+)?)\s+to\s+(-?\d+(?:\.\d+)?)$') { $r.Kind = 'range'; $r.Min = CodNum $Matches[1]; $r.Max = CodNum $Matches[2] } return $r } # decide o que fazer com uma linha: changed / same / ignored function CodDecide ($mode, $new, $cur, $c) { $inv = [Globalization.CultureInfo]::InvariantCulture $newOut = $new $idxNew = -1 if ($c.Kind -eq 'list') { for ($i = 0; $i -lt $c.List.Count; $i++) { if ($c.List[$i] -ieq $new) { $idxNew = $i; break } } if ($idxNew -lt 0) { return @{ Status = 'ignored'; Why = ("valor '" + $new + "' nao esta na lista do jogo") } } $newOut = $c.List[$idxNew] } elseif ($c.Kind -eq 'range') { if (-not (CodIsNum $new)) { return @{ Status = 'ignored'; Why = 'valor novo nao e numero' } } $nv0 = CodNum $new if ($nv0 -lt $c.Min -or $nv0 -gt $c.Max) { return @{ Status = 'ignored'; Why = ('valor ' + $new + ' fora da faixa ' + $c.Min.ToString($inv) + ' a ' + $c.Max.ToString($inv)) } } } # numerico (sem lista): mantem as casas decimais do valor atual if ($c.Kind -ne 'list' -and (CodIsNum $new) -and (CodIsNum $cur)) { $dec = 0 if ($cur -match '^\s*-?\d+\.(\d+)\s*$') { $dec = $Matches[1].Length } $nv = CodNum $new $cv = CodNum $cur $newOut = $nv.ToString('F' + $dec, $inv) if ($cv -eq $nv) { return @{ Status = 'same'; New = $newOut } } if ($mode -eq 'Lower' -and $cv -lt $nv) { return @{ Status = 'same'; New = $newOut } } return @{ Status = 'changed'; New = $newOut } } if ($c.Kind -eq 'list') { $idxCur = -1 for ($i = 0; $i -lt $c.List.Count; $i++) { if ($c.List[$i] -ieq $cur) { $idxCur = $i; break } } if ($mode -eq 'Lower') { if ($idxCur -lt 0) { return @{ Status = 'ignored'; Why = ("valor atual '" + $cur + "' fora da lista, nao da pra comparar") } } if ($idxCur -le $idxNew) { return @{ Status = 'same'; New = $newOut } } return @{ Status = 'changed'; New = $newOut } } if ($idxCur -eq $idxNew) { return @{ Status = 'same'; New = $newOut } } return @{ Status = 'changed'; New = $newOut } } if ($mode -eq 'Lower') { return @{ Status = 'ignored'; Why = 'sem lista nem faixa, nao da pra comparar a qualidade' } } if ($cur -ieq $newOut) { return @{ Status = 'same'; New = $newOut } } return @{ Status = 'changed'; New = $newOut } } # aplica a lista de ajustes num texto; preserva LF/CRLF, comentario e o "@..." function CodProcessText ($text, $tweaks) { $lines = $text.Split([char]10) $report = @() foreach ($t in $tweaks) { $rx = New-Object System.Text.RegularExpressions.Regex(('^(?
' + [regex]::Escape($t.N) + '@\d+;\d+;\d+ = )(?