private void InitializeBackupFile() { Directory.CreateDirectory(_appDataFolder + AppDirectory); var initModel = new NerdModel(); initModel.Notes = new Dictionary <string, string>(); initModel.Notes.Add("MyNote", "Start typing here!"); File.WriteAllText(_fullPath, JsonConvert.SerializeObject(initModel.Notes)); }
public JsonConverter() { _fullPath = _appDataFolder + AppDirectory + NotesFile; string jsonString; if (!File.Exists(_fullPath)) { InitializeBackupFile(); } jsonString = File.ReadAllText(_fullPath); _model = new NerdModel(); _model.Notes = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonString); }