Пример #1
0
        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;
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
 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);
     }
 }