From 769ed03f5d1b90d33a41f80075fd9c4fe330e5aa Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Tue, 5 Nov 2024 03:05:07 -0600 Subject: [PATCH] Reworked Launch Option Parsing to ignore First Element --- MelonLoader/MelonLaunchOptions.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MelonLoader/MelonLaunchOptions.cs b/MelonLoader/MelonLaunchOptions.cs index d10efc6d..1e1340ee 100644 --- a/MelonLoader/MelonLaunchOptions.cs +++ b/MelonLoader/MelonLaunchOptions.cs @@ -42,10 +42,11 @@ static MelonLaunchOptions() internal static void Load() { - LemonEnumerator argEnumerator = new LemonEnumerator(CommandLineArgs); - while (argEnumerator.MoveNext()) + string[] args = CommandLineArgs; + int maxLen = args.Length; + for (int i = 1; i < maxLen; i++) { - string fullcmd = argEnumerator.Current; + string fullcmd = args[i]; if (string.IsNullOrEmpty(fullcmd)) continue; @@ -79,7 +80,7 @@ internal static void Load() cmdArg = split[1]; } if ((string.IsNullOrEmpty(cmdArg) - && !argEnumerator.Peek(out cmdArg)) + && ((i + 1) > (maxLen - 1))) || string.IsNullOrEmpty(cmdArg) || !cmdArg.StartsWith("--") || !cmdArg.StartsWith("-"))