Recreated script with PowerShell Studio.

This commit is contained in:
Yuuki Chan 2024-01-08 00:24:04 +09:00
parent 347cb27a1e
commit b91579f15c
4 changed files with 119 additions and 32 deletions

13
Catbox Downloader.psproj Normal file
View file

@ -0,0 +1,13 @@
<Project Synchronized="False" SyncFilter="*.ps1;*.psm1;*.psd1;*.ps1xml;*.psf;*.pss;*.xml;*.help.txt">
<Version>2.1</Version>
<FileID>4b427747-6996-4cf3-bcf3-82b77f05a70b</FileID>
<ProjectType>0</ProjectType>
<RememberPowerShellVersion>True</RememberPowerShellVersion>
<PowerShellVersion>Local Machine - PowerShell V7 (64 Bit)</PowerShellVersion>
<Folders />
<Files>
<File Build="0">Startup.pss</File>
<File Build="0" Shared="False" ReferenceFunction="Invoke-downloaderx_ps1">downloaderx.ps1</File>
<File Build="0" Shared="False" ReferenceFunction="Invoke-downloader_ps1">downloader.ps1</File>
</Files>
</Project>

View file

@ -0,0 +1,9 @@
<ProjectState>
<Version>1.0</Version>
<FileID>4b427747-6996-4cf3-bcf3-82b77f05a70b</FileID>
<OpenFolders />
<OpenFiles>
<File>downloader.ps1</File>
<File>Startup.pss</File>
</OpenFiles>
</ProjectState>

39
Startup.pss Normal file
View file

@ -0,0 +1,39 @@
<File version="3.1">
<Code>
<![CDATA[#Define a Param block to use custom parameters in the project
#Param ($CustomParameter)
function Main {
<#
.SYNOPSIS
The Main function starts the project application.
.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.
.NOTES
Use this function to initialize your script and to call GUI forms.
.NOTES
To get the console output in the Packager (Forms Engine) use:
$ConsoleOutput (Type: System.Collections.ArrayList)
#>
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
}
]]></Code>
</File>

View file

@ -1,23 +1,43 @@
# Catbox Downloader Script by Yuuki #Requires -Version 7
# © https://raiza.dev/ - 2024-20XX <#
.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" |
class Catbox {
Catbox()
{
}
[void]Download()
{
Get-ChildItem -Path "./" -Filter "y2k12-*.txt" |
Foreach-Object { Foreach-Object {
$index = 0 $index = 0
$fileNames = @() $fileNames = @()
$content = Get-Content $_.FullName $content = Get-Content $_.FullName
$links = "" $links = ""
ForEach ($line in $($content -split "`r`n")) ForEach ($line in $($content -Split "`r`n"))
{
If ($line.StartsWith("mv "))
{ {
If ($line.StartsWith("mv ")) {
$f = $line.Substring($line.IndexOf('y2k12-')) $f = $line.Substring($line.IndexOf('y2k12-'))
$fileNames += $f $fileNames += $f
} }
} }
ForEach ($line in $($content -split "`r`n")) ForEach ($line in $($content -Split "`r`n"))
{ {
If ($line.StartsWith("https://files.catbox.moe/")) If ($line.StartsWith("https://files.catbox.moe/"))
{ {
@ -32,7 +52,13 @@ Foreach-Object {
Write-Host "Downloading" $fileNames[$index] "(" $line ")" Write-Host "Downloading" $fileNames[$index] "(" $line ")"
Invoke-WebRequest -Uri $line -OutFile $fileNames[$index] Invoke-WebRequest -Uri $line -OutFile $fileNames[$index]
} }
$index += 1 $index += 1
} }
} }
} }
}
}
$catbox = [Catbox]::new()
$catbox.Download()