diff --git a/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 b/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 new file mode 100644 index 0000000..3d3e10a --- /dev/null +++ b/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 @@ -0,0 +1,16 @@ +$appId = 1091500 +$networkLocation = "https://raw.githubusercontent.com/IsaacShoebottom/Scripts/master/SteamToggleUpdate/ToggleUpdates.ps1" + +# Test if ToggleUpdates.ps1 exists and invoke it if it does +If (Test-Path -Path ".\ToggleUpdates.ps1" -PathType Leaf) { + .\ToggleUpdates.ps1 $appId +} +Else { + # Download the network script + $wc = New-Object System.Net.WebClient + $wc.DownloadFile($networkLocation, ".\ToggleUpdates.ps1") + # Invoke the network script + .\ToggleUpdates.ps1 $appId + # Delete the network script + Remove-Item -Path ".\ToggleUpdates.ps1" +} \ No newline at end of file diff --git a/CyberpunkAutoupdate/CyberpunkUpdate.ps1 b/SteamToggleUpdate/ToggleUpdates.ps1 similarity index 70% rename from CyberpunkAutoupdate/CyberpunkUpdate.ps1 rename to SteamToggleUpdate/ToggleUpdates.ps1 index 2a49c78..dddd541 100644 --- a/CyberpunkAutoupdate/CyberpunkUpdate.ps1 +++ b/SteamToggleUpdate/ToggleUpdates.ps1 @@ -45,16 +45,20 @@ function parseVDFforPath([int]$appId) { } } } -$Manifest = parseVDFforPath(1091500) -# Get the read only attribute -$ReadOnly = (Get-Item $Manifest).IsReadOnly +# function that changes the read only attribute of the manifest file +function toggleUpdate($Manifest) { + # Get the read only attribute + $ReadOnly = (Get-Item $Manifest).IsReadOnly -# If the file is read only, remove the read only attribute, If the file is not read only, set the read only attribute -If ($ReadOnly) {Set-ItemProperty $Manifest -Name IsReadOnly -Value $false} Else {Set-ItemProperty $Manifest -Name IsReadOnly -Value $true} + # If the file is read only, remove the read only attribute, If the file is not read only, set the read only attribute + If ($ReadOnly) { Set-ItemProperty $Manifest -Name IsReadOnly -Value $false } Else { Set-ItemProperty $Manifest -Name IsReadOnly -Value $true } -# Display the read only attribute for reference -Write-Host "Manifest file's read only attribute is now $((Get-Item $Manifest).IsReadOnly)" + # Display the read only attribute for reference + Write-Host "Manifest file's read only attribute is now $((Get-Item $Manifest).IsReadOnly)" -# Pause the script to see the output -Read-Host -Prompt "Press Enter to exit" \ No newline at end of file + # Pause the script to see the output + Read-Host -Prompt "Press Enter to exit" +} + +toggleUpdate(parseVDFforPath($args[0])) \ No newline at end of file