From b91579f15c8e28569fd9a6f7e2a4dd40bb17ad29 Mon Sep 17 00:00:00 2001 From: Yuuki Chan Date: Mon, 8 Jan 2024 00:24:04 +0900 Subject: [PATCH] Recreated script with PowerShell Studio. --- Catbox Downloader.psproj | 13 ++++++ Catbox Downloader.psprojs | 9 ++++ Startup.pss | 39 +++++++++++++++++ downloader.ps1 | 90 +++++++++++++++++++++++++-------------- 4 files changed, 119 insertions(+), 32 deletions(-) create mode 100644 Catbox Downloader.psproj create mode 100644 Catbox Downloader.psprojs create mode 100644 Startup.pss diff --git a/Catbox Downloader.psproj b/Catbox Downloader.psproj new file mode 100644 index 0000000..941fa55 --- /dev/null +++ b/Catbox Downloader.psproj @@ -0,0 +1,13 @@ + + 2.1 + 4b427747-6996-4cf3-bcf3-82b77f05a70b + 0 + True + Local Machine - PowerShell V7 (64 Bit) + + + Startup.pss + downloaderx.ps1 + downloader.ps1 + + \ No newline at end of file diff --git a/Catbox Downloader.psprojs b/Catbox Downloader.psprojs new file mode 100644 index 0000000..9d25784 --- /dev/null +++ b/Catbox Downloader.psprojs @@ -0,0 +1,9 @@ + + 1.0 + 4b427747-6996-4cf3-bcf3-82b77f05a70b + + + downloader.ps1 + Startup.pss + + \ No newline at end of file diff --git a/Startup.pss b/Startup.pss new file mode 100644 index 0000000..2064e53 --- /dev/null +++ b/Startup.pss @@ -0,0 +1,39 @@ + + + + Param ([String]$Commandline) + + #-------------------------------------------------------------------------- + #TODO: Add initialization script here (Load modules and check requirements) + + Add-Type -AssemblyName "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" + [void][System.Windows.Forms.MessageBox]::Show('TODO: Add script to the Main function of Startup.pss', 'TODO') + + #-------------------------------------------------------------------------- + + + + $script:ExitCode = 0 #Set the exit code for the Packager +} + + + +]]> + \ No newline at end of file diff --git a/downloader.ps1 b/downloader.ps1 index 26c08c4..7fa4fa2 100644 --- a/downloader.ps1 +++ b/downloader.ps1 @@ -1,38 +1,64 @@ -# Catbox Downloader Script by Yuuki -# © https://raiza.dev/ - 2024-20XX +#Requires -Version 7 +<# + .NOTES + =========================================================================== + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2023 v5.8.227 + Created on: 2024/01/08 12:09:49 AM + Created by: yuuki + Organization: + Filename: downloader.ps1 + =========================================================================== + .DESCRIPTION + Downloader for my Catbox game uploads. +#> -Get-ChildItem "./" -Filter "y2k12-*.txt" | -Foreach-Object { - $index = 0 - $fileNames = @() - $content = Get-Content $_.FullName - $links = "" - ForEach ($line in $($content -split "`r`n")) +class Catbox { + Catbox() { - If ($line.StartsWith("mv ")) { - $f = $line.Substring($line.IndexOf('y2k12-')) - - $fileNames += $f + } + + [void]Download() + { + Get-ChildItem -Path "./" -Filter "y2k12-*.txt" | + Foreach-Object { + $index = 0 + $fileNames = @() + $content = Get-Content $_.FullName + $links = "" + + ForEach ($line in $($content -Split "`r`n")) + { + If ($line.StartsWith("mv ")) + { + $f = $line.Substring($line.IndexOf('y2k12-')) + + $fileNames += $f + } + } + + ForEach ($line in $($content -Split "`r`n")) + { + If ($line.StartsWith("https://files.catbox.moe/")) + { + $f = $line.Substring($line.IndexOf(".moe/") + 5) + + If ([System.IO.File]::Exists($fileNames[$index])) + { + Write-Host "File already downloaded." + } + Else + { + Write-Host "Downloading" $fileNames[$index] "(" $line ")" + Invoke-WebRequest -Uri $line -OutFile $fileNames[$index] + } + + $index += 1 + } + } } } +} - ForEach ($line in $($content -split "`r`n")) - { - If ($line.StartsWith("https://files.catbox.moe/")) - { - $f = $line.Substring($line.IndexOf(".moe/") + 5) - - If ([System.IO.File]::Exists($fileNames[$index])) - { - Write-Host "File already downloaded." - } - Else - { - Write-Host "Downloading" $fileNames[$index] "(" $line ")" - Invoke-WebRequest -Uri $line -OutFile $fileNames[$index] - } - $index += 1 - } - } -} \ No newline at end of file +$catbox = [Catbox]::new() +$catbox.Download()