Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryGetTimeZoneFromLocalMachine() [2/2]

static TimeZoneInfoResult System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine ( string id,
out TimeZoneInfo value,
out Exception e )
inlinestaticprivate

Definition at line 2823 of file TimeZoneInfo.cs.

2824 {
2825 e = null;
2826 using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\" + id, writable: false);
2827 if (registryKey == null)
2828 {
2829 value = null;
2830 return TimeZoneInfoResult.TimeZoneNotFoundException;
2831 }
2833 {
2834 value = null;
2835 return TimeZoneInfoResult.InvalidTimeZoneException;
2836 }
2837 if (!TryCreateAdjustmentRules(id, in dtzi, out var rules, out e, dtzi.Bias))
2838 {
2839 value = null;
2840 return TimeZoneInfoResult.InvalidTimeZoneException;
2841 }
2843 try
2844 {
2846 return TimeZoneInfoResult.Success;
2847 }
2848 catch (ArgumentException ex)
2849 {
2850 value = null;
2851 e = ex;
2852 return TimeZoneInfoResult.InvalidTimeZoneException;
2853 }
2855 {
2856 value = null;
2857 e = ex2;
2858 return TimeZoneInfoResult.InvalidTimeZoneException;
2859 }
2860 }
static readonly RegistryKey LocalMachine
Definition Registry.cs:9
static bool TryCreateAdjustmentRules(string id, in Interop.Kernel32.REG_TZI_FORMAT defaultTimeZoneInformation, out AdjustmentRule[] rules, out Exception e, int defaultBaseUtcOffset)
static void GetLocalizedNamesByRegistryKey(RegistryKey key, out string displayName, out string standardName, out string daylightName)
TimeZoneInfo(string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, AdjustmentRule[] adjustmentRules, bool disableDaylightSavingTime, bool hasIanaId=false)
static unsafe bool TryGetTimeZoneEntryFromRegistry(RegistryKey key, string name, out Interop.Kernel32.REG_TZI_FORMAT dtzi)

References System.TimeZoneInfo.TimeZoneInfo(), System.Runtime.Serialization.Dictionary, System.TimeZoneInfo.GetLocalizedNamesByRegistryKey(), Internal.Win32.Registry.LocalMachine, System.TimeZoneInfo.TryCreateAdjustmentRules(), System.TimeZoneInfo.TryGetTimeZoneEntryFromRegistry(), and System.value.