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

◆ TryCreateAdjustmentRules()

static bool System.TimeZoneInfo.TryCreateAdjustmentRules ( string id,
in Interop::Kernel32::REG_TZI_FORMAT defaultTimeZoneInformation,
out AdjustmentRule[] rules,
out Exception e,
int defaultBaseUtcOffset )
inlinestaticprivate

Definition at line 2593 of file TimeZoneInfo.cs.

2594 {
2595 rules = null;
2596 e = null;
2597 try
2598 {
2599 using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\" + id + "\\Dynamic DST", writable: false);
2600 if (registryKey == null)
2601 {
2603 if (adjustmentRule != null)
2604 {
2605 rules = new AdjustmentRule[1] { adjustmentRule };
2606 }
2607 return true;
2608 }
2609 int num = (int)registryKey.GetValue("FirstEntry", -1);
2610 int num2 = (int)registryKey.GetValue("LastEntry", -1);
2611 if (num == -1 || num2 == -1 || num > num2)
2612 {
2613 return false;
2614 }
2616 {
2617 return false;
2618 }
2619 if (num == num2)
2620 {
2622 if (adjustmentRule2 != null)
2623 {
2624 rules = new AdjustmentRule[1] { adjustmentRule2 };
2625 }
2626 return true;
2627 }
2630 if (adjustmentRule3 != null)
2631 {
2632 list.Add(adjustmentRule3);
2633 }
2634 for (int i = num + 1; i < num2; i++)
2635 {
2637 {
2638 return false;
2639 }
2641 if (adjustmentRule4 != null)
2642 {
2643 list.Add(adjustmentRule4);
2644 }
2645 }
2647 {
2648 return false;
2649 }
2651 if (adjustmentRule5 != null)
2652 {
2653 list.Add(adjustmentRule5);
2654 }
2655 if (list.Count != 0)
2656 {
2657 rules = list.ToArray();
2658 }
2659 }
2660 catch (InvalidCastException ex)
2661 {
2662 e = ex;
2663 return false;
2664 }
2665 catch (ArgumentOutOfRangeException ex2)
2666 {
2667 e = ex2;
2668 return false;
2669 }
2670 catch (ArgumentException ex3)
2671 {
2672 e = ex3;
2673 return false;
2674 }
2675 return true;
2676 }
static readonly RegistryKey LocalMachine
Definition Registry.cs:9
static CultureInfo InvariantCulture
static AdjustmentRule CreateAdjustmentRuleFromTimeZoneInformation(in Interop.Kernel32.REG_TZI_FORMAT timeZoneInformation, DateTime startDate, DateTime endDate, int defaultBaseUtcOffset)
static unsafe bool TryGetTimeZoneEntryFromRegistry(RegistryKey key, string name, out Interop.Kernel32.REG_TZI_FORMAT dtzi)

References System.TimeZoneInfo.CreateAdjustmentRuleFromTimeZoneInformation(), System.DateTime, System.Runtime.Serialization.Dictionary, System.Globalization.CultureInfo.InvariantCulture, System.list, Internal.Win32.Registry.LocalMachine, System.DateTime.MaxValue, System.DateTime.MinValue, and System.TimeZoneInfo.TryGetTimeZoneEntryFromRegistry().

Referenced by System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine().