Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/auto-format-code #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Loader.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cls
Write-Host -foregroundcolor red "
Write-Host -foregroundcolor red "
((//////
#######//////
##########(/////.
Expand Down Expand Up @@ -54,11 +54,11 @@
"
Write-Output "Setting up Environment"
$path = [Environment]::GetFolderPath("Desktop")
if((Test-Path -Path $path\ParsecTemp ) -eq $true){
}
if ((Test-Path -Path $path\ParsecTemp ) -eq $true) {
}
Else {
New-Item -Path $path\ParsecTemp -ItemType directory| Out-Null
}
New-Item -Path $path\ParsecTemp -ItemType directory | Out-Null
}

Unblock-File -Path .\*
copy-Item .\* -Destination $path\ParsecTemp\ -Force -Recurse | Out-Null
Expand Down
459 changes: 229 additions & 230 deletions PostInstall/PostInstall.ps1

Large diffs are not rendered by default.

123 changes: 62 additions & 61 deletions PreInstall/Automatic-Shutdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,94 +43,95 @@ namespace PInvoke.Win32 {
'@
function AutomaticShutdown {

Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Windows.Forms

[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object System.Windows.Forms.Form
$label000000 = New-Object System.Windows.Forms.Label
$timer1 = New-Object System.Windows.Forms.Timer
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object System.Windows.Forms.Form
$label000000 = New-Object System.Windows.Forms.Label
$timer1 = New-Object System.Windows.Forms.Timer
$button = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState



$form1_Load = {
$script:countdown = [timespan]'00:10:00' # 10 minutes
$label000000.Text = "$countdown"
$timer1.Start()
$form1_Load = {
$script:countdown = [timespan]'00:10:00' # 10 minutes
$label000000.Text = "$countdown"
$timer1.Start()

}
}

$button_logic = {
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -windowstyle hidden -file $ENV:ProgramData\Automatic-Shutdown.ps1"
$form1.Close()
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -windowstyle hidden -file $ENV:ProgramData\Automatic-Shutdown.ps1"
$form1.Close()
}

$timer1_Tick = {
if ($countdown -lt [timespan]'00:00:02') {$timer1.Stop()
Stop-Computer
$timer1_Tick = {
if ($countdown -lt [timespan]'00:00:02') {
$timer1.Stop()
Stop-Computer
}
Else{}
$script:countdown -= [timespan]'00:00:01'
$label000000.Text = "$countdown"
Else {}
$script:countdown -= [timespan]'00:00:01'
$label000000.Text = "$countdown"

}
}

$Form_StateCorrection_Load =
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_StateCorrection_Load =
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}


$form1.SuspendLayout()
$form1.SuspendLayout()
$form1.BringToFront()
$Form1.ControlBox = $False
$form1.Controls.Add($label000000)
$form1.AutoScaleDimensions = '8, 17'
$form1.AutoScaleMode = 'Font'
$form1.BackColor = 'ActiveCaption'
$form1.ClientSize = '400, 200'
$form1.FormBorderStyle = 'Fixed3D'
$form1.Name = 'form1'
$form1.StartPosition = 'CenterScreen'
$form1.Text = 'Automatic Shutdown On Idle'
$form1.add_Load($form1_Load)

$Button.Location = New-Object System.Drawing.Size(75,75)
$Button.Size = New-Object System.Drawing.Size(150,23)
$form1.Controls.Add($label000000)
$form1.AutoScaleDimensions = '8, 17'
$form1.AutoScaleMode = 'Font'
$form1.BackColor = 'ActiveCaption'
$form1.ClientSize = '400, 200'
$form1.FormBorderStyle = 'Fixed3D'
$form1.Name = 'form1'
$form1.StartPosition = 'CenterScreen'
$form1.Text = 'Automatic Shutdown On Idle'
$form1.add_Load($form1_Load)

$Button.Location = New-Object System.Drawing.Size(75, 75)
$Button.Size = New-Object System.Drawing.Size(150, 23)
$Button.Text = "Cancel Shutdown"
$button.Add_click($button_logic)


$label000000.AutoSize = $True
$label000000.Font = 'Lucida Fax, 24pt, style=Bold'
$label000000.Location = '90, 25'
$label000000.Margin = '4, 0, 4, 0'
$label000000.Name = 'label000000'
$label000000.Size = '200, 46'
$label000000.TabIndex = 0
$label000000.Text = '00:00:00'
$label000000.AutoSize = $True
$label000000.Font = 'Lucida Fax, 24pt, style=Bold'
$label000000.Location = '90, 25'
$label000000.Margin = '4, 0, 4, 0'
$label000000.Name = 'label000000'
$label000000.Size = '200, 46'
$label000000.TabIndex = 0
$label000000.Text = '00:00:00'

$timer1.Interval = 1000
$timer1.add_Tick($timer1_Tick)
$form1.ResumeLayout()
$timer1.Interval = 1000
$timer1.add_Tick($timer1_Tick)
$form1.ResumeLayout()

$InitialFormWindowState = $form1.WindowState
$form1.add_Load($Form_StateCorrection_Load)
$InitialFormWindowState = $form1.WindowState
$form1.add_Load($Form_StateCorrection_Load)
$Form1.Controls.Add($Button)
return $form1.ShowDialog()
return $form1.ShowDialog()
}

function idle {
$readfile = (Get-Content -Path $env:ProgramData\Autoshutdown.txt) - 10
do {
[PInvoke.Win32.UserInput]::LastInput | Out-Null
[PInvoke.Win32.UserInput]::IdleTime | Out-Null
Start-Sleep -Seconds 1
}
Until([PInvoke.Win32.UserInput]::Idletime.TotalMinutes -gt $readfile)
AutomaticShutdown
$readfile = (Get-Content -Path $env:ProgramData\Autoshutdown.txt) - 10
do {
[PInvoke.Win32.UserInput]::LastInput | Out-Null
[PInvoke.Win32.UserInput]::IdleTime | Out-Null
Start-Sleep -Seconds 1
}
Until([PInvoke.Win32.UserInput]::Idletime.TotalMinutes -gt $readfile)
AutomaticShutdown
}

idle
Loading