Skip to content

Commit 97cbf73

Browse files
committed
handle default preference
1 parent 8106695 commit 97cbf73

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

FlashpointSecurePlayer/FlashpointProxy.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ public static void GetPreferences(out bool proxy, out int port) {
167167
// fail silently
168168
}
169169

170-
if (!bool.TryParse(proxyEnvironmentVariable, out proxy)) {
170+
if (long.TryParse(proxyEnvironmentVariable, out long _proxy) && _proxy != PREFERENCE_DEFAULT) {
171+
proxy = _proxy != 0;
172+
} else {
171173
proxy = FP_PROXY_DEFAULT;
172174
}
173175
} else {
@@ -183,7 +185,9 @@ public static void GetPreferences(out bool proxy, out int port) {
183185
// fail silently
184186
}
185187

186-
if (!int.TryParse(portEnvironmentVariable, out port)) {
188+
if (long.TryParse(portEnvironmentVariable, out long _port) && _port != PREFERENCE_DEFAULT) {
189+
port = (int)_port;
190+
} else {
187191
port = FP_PROXY_PORT_DEFAULT;
188192
}
189193
} else {

FlashpointSecurePlayer/Shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,8 @@ public enum MODIFICATIONS_REVERT_METHOD {
950950
public const string OLD_CPU_SIMULATOR_PATH = "OldCPUSimulator\\OldCPUSimulator.exe";
951951
public const string OLD_CPU_SIMULATOR_PARENT_PROCESS_FILE_NAME = "OLDCPUSIMULATOR.EXE";
952952

953+
public const long PREFERENCE_DEFAULT = -1;
954+
953955
public const string FP_STARTUP_PATH = nameof(FP_STARTUP_PATH);
954956
public const string FP_URL = nameof(FP_URL);
955957
public const string FP_ARGUMENTS = nameof(FP_ARGUMENTS);

0 commit comments

Comments
 (0)