using System.Collections.Generic; using ArchestrAServices.Common; using Microsoft.Win32; namespace ASBClientAccessLayer; public class TempRegistryHandler { public static void UpdateDiscoveryInfos(Dictionary dicvoeryInfos) { RegistryKey registryKey = Registry.LocalMachine.CreateSubKey(RegistryHandler.RegistryPath + "NodeRegistration", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryOptions.None); if (registryKey == null) { return; } foreach (KeyValuePair dicvoeryInfo in dicvoeryInfos) { switch (dicvoeryInfo.Key) { case "PrimaryGlobalDiscovery": WriteRegistryValue(registryKey, RegistryHandler.PGDSEndPoint, dicvoeryInfo.Value); break; case "SecondaryGlobalDiscovery": WriteRegistryValue(registryKey, RegistryHandler.SGDSEndPoint, dicvoeryInfo.Value); break; case "PrimaryUniversalDiscovery": WriteRegistryValue(registryKey, RegistryHandler.PUDSEndPoint, dicvoeryInfo.Value); break; case "SecondaryUniversalDiscovery": WriteRegistryValue(registryKey, RegistryHandler.SUDSEndPoint, dicvoeryInfo.Value); break; } } } private static void WriteRegistryValue(RegistryKey solutionKey, string key, string value) { if (!string.IsNullOrEmpty(value)) { solutionKey.SetValue(key, value); } else { solutionKey.SetValue(key, string.Empty); } } }