ComponentFactory.Krypton.Ribbon.EvaluationMonitor.GetDateData C# (CSharp) Method

GetDateData() private method

Calculate the number of days the product has been in use
private GetDateData ( ) : void
return void
        private void GetDateData()
        {
            string dateString;
            RegistryKey firstUseKey = _baseKey.OpenSubKey(_firstUseKeyName);
            dateString = Decrypt((byte[])firstUseKey.GetValue(null));
            _firstUseDate = DateTime.Parse(dateString);
            firstUseKey.Close();

            RegistryKey lastUseKey = _baseKey.OpenSubKey(_lastUseKeyName, true);
            dateString = Decrypt((byte[])lastUseKey.GetValue(null));
            _lastUseDate = DateTime.Parse(dateString);

            // detect winding the clock back on the PC - give them six hours of grace to allow for
            // daylight saving adjustments etc
            //
            double hoursSinceLastUse = DateTime.UtcNow.Subtract(_lastUseDate).TotalHours;
            if (hoursSinceLastUse < -6.0)
            {
                _invalid = true;
            }
            else
            {
                string test = DateTime.UtcNow.ToString();
                lastUseKey.SetValue(null, Encrypt(DateTime.UtcNow.ToString()));
            }
            lastUseKey.Close();
        }