Creates the registry key HKLM\SOFTWARE\$77config, if it does not exist. This key will already be present, when r77 is installed. Otherwise, creation of the key requires elevated privileges (only once). , if the configuration system exists or was created successfully; otherwise, .
()
| 46 | /// otherwise, <see langword="false" />. |
| 47 | /// </returns> |
| 48 | public static bool EnsureConfigSystem() |
| 49 | { |
| 50 | if (IsConfigSystemCreated) |
| 51 | { |
| 52 | return true; |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | if (HelperDll.CreateConfigSystem()) |
| 57 | { |
| 58 | Log.Information( |
| 59 | new LogTextItem("Registry key"), |
| 60 | new LogFileItem($@"HKEY_LOCAL_MACHINE\SOFTWARE\{R77Const.HidePrefix}config"), |
| 61 | new LogTextItem("created.") |
| 62 | ); |
| 63 | |
| 64 | return true; |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | Log.Error( |
| 69 | new LogTextItem("Failed to create registry key"), |
| 70 | new LogFileItem($@"HKEY_LOCAL_MACHINE\SOFTWARE\{R77Const.HidePrefix}config"), |
| 71 | new LogTextItem("Try to"), |
| 72 | new LogLinkItem("run as administrator", () => MainWindowViewModel.Singleton?.ElevateCommand.Execute()) |
| 73 | ); |
| 74 | |
| 75 | return false; |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | /// <summary> |
| 80 | /// Returns the registry key that represents the configuration system. |
| 81 | /// Call <see cref="EnsureConfigSystem" /> to ensure that this key exists. |
no test coverage detected