Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get-FileName($initialDirectory)
- {
- [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
- #(*.bmp, *.jpg)|*.bmp;*.jpg
- $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- $OpenFileDialog.initialDirectory = $initialDirectory
- $OpenFileDialog.filter = "List (*.txt)| *.txt|ALL Files (*.*)| *.*"
- $OpenFileDialog.ShowDialog() | Out-Null
- $OpenFileDialog.filename
- }
- function GetNextID($maxSize = 5)
- {
- $g = [guid]::NewGuid()
- $v = [string]$g
- $v = $v.Replace("-", "")
- return $v.substring(0, $maxSize)
- }
- function Delete-MapData
- {
- Param ([string]$location,[string]$chunk)
- $map = ([string]::Format("{0}\map_{1}.bin",$location,$chunk))
- $datachunk = ([string]::Format("{0}\isoregiondata\datachunk_{1}.bin",$location,$chunk))
- if(Test-Path -Path $map -PathType Leaf)
- {
- Write-Host "REMOVING " $map
- Remove-Item $map
- }
- if(Test-Path -Path $datachunk -PathType Leaf)
- {
- Write-Host "REMOVING " $datachunk
- Remove-Item $datachunk
- }
- }
- try {
- # Get Input
- $here = (Get-Location).Path
- $filename = Get-FileName($here)
- $rootfolder = "<PATHTO>\Zomboid\Saves\Multiplayer\servertest"
- $content = get-content ($filename)
- foreach ($line in $content)
- {
- Delete-MapData -location $rootfolder -chunk $line
- }
- } catch {
- write-host "No input given."
- exit 0
- }
Advertisement
Add Comment
Please, Sign In to add comment