/// <summary>
        ///	Specifies if item has expired or not.
        /// </summary>
        /// <returns>
        ///	Returns true if the data is expired otherwise false
        /// </returns>
        public bool HasExpired()
        {
            // Convert to UTC in order to compensate for time zones		
            DateTime nowDateTime = DateTime.Now.ToUniversalTime();

            ExtendedFormat format = new ExtendedFormat(extendedFormat);
            // Check expiration
            if (format.IsExpired(lastUsedTime, nowDateTime))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Example #2
0
        /// <summary>
        ///	Specifies if item has expired or not.
        /// </summary>
        /// <returns>
        ///	Returns true if the data is expired otherwise false
        /// </returns>
        public bool HasExpired()
        {
            // Convert to UTC in order to compensate for time zones
            DateTime nowDateTime = DateTime.Now.ToUniversalTime();

            ExtendedFormat format = new ExtendedFormat(extendedFormat);

            // Check expiration
            if (format.IsExpired(lastUsedTime, nowDateTime))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        ///	Convert the input format to the extented time format.
        /// </summary>
        /// <param name="timeFormat">
        ///	This contains the expiration information
        /// </param>
        public ExtendedFormatTime(string timeFormat)
        {
            // check arguments
            if (Object.Equals(timeFormat, null))
            {
                throw new ArgumentNullException("timeFormat",
                                                SR.ExceptionNullTimeFormat);
            }
            if (timeFormat.Length == 0)
            {
                throw new ArgumentOutOfRangeException("timeFormat",
                                                      SR.ExceptionRangeTimeFormat);
            }

            ExtendedFormat.Validate(timeFormat);

            // Get the modified extended format
            this.extendedFormat = timeFormat;

            // Convert to UTC in order to compensate for time zones
            this.lastUsedTime = DateTime.Now.ToUniversalTime();
        }
		/// <summary>
		/// Validates the format.
		/// </summary>
		/// <param name="timeFormat">
		/// The format to validate.
		/// </param>
        public static void Validate(string timeFormat)
        {
            ExtendedFormat ef = new ExtendedFormat(timeFormat);
			ef.Initialize();
        }
Example #5
0
        /// <summary>
        /// Validates the format.
        /// </summary>
        /// <param name="timeFormat">
        /// The format to validate.
        /// </param>
        public static void Validate(string timeFormat)
        {
            ExtendedFormat ef = new ExtendedFormat(timeFormat);

            ef.Initialize();
        }