示例#1
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 (string.IsNullOrEmpty(timeFormat))
            {
                //throw new ArgumentException(Resources.ExceptionNullTimeFormat, "timeFormat");
            }

            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();
        }
示例#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);
            }
        }
示例#3
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;
            }
        }
示例#4
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();
 }
示例#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();
        }