Exemple #1
0
 private Note DeserializeNote(SerializedNote note)
 {
     return(new Note()
     {
         Id = note.Id,
         Content = note.Content,
         Date = note.Date,
         Category = SerializedCategory.DeserializeCategory(note.Category)
     });
 }
Exemple #2
0
 private void Deserialize()
 {
     if (File.Exists(_file))
     {
         try
         {
             using (FileStream fs = File.Open(_file, FileMode.Open))
             {
                 List <SerializedCategory> list = (List <SerializedCategory>)(new BinaryFormatter()).Deserialize(fs);
                 _categories.Clear();
                 foreach (SerializedCategory item in list)
                 {
                     _categories.Add(SerializedCategory.DeserializeCategory(item));
                 }
             }
         }catch (Exception e)
         {
             Debug.Log(e.Message);
             File.Delete(_file);
         }
     }
 }