using System.IO.IsolatedStorage;

namespace TaskIt.Infrastructure
{
    public class IsolatedStorageManager
    {
        public static bool ExistsInIsolatedStorage(string key)
        {
            return IsolatedStorageSettings.ApplicationSettings.Contains(key);
        }

        public static string GetValueFromIsolatedStorage(string key)
        {
            return ExistsInIsolatedStorage(key) ?
                IsolatedStorageSettings.ApplicationSettings[key].ToString() :
                string.Empty;
        }

        public static void AddValueToIsolatedStorage(string key, string value)
        {
            if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
            {
                IsolatedStorageSettings.ApplicationSettings[key] = value;
            }
            else
            {
                IsolatedStorageSettings.ApplicationSettings.Add(key, value);
            }
        }
    }
}
