-
Notifications
You must be signed in to change notification settings - Fork 1
⚡ Optimize AutoStartManager.ahk IniRead operations #23
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
Changes from all commits
189650c
f22a281
f87fca4
71814d6
61ea110
e3c996d
b063822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,12 +35,44 @@ if (!FileExist(configFile)) { | |
|
|
||
| ; Read configuration | ||
| try { | ||
| exeName := IniRead(configFile, emulatorName, "exe") | ||
| key := IniRead(configFile, emulatorName, "key", "F11") | ||
| maximize := IniRead(configFile, emulatorName, "maximize", "true") = "true" | ||
| delay := Integer(IniRead(configFile, emulatorName, "delay", "0")) | ||
| activate := IniRead(configFile, emulatorName, "activate", "false") = "true" | ||
| special := IniRead(configFile, emulatorName, "special", "none") | ||
| ; Optimization: Read the entire section once to reduce disk I/O | ||
| sectionContent := IniRead(configFile, emulatorName) | ||
Ven0m0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (sectionContent = "") { | ||
| throw Error("Section '" . emulatorName . "' not found in config file or is empty") | ||
| } | ||
| config := Map() | ||
| config.CaseSense := "Off" ; Ensure case-insensitive lookups (INI standard) | ||
| Loop Parse, sectionContent, "`n", "`r" { | ||
| if (p := InStr(A_LoopField, "=")) { | ||
| k := Trim(SubStr(A_LoopField, 1, p-1)) | ||
| v := Trim(SubStr(A_LoopField, p+1)) | ||
| config[k] := v | ||
| } | ||
| } | ||
|
|
||
| if !config.Has("exe") { | ||
| if (config.Count = 0) | ||
| throw Error("Section '" . emulatorName . "' is empty or missing required key 'exe'") | ||
| else | ||
| throw Error("Key 'exe' not found in section '" . emulatorName . "'") | ||
| } | ||
|
|
||
| exeName := config["exe"] | ||
| key := config.Has("key") ? config["key"] : "F11" | ||
| maximize := (config.Has("maximize") ? config["maximize"] : "true") = "true" | ||
| if config.Has("delay") { | ||
| delayRaw := config["delay"] | ||
| if RegExMatch(delayRaw, "^[+-]?\d+$") { | ||
| delay := Integer(delayRaw) | ||
| } else { | ||
| throw Error("Invalid delay value '" . delayRaw . "' in section '" . emulatorName . "': must be an integer number of milliseconds") | ||
| } | ||
| } else { | ||
| delay := 0 | ||
| } | ||
| activate := (config.Has("activate") ? config["activate"] : "false") = "true" | ||
| special := config.Has("special") ? config["special"] : "none" | ||
|
Comment on lines
61
to
74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current approach for handling default values using |
||
|
|
||
| } catch Error as err { | ||
| MsgBox("Error reading config for " . emulatorName . ":`n" . err.Message) | ||
| ExitApp() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the version pins from the AutoHotkey installations makes the CI/CD pipeline non-deterministic. The workflow will now install whatever the latest versions are at the time of execution, which could introduce breaking changes or unexpected behavior if new versions are released.
This is particularly risky because:
Consider either:
--version=2.0or use version ranges)