Created
November 26, 2021 09:06
-
-
Save a-sync/ff97e5580d766cdf0c935b4c6fc1fb7f to your computer and use it in GitHub Desktop.
Revisions
-
a-sync created this gist
Nov 26, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ @echo off rem # OFCRA local mod downloader / updater rem # Parses Arma 3 launcher preset files in the current folder and attempts rem # to download and unpack non workshop mods from the OFCRA mod repository. rem # https://ofcrav2.org/index.php?page=repository-en rem # rem # Usage: rem # 1. Create a folder for your local mods and place this script and the rem # Arma 3 launcher preset file in there rem # 2. Run the script and let it download and unpack the non workshop mods rem # 3. Open the Arma 3 launcher and load each unpacked folder as `Local mod` rem # 4. Import the preset file in the Arma 3 launcher powershell.exe -ExecutionPolicy Bypass -NoLogo -Noninteractive -NoProfile -Command "$ProgressPreference='SilentlyContinue';$mods='|';Get-ChildItem '*.html'|Foreach-Object{Write-Host 'Parsing'$_.name -ForegroundColor Red;ForEach($i in Get-Content -Path $_.name -Delimiter ' data-meta=""local:'|Select-Object -Skip 1){if($i -match '^(.+)\|(.+)\|.*' -and $mods -notlike '*|'+$matches[2]+'|*'){$mods+=$matches[2]+'|';$f=$matches[2]+'.zip';$p=$pwd,$f -Join '\';Write-Host ' Downloading'$f;(New-Object Net.WebClient).DownloadFile('https://www.ofcrav2.org/mods/'+$f,$p);Write-Host ' Extracting'$f;Expand-Archive -LiteralPath $p -DestinationPath $pwd -Force;Remove-Item $p;}else{Write-Host ' Skipping'$matches[2];}}}" pause This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # OFCRA local mod downloader / updater # Parses Arma 3 launcher preset files in the current folder and attempts # to download and unpack non workshop mods from the OFCRA mod repository. # https://ofcrav2.org/index.php?page=repository-en # # Usage: # 1. Create a folder for your local mods and place this script and the # Arma 3 launcher preset file in there # 2. Run the script and let it download and unpack the non workshop mods # 3. Open the Arma 3 launcher and load each unpacked folder as `Local mod` # 4. Import the preset file in the Arma 3 launcher $ProgressPreference = 'SilentlyContinue'; $mods = '|'; Get-ChildItem '*.html' | Foreach-Object { Write-Host 'Parsing'$_.name -ForegroundColor Red; ForEach ($i in Get-Content -Path $_.name -Delimiter ' data-meta="local:' | Select-Object -Skip 1) { if ($i -match '^(.+)\|(.+)\|.*' -and $mods -notlike '*|' + $matches[2] + '|*') { $mods += $matches[2] + '|'; $f = $matches[2] + '.zip'; $p = $pwd,$f -Join '\'; Write-Host ' Downloading'$f; (New-Object Net.WebClient).DownloadFile('https://www.ofcrav2.org/mods/' + $f, $p); Write-Host ' Extracting'$f; Expand-Archive -LiteralPath $p -DestinationPath $pwd -Force; Remove-Item $p; } else { Write-Host ' Skipping'$matches[2]; } } }