212 lines
No EOL
7 KiB
PowerShell
212 lines
No EOL
7 KiB
PowerShell
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.144
|
|
Created on: 30/09/2017 06:23 PM
|
|
Created by: Yuuki-chan
|
|
Organization:
|
|
Filename: Globals.ps1
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
A description of the file.
|
|
#>
|
|
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
|
|
[XML]$doc = (New-Object System.Net.WebClient).DownloadString("http://update.yuuki-chan.xyz/Updater.xml")
|
|
[string]$version1 = "2.0.1.0"
|
|
[string]$version2 = $doc.Updater.AudioSplitterV2.Version
|
|
[string]$downloadUrl = $doc.Updater.AudioSplitterV2.Url
|
|
$props = ConvertFrom-StringData (Get-Content .\res\config.txt -Raw)
|
|
|
|
function Unzip
|
|
{
|
|
param ([string]$zipfile, [string]$outpath) [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
|
|
}
|
|
|
|
function Get-ScriptDirectory
|
|
{
|
|
[OutputType([string])]
|
|
param ()
|
|
if ($null -ne $hostinvocation)
|
|
{
|
|
Split-Path $hostinvocation.MyCommand.path
|
|
}
|
|
else
|
|
{
|
|
Split-Path $script:MyInvocation.MyCommand.Path
|
|
}
|
|
}
|
|
|
|
[string]$ScriptDirectory = Get-ScriptDirectory
|
|
[Console]::WriteLine("Don't worry about this error above, it doesn't mean anything bad.")
|
|
|
|
function about
|
|
{
|
|
$pictureBox1 = New-Object System.Windows.Forms.PictureBox
|
|
$pictureBox1.ImageLocation = "res/yuki.gif"
|
|
$pictureBox1.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::StretchImage
|
|
$pictureBox1.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
|
|
$pictureBox1.Size = New-Object System.Drawing.Size(570, 405)
|
|
$pictureBox1.Location = New-Object System.Drawing.Point(3, 3)
|
|
|
|
$label1 = New-Object System.Windows.Forms.Label
|
|
$label1.Text = "Original tool by:"
|
|
$label1.AutoSize = $true
|
|
$label1.Location = New-Object System.Drawing.Point(16, 413)
|
|
|
|
$label2 = New-Object System.Windows.Forms.Label
|
|
$label2.Text = "GUI design by:"
|
|
$label2.AutoSize = $true
|
|
$label2.Location = New-Object System.Drawing.Point(23, 443)
|
|
|
|
$label3 = New-Object System.Windows.Forms.Label
|
|
$label3.Text = "Special thanks to:"
|
|
$label3.AutoSize = $true
|
|
$label3.Location = New-Object System.Drawing.Point(0, 473)
|
|
|
|
$label4 = New-Object System.Windows.Forms.Label
|
|
$label4.Text = "PowerShell code:"
|
|
$label4.AutoSize = $true
|
|
$label4.Location = New-Object System.Drawing.Point(3, 502)
|
|
|
|
$label5 = New-Object System.Windows.Forms.Label
|
|
$label5.Text = "(v1.0.0.1)"
|
|
$label5.AutoSize = $true
|
|
$label5.Location = New-Object System.Drawing.Point(341, 443)
|
|
|
|
$linkLabel1 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel1.Text = "RiCON"
|
|
$linkLabel1.AutoSize = $true
|
|
$linkLabel1.Location = New-Object System.Drawing.Point(152, 413)
|
|
$linkLabel1.Add_Click({
|
|
[System.Diagnostics.Process]::Start("https://forum.doom9.org/member.php?u=48461")
|
|
})
|
|
|
|
$linkLabel2 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel2.Text = "VFR Chapter Creator 0.9"
|
|
$linkLabel2.AutoSize = $true
|
|
$linkLabel2.Location = New-Object System.Drawing.Point(276, 413)
|
|
$linklabel2.Add_Click({
|
|
[System.Diagnostics.Process]::Start("https://forum.doom9.org/showthread.php?t=154535")
|
|
})
|
|
|
|
$linkLabel3 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel3.Text = "Yuuki-chan"
|
|
$linkLabel3.AutoSize = $true
|
|
$linkLabel3.Location = New-Object System.Drawing.Point(152, 443)
|
|
$linkLabel3.Add_Click({
|
|
[System.Diagnostics.Process]::Start("https://yuuki-chan.xyz/")
|
|
})
|
|
|
|
$linkLabel4 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel4.Text = "[1001]"
|
|
$linkLabel4.AutoSize = $true
|
|
$linkLabel4.Location = New-Object System.Drawing.Point(276, 443)
|
|
$linkLabel4.Add_Click({
|
|
[System.Diagnostics.Process]::Start("https://yuuki-chan.xyz/")
|
|
})
|
|
|
|
$linkLabel5 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel5.Text = "Gabriel Logan"
|
|
$linkLabel5.AutoSize = $true
|
|
$linkLabel5.Location = New-Object System.Drawing.Point(152, 473)
|
|
$linkLabel5.Add_Click({
|
|
[System.Diagnostics.Process]::Start("http://www.mexat.com/vb/members/608471-Gabriel-Logan")
|
|
})
|
|
|
|
$linkLabel6 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel6.Text = "AmjadSONY"
|
|
$linkLabel6.AutoSize = $true
|
|
$linkLabel6.Location = New-Object System.Drawing.Point(276, 473)
|
|
$linkLabel6.Add_Click({
|
|
[System.Diagnostics.Process]::Start("http://www.mexat.com/vb/members/574111-%D8%A7%D9%85%D8%AC%D8%AF-%D8%B5%D9%84%D8%A7%D8%AD")
|
|
})
|
|
|
|
$linkLabel7 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel7.Text = "Intelligent"
|
|
$linkLabel7.AutoSize = $true
|
|
$linkLabel7.Location = New-Object System.Drawing.Point(399, 473)
|
|
$linkLabel7.Add_Click({
|
|
[System.Diagnostics.Process]::Start("http://www.mexat.com/vb/members/685155-Intelligent")
|
|
})
|
|
|
|
$linkLabel8 = New-Object System.Windows.Forms.LinkLabel
|
|
$linkLabel8.Text = "Yuuki-chan"
|
|
$linkLabel8.AutoSize = $true
|
|
$linkLabel8.Location = New-Object System.Drawing.Point(152, 502)
|
|
$linkLabel8.Add_Click({
|
|
[System.Diagnostics.Process]::Start("https://yuuki-chan.xyz/")
|
|
})
|
|
|
|
$button1 = New-Object System.Windows.Forms.Button
|
|
$button1.Text = "OK"
|
|
$button1.Location = New-Object System.Drawing.Point(225, 527)
|
|
$button1.Size = New-Object System.Drawing.Size(125, 35)
|
|
$button1.Add_Click({
|
|
$about.Close()
|
|
})
|
|
|
|
$about = New-Object System.Windows.Forms.Form
|
|
$about.Text = "About"
|
|
$about.MaximizeBox = $false
|
|
$about.MinimizeBox = $false
|
|
$about.Size = New-Object System.Drawing.Size(592, 623)
|
|
$about.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle
|
|
$about.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon(".\res\AS.ico")
|
|
$about.Controls.Add($pictureBox1)
|
|
$about.Controls.Add($label1)
|
|
$about.Controls.Add($label2)
|
|
$about.Controls.Add($label3)
|
|
$about.Controls.Add($label4)
|
|
$about.Controls.Add($label5)
|
|
$about.Controls.Add($linkLabel1)
|
|
$about.Controls.Add($linkLabel2)
|
|
$about.Controls.Add($linkLabel3)
|
|
$about.Controls.Add($linkLabel4)
|
|
$about.Controls.Add($linkLabel5)
|
|
$about.Controls.Add($linkLabel6)
|
|
$about.Controls.Add($linkLabel7)
|
|
$about.Controls.Add($linkLabel8)
|
|
$about.Controls.Add($button1)
|
|
$about.Select()
|
|
$about.ShowDialog()
|
|
}
|
|
|
|
function checkForUpdate
|
|
{
|
|
if ($version1 -eq $version2)
|
|
{
|
|
$msgBox = [System.Windows.Forms.MessageBox]::Show("You already have the latest version installed.", "Information", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
$WC = New-Object System.Net.WebClient
|
|
$WC.DownloadFile($downloadUrl, $version2 + ".zip");
|
|
# Unzip($version2 + ".zip", "")
|
|
}
|
|
catch
|
|
{
|
|
$em = $_.Exception.Message
|
|
$msgBox = [System.Windows.Forms.MessageBox]::Show($em, "Information", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
|
}
|
|
}
|
|
}
|
|
|
|
function forceUpdate
|
|
{
|
|
try
|
|
{
|
|
$WC = New-Object System.Net.WebClient
|
|
$WC.DownloadFile($downloadUrl, $version2 + ".zip");
|
|
# Unzip($version2 + ".zip", "")
|
|
}
|
|
catch
|
|
{
|
|
$em = $_.Exception.Message
|
|
$msgBox = [System.Windows.Forms.MessageBox]::Show($em, "Information", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
|
}
|
|
} |