-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path50-50.ps1
More file actions
117 lines (98 loc) · 4.13 KB
/
50-50.ps1
File metadata and controls
117 lines (98 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# GUI Setup
$form = New-Object System.Windows.Forms.Form
$form.Text = "50-50: The Sims 4 Mod Detective 🕵️♂️"
$form.Size = New-Object System.Drawing.Size(500,400)
$form.StartPosition = "CenterScreen"
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(10,20)
$label.Size = New-Object System.Drawing.Size(480,40)
$label.Text = "Welcome to the Sims 4 Mod Detective! Let's crack this case wide open! 🔍"
$form.Controls.Add($label)
$progressBar = New-Object System.Windows.Forms.ProgressBar
$progressBar.Location = New-Object System.Drawing.Point(10,70)
$progressBar.Size = New-Object System.Drawing.Size(460,30)
$form.Controls.Add($progressBar)
$statusLabel = New-Object System.Windows.Forms.Label
$statusLabel.Location = New-Object System.Drawing.Point(10,110)
$statusLabel.Size = New-Object System.Drawing.Size(480,40)
$form.Controls.Add($statusLabel)
$button = New-Object System.Windows.Forms.Button
$button.Location = New-Object System.Drawing.Point(10,160)
$button.Size = New-Object System.Drawing.Size(460,30)
$button.Text = "Let's solve this mystery!"
$form.Controls.Add($button)
# Functions
function Update-Status {
param ([string]$status)
$statusLabel.Text = $status
$form.Refresh()
}
function Get-AllMods {
param ([string]$Directory)
return Get-ChildItem -Path $Directory -Recurse -File | ForEach-Object {
@{
FullName = $_.FullName
IsEnabled = -not $_.Name.EndsWith('.disabled')
LastWriteTime = $_.LastWriteTime
InProblemSet = $true
}
} | Sort-Object { $_.LastWriteTime }
}
function Toggle-ModState {
param ([hashtable]$Mod)
$newName = if ($Mod.IsEnabled) {
"$($Mod.FullName).disabled"
} else {
$Mod.FullName -replace '\.disabled$', ''
}
Rename-Item -LiteralPath $Mod.FullName -NewName $newName -ErrorAction SilentlyContinue
if ($?) {
$Mod.FullName = $newName
$Mod.IsEnabled = -not $Mod.IsEnabled
}
}
# Main Script Logic
$button.Add_Click({
$directory = [System.Windows.Forms.FolderBrowserDialog]::new()
$directory.Description = "Select your Sims 4 mods folder"
$directory.RootFolder = "MyComputer"
if ($directory.ShowDialog() -eq "OK") {
Update-Status "Scanning for mods... 🔎"
$mods = Get-AllMods -Directory $directory.SelectedPath
$progressBar.Value = 25
Update-Status "Found $($mods.Count) mods. Time to play detective! 🕵️♂️"
$progressBar.Value = 50
$enableAll = [System.Windows.Forms.MessageBox]::Show(
"Do you want to enable all mods before we start? (Recommended for a fresh investigation!)",
"The Great Mod Enable-ation",
[System.Windows.Forms.MessageBoxButtons]::YesNo
)
if ($enableAll -eq "Yes") {
Update-Status "Enabling all mods... It's mod party time! 🎉"
$mods | Where-Object { -not $_.IsEnabled } | ForEach-Object { Toggle-ModState $_ }
}
$progressBar.Value = 75
[System.Windows.Forms.MessageBox]::Show(
"Alright, detective! Time to test your game. Come back when you're ready to continue our investigation.",
"The Game's Afoot!",
[System.Windows.Forms.MessageBoxButtons]::OK
)
$problemExists = [System.Windows.Forms.MessageBox]::Show(
"Does the problem still exist? (Yes for 'The plot thickens!', No for 'Case closed!')",
"The Mystery Continues?",
[System.Windows.Forms.MessageBoxButtons]::YesNo
)
if ($problemExists -eq "Yes") {
Update-Status "The game is on! Let's find that troublemaker mod! 🔍"
# Here you would implement the 50/50 process
# For brevity, I'm not including the entire process here
} else {
Update-Status "Case closed! Your game is running smoothly. Time for a victory dance! 💃🕺"
}
$progressBar.Value = 100
}
})
# Show the form
$form.ShowDialog()