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>
 /// Sets the value associated with key in the persistent data storage.
 /// </summary>
 /// <param name="key">Key.</param>
 /// <param name="value">Value.</param>
 public static void SetFloat(string key, float value)
 {
     StoringSystem.SetFloat(key, value);
 }
Example #3
0
 /// <summary>
 /// Writes all modified keys to disk.
 /// As of current implementation this invokes <c>PlayerPrefs.Save()</c> internally.
 /// </summary>
 public static void Save()
 {
     StoringSystem.Save();
 }
Example #4
0
 /// <summary>
 /// Returns true if key exists in the persistent data storage.
 /// </summary>
 /// <returns><c>true</c> if key exists; otherwise, <c>false</c>.</returns>
 /// <param name="key">Key.</param>
 public static bool HasKey(string key)
 {
     return(StoringSystem.HasKey(key));
 }
Example #5
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));
 }
Example #6
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 int.</returns>
 /// <param name="key">Key.</param>
 /// <param name="defaultValue">Default value.</param>
 public static int GetInt(string key, int defaultValue)
 {
     return(StoringSystem.GetInt(key, defaultValue));
 }
Example #7
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 float.</returns>
 /// <param name="key">Key.</param>
 public static float GetFloat(string key, float defaultValue)
 {
     return(StoringSystem.GetFloat(key, defaultValue));
 }
Example #8
0
 /// <summary>
 /// Removes key and its corresponding value from the persistent data storage.
 /// </summary>
 /// <param name="key">Key.</param>
 public static void DeleteKey(string key)
 {
     StoringSystem.DeleteKey(key);
 }
Example #9
0
 /// <summary>
 /// Removes all keys and values from the persistent data storage. Use with caution.
 /// </summary>
 public static void DeleteAll()
 {
     StoringSystem.DeleteAll();
 }
Example #10
0
 /// <summary>
 /// Stores a <see cref="DateTime"/> value as string to the persistent storage.
 /// </summary>
 /// <param name="time">Time.</param>
 /// <param name="ppkey">Key to store the value.</param>
 public static void SetTime(string ppkey, DateTime time)
 {
     StoringSystem.SetString(ppkey, time.ToBinary().ToString());
 }
Example #11
0
 /// <summary>
 /// Sets the value associated with key in the persistent data storage.
 /// </summary>
 /// <param name="key">Key.</param>
 /// <param name="value">Value.</param>
 public static void SetString(string key, string value)
 {
     StoringSystem.SetString(key, value);
 }
Example #12
0
 /// <summary>
 /// Sets the value associated with key in the persistent data storage.
 /// </summary>
 /// <param name="key">Key.</param>
 /// <param name="value">Value.</param>
 public static void SetInt(string key, int value)
 {
     StoringSystem.SetInt(key, value);
 }