MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / PersistMode

Method PersistMode

ui/Services/ModeService.cs:12–29  ·  view source on GitHub ↗

Writes both files; rolls back settings.json if pin-config write fails.

(string mode, bool cloudRedirectEnabled)

Source from the content-addressed store, hash-verified

10{
11 // Writes both files; rolls back settings.json if pin-config write fails.
12 public static void PersistMode(string mode, bool cloudRedirectEnabled)
13 {
14 var settingsPath = GetSettingsPath();
15 byte[]? settingsBackup = File.Exists(settingsPath)
16 ? TryReadAllBytes(settingsPath)
17 : null;
18
19 SaveModeSetting(mode);
20 try
21 {
22 SetDllCloudRedirect(cloudRedirectEnabled);
23 }
24 catch
25 {
26 RestoreSettingsBackup(settingsPath, settingsBackup);
27 throw;
28 }
29 }
30
31 // One-time consent gate; not shown again on later mode switches.
32 public static bool HasAcceptedDisclaimer()

Callers 2

TryPersistModeAsyncMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected