Example #1
0
        /// <summary>
        /// Gets the stored string in the persistent storage, converts it to a <see cref="DateTime"/> and returns.
        /// If no value was stored previously, the given default time is returned.
        /// </summary>
        /// <returns>The time.</returns>
        /// <param name="ppkey">Key to retrieve the value.</param>
        public static DateTime GetTime(string ppkey, DateTime defaultTime)
        {
            string storedTime = StoringSystem.GetString(ppkey, string.Empty);

            if (!string.IsNullOrEmpty(storedTime))
            {
                return(DateTime.FromBinary(Convert.ToInt64(storedTime)));
            }
            else
            {
                return(defaultTime);
            }
        }
Example #2
0
 /// <summary>
 /// Returns the value corresponding to key in the persistent data storage if it exists.
 /// If it doesn't exist, it will return defaultValue.
 /// </summary>
 /// <returns>The string.</returns>
 /// <param name="key">Key.</param>
 /// <param name="defaultValue">Default value.</param>
 public static string GetString(string key, string defaultValue)
 {
     return(StoringSystem.GetString(key, defaultValue));
 }