public void Write(TE Dato) { try { var binaryFormatter = new BinaryFormatter { Binder = new BinderDeDeserealizacion() }; // writing to memory var memoryStream = new MemoryStream(2048); var writer = new XORStream(memoryStream, _password); binaryFormatter.Serialize(writer, Dato); writer.Flush(); string info = Convert.ToBase64String(memoryStream.GetBuffer()); PlayerPrefs.SetString(Dato.id, info); PlayerPrefs.Save(); } catch (Exception e) { Debug.LogError(e.Message); return; } }
public void WriteTable(string id, Hashtable datos) { var binaryFormatter = new BinaryFormatter { Binder = new BinderDeDeserealizacion() }; var memoryStream = new MemoryStream(2048); var writer = new XORStream(memoryStream, _password); binaryFormatter.Serialize(writer, datos); writer.Flush(); string info = Convert.ToBase64String(memoryStream.GetBuffer()); PlayerPrefs.SetString(id, info); PlayerPrefs.Save(); }
public void WriteList(string id, IList <TE> datos) { try{ var binaryFormatter = new BinaryFormatter { Binder = new BinderDeDeserealizacion() }; var memoryStream = new MemoryStream(2048); var writer = new XORStream(memoryStream, _password); binaryFormatter.Serialize(writer, datos); writer.Flush(); string info = Convert.ToBase64String(memoryStream.GetBuffer()); PlayerPrefs.SetString(id, info); PlayerPrefs.Save(); } catch (Exception e) { Debug.Log(e.Message); } }