/// <summary> /// Retrives NTP Servers /// </summary> internal static CompletionCode GetNtpServer(RegisteryKey registryKey, out string response) { lock (locker) { try { RegistryKey regkey = Registry.LocalMachine.OpenSubKey(ControlStrings.W32TimeKey, RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.ReadKey); response = (string)regkey.GetValue(RegistryKeyName(registryKey)); // dispose of unmanaged object if (regkey != null) regkey.Dispose(); } catch (Exception ex) { Tracer.WriteError("Chassis Manager GetNtpServer failed with Exception: {0}", ex); response = string.Empty; return CompletionCode.UnspecifiedError; } } if (!string.IsNullOrEmpty(response)) { // replace flag for clean output. response = response.Replace(",0x9", ""); } return CompletionCode.Success; }
/// <summary> /// Retrives NTP Servers /// </summary> internal static CompletionCode GetNtpServer(RegisteryKey registryKey, out string response) { lock (locker) { try { RegistryKey regkey = Registry.LocalMachine.OpenSubKey(ControlStrings.W32TimeKey, RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.ReadKey); response = (string)regkey.GetValue(RegistryKeyName(registryKey)); // dispose of unmanaged object if (regkey != null) { regkey.Dispose(); } } catch (Exception ex) { Tracer.WriteError("Chassis Manager GetNtpServer failed with Exception: {0}", ex); response = string.Empty; return(CompletionCode.UnspecifiedError); } } if (!string.IsNullOrEmpty(response)) { // replace flag for clean output. response = response.Replace(",0x9", ""); } return(CompletionCode.Success); }
/// <summary> /// Converts Enum value to string value /// </summary> private static string RegistryKeyName(RegisteryKey key) { return key.ToString(); }
/// <summary> /// Converts Enum value to string value /// </summary> private static string RegistryKeyName(RegisteryKey key) { return(key.ToString()); }