public static string SetStringAndReturnPrevious(string key, string value) { string result = null; if (UserPrefs.HasKey(key)) { result = PlayerPrefs.GetString(key); } UserPrefs.SetString(key, value); return(result); }
public static void SetXml <T>(string key, T obj) { XmlSerializer serializer = new XmlSerializer(typeof(T)); StringWriter sw = new StringWriter(); serializer.Serialize(sw, obj); //Debug.LogError(sw.ToString()); Debug.Log("Save Obj : " + key); string en = EncryptUtils.Base64Encrypt(sw.ToString()); UserPrefs.SetString(key, en); }
public static void SetCollection(string key, ICollection <string> collection) { string value; if (collection == null || collection.Count == 0) { value = EmptyCollectionValue; } else { value = StringUtils.CollectionToCommaDelimitedString <string>(collection); } UserPrefs.SetString(key, value); }
public static void SetHash(string originalKey, string value, string hashSuffix) { string value2 = UserPrefs.CreateHashValue(value, hashSuffix); UserPrefs.SetString(UserPrefs.CreateHashKey(originalKey), value2); }
public static void SetJson(string key, JsonObject value) { UserPrefs.SetString(key, (!(value != null)) ? null : value.ToString()); }