52 lines
1.4 KiB
PowerShell
52 lines
1.4 KiB
PowerShell
<#
|
|
.PARAMETER editorId
|
|
to filter by editorId
|
|
|
|
.PARAMETER formId
|
|
to filter by formId
|
|
|
|
.PARAMETER all
|
|
to list all records
|
|
|
|
.PARAMETER slotAsArray
|
|
convert slot field to array
|
|
|
|
.PARAMETER splitBySlot
|
|
split records by slot
|
|
|
|
.EXAMPLE
|
|
PS> .\get-armor.ps1 -editorId EnchArmorImperialLightGauntletsMarksman03
|
|
|
|
.EXAMPLE
|
|
PS> .\get-armor.ps1 -formId 000B9745
|
|
#>
|
|
param([string]$editorId, [string]$formId, [switch]$slotAsArray, [switch]$splitBySlot)
|
|
#editorId or formId to filter
|
|
|
|
#usage:
|
|
## .\get-armor.ps1 -editorId EnchArmorImperialLightGauntletsMarksman03
|
|
## .\get-armor.ps1 -formId 000B9745
|
|
$csvDir=(Join-Path $PSScriptRoot ..)
|
|
$csvFile="ArmorExport-Armor.csv"
|
|
if($splitBySlot) {
|
|
$csvFile="ArmorExport-Armor-Slot.csv"
|
|
}
|
|
if($editorId -or $formId) {
|
|
Get-Content (Join-Path $csvDir $csvFile)|ConvertFrom-Csv -Delimiter ';' `
|
|
|where-object { ($editorId -and $_.EditorID -eq $editorId) -or ($formId -and $_.FormID -eq $formId)} `
|
|
|foreach-object {
|
|
$_.Keywords = $_.Keywords -Split ',';
|
|
$_.ArmorAddon = $_.ArmorAddon -Split ',';
|
|
if($slotAsArray -and !$splitBySlot) { $_.Slot = ($_.Slot -Split ','); }
|
|
$_
|
|
}
|
|
} else {
|
|
Get-Content (Join-Path $csvDir $csvFile)|ConvertFrom-Csv -Delimiter ';' `
|
|
|foreach-object {
|
|
$_.Keywords = $_.Keywords -Split ',';
|
|
$_.ArmorAddon = $_.ArmorAddon -Split ',';
|
|
if($slotAsArray -and !$splitBySlot) { $_.Slot = ($_.Slot -Split ','); }
|
|
$_
|
|
}
|
|
}
|