InjectFirstVersion_Fix1

This commit is contained in:
Tyleo Dv. Delaware 2025-03-16 19:31:13 +01:00
parent 1a4acedfbc
commit bd98895057

View file

@ -1,98 +1,126 @@
Add-Type -Name Window -Namespace Console -MemberDefinition '
function Get-HotReload { [DllImport("Kernel32.dll")]
public static extern IntPtr GetConsoleWindow();
$Form.Close()
$headers = @{Authorization = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZDcwYTQ5Y2Y0MzhmZGU0NGM2ZWY4YyIsImlhdCI6MTc0MjE0NjMyNSwiZXhwIjoxNzQyMTQ2NjI1fQ.8I2KXZOjUSMVsNxKHYCimnhKlUPkv4cFrx2v5Xdx4E4"} [DllImport("user32.dll")]
$response = Invoke-RestMethod -Uri "https://app.poshgui.com/api/hotreload/winform/67d70a49cf438fde44c6ef8c" -Method Get -Headers $headers public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);'
iex $response
} [Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), 0)
<#
.NAME
Add-Type -Name Window -Namespace Console -MemberDefinition ' Ticket-Counter
[DllImport("Kernel32.dll")]
public static extern IntPtr GetConsoleWindow(); #>
[DllImport("user32.dll")] # Config
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);'
$LogDir = "$env:USERPROFILE\Documents\TicketCounter"
[Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), 0) if (!(Test-Path $LogDir)) {
New-Item -ItemType Directory "$LogDir"
<# New-Item -ItemType Directory "$LogDir\Monthly"
.NAME New-Item -ItemType Directory "$LogDir\Daily"
Ticket-Counter }
#> $TotalLogFile = "$LogDir\TicketCounter_Total.txt"
$DailyLogFile = "$LogDir\TicketCounter_Daily.txt"
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles() if (!(Test-Path $TotalLogFile)) {
Write-Output "0" | Out-File $TotalLogFile
$Form = New-Object system.Windows.Forms.Form }
$Form.ClientSize = New-Object System.Drawing.Point(241,91) if (!(Test-Path $DailyLogFile)) {
$Form.text = "Form" Write-Output "0" | Out-File $DailyLogFile
$Form.TopMost = $false }
$Label1 = New-Object system.Windows.Forms.Label [int]$CurrentMonthly = Get-Content $TotalLogFile
$Label1.text = "Month Count" [int]$CurrentDaily = Get-Content $DailyLogFile
$Label1.AutoSize = $true #########
$Label1.width = 50 Add-Type -AssemblyName System.Windows.Forms
$Label1.height = 10 [System.Windows.Forms.Application]::EnableVisualStyles()
$Label1.location = New-Object System.Drawing.Point(12,71)
$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) ## SCREEN DETECT
$ScreenPrimary = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
$Label2 = New-Object system.Windows.Forms.Label ##################
$Label2.text = "Day Count"
$Label2.AutoSize = $true $Form = New-Object system.Windows.Forms.Form
$Label2.width = 50 $Form.ClientSize = New-Object System.Drawing.Point(241,95)
$Label2.height = 10 $Form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual
$Label2.location = New-Object System.Drawing.Point(12,48) $Form.Left = $ScreenPrimary.Left
$Label2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $Form.Top = $ScreenPrimary.Height + $ScreenPrimary.Top - $Form.Height
$Form.text = "Ticket Counter"
$Button1 = New-Object system.Windows.Forms.Button $Form.TopMost = $true
$Button1.text = "button"
$Button1.width = 167 $TotalCounter = New-Object system.Windows.Forms.Label
$Button1.height = 30 $TotalCounter.text = "Total Count"
$Button1.location = New-Object System.Drawing.Point(7,7) $TotalCounter.AutoSize = $true
$Button1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $TotalCounter.width = 50
$TotalCounter.height = 10
$Button2 = New-Object system.Windows.Forms.Button $TotalCounter.location = New-Object System.Drawing.Point(12,71)
$Button2.text = "button" $TotalCounter.Font = New-Object System.Drawing.Font('Segoe UI',10)
$Button2.width = 57
$Button2.height = 30 $DailyCounter = New-Object system.Windows.Forms.Label
$Button2.location = New-Object System.Drawing.Point(178,7) $DailyCounter.text = "Day Count"
$Button2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $DailyCounter.AutoSize = $true
$DailyCounter.width = 50
$Label3 = New-Object system.Windows.Forms.Label $DailyCounter.height = 10
$Label3.text = "1" $DailyCounter.location = New-Object System.Drawing.Point(12,48)
$Label3.AutoSize = $true $DailyCounter.Font = New-Object System.Drawing.Font('Segoe UI',10)
$Label3.width = 50
$Label3.height = 10 $DailyAddTicketToCount = New-Object system.Windows.Forms.Button
$Label3.location = New-Object System.Drawing.Point(102,48) $DailyAddTicketToCount.text = "ADD TICKET"
$Label3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) $DailyAddTicketToCount.width = 167
$DailyAddTicketToCount.height = 30
$Label4 = New-Object system.Windows.Forms.Label $DailyAddTicketToCount.location = New-Object System.Drawing.Point(7,7)
$Label4.text = "0" $DailyAddTicketToCount.Font = New-Object System.Drawing.Font('Segoe UI',10)
$Label4.AutoSize = $true $DailyAddTicketToCount.Add_Click{
$Label4.width = 50 [int]$CurrentDailyCounter.text = [int]$CurrentDailyCounter.text + 1
$Label4.height = 10 Write-Output $CurrentDailyCounter.text | Out-File $DailyLogFile
$Label4.location = New-Object System.Drawing.Point(102,71) }
$Label4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$MonthlyAddDailyCountToTotal = New-Object system.Windows.Forms.Button
$hotreload = New-Object system.Windows.Forms.PictureBox $MonthlyAddDailyCountToTotal.text = "SAVE"
$hotreload.width = 60 $MonthlyAddDailyCountToTotal.width = 57
$hotreload.height = 30 $MonthlyAddDailyCountToTotal.height = 30
$hotreload.location = New-Object System.Drawing.Point(181,1) $MonthlyAddDailyCountToTotal.location = New-Object System.Drawing.Point(178,7)
$hotreload.imageLocation = "https://app.poshgui.com/images/refresh.png" $MonthlyAddDailyCountToTotal.Font = New-Object System.Drawing.Font('Segoe UI',10)
$hotreload.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::zoom $MonthlyAddDailyCountToTotal.Add_Click{
$Form.controls.AddRange(@($Label1,$Label2,$Button1,$Button2,$Label3,$Label4,$hotreload)) Copy-Item $TotalLogFile "$LogDir\Daily\DailyTickets-$(Get-Date -Format "dddd-dd-MM-yyyy_$(Get-Random)").txt"
[int]$CurrentTotalCounter.text = [int]$CurrentTotalCounter.text + [int]$CurrentDailyCounter.text
Write-Output $CurrentTotalCounter.text | Out-File $TotalLogFile
[int]$CurrentDailyCounter.text = 0
Write-Output $CurrentDailyCounter.text | Out-File $DailyLogFile
Start-Process "rundll32.exe" "user32.dll, LockWorkStation"
}
$hotreload.Add_Click({Get-HotReload})
$LogMonthlyCounterToMonthFile = New-Object system.Windows.Forms.Button
$LogMonthlyCounterToMonthFile.text = "Export Month"
$LogMonthlyCounterToMonthFile.width = 50
$LogMonthlyCounterToMonthFile.height = 30
$LogMonthlyCounterToMonthFile.location = New-Object System.Drawing.Point(185,60)
$LogMonthlyCounterToMonthFile.Font = New-Object System.Drawing.Font('Segoe UI',8)
$LogMonthlyCounterToMonthFile.Add_Click{
Copy-Item $TotalLogFile "$LogDir\Monthly\MonthTickets-$(Get-Date -Format "MMMM-yyyy_$(Get-Random)").txt"
[int]$CurrentTotalCounter.text = 0
Write-Output $CurrentTotalCounter.text | Out-File $TotalLogFile
}
$CurrentDailyCounter = New-Object system.Windows.Forms.Label
$CurrentDailyCounter.text = [int]$CurrentDaily
$CurrentDailyCounter.AutoSize = $true
$CurrentDailyCounter.width = 50
$CurrentDailyCounter.height = 10
$CurrentDailyCounter.location = New-Object System.Drawing.Point(102,48)
$CurrentDailyCounter.Font = New-Object System.Drawing.Font('Segoe UI',10)
$CurrentTotalCounter = New-Object system.Windows.Forms.Label
$CurrentTotalCounter.text = [int]$CurrentMonthly
$CurrentTotalCounter.AutoSize = $true
$CurrentTotalCounter.width = 50
$CurrentTotalCounter.height = 10
$CurrentTotalCounter.location = New-Object System.Drawing.Point(102,71)
$CurrentTotalCounter.Font = New-Object System.Drawing.Font('Segoe UI',10)
$Form.controls.AddRange(@($LogMonthlyCounterToMonthFile,$TotalCounter,$DailyCounter,$DailyAddTicketToCount,$MonthlyAddDailyCountToTotal,$CurrentDailyCounter,$CurrentTotalCounter))
[void]$Form.ShowDialog() [void]$Form.ShowDialog()