void saveTaskToJson() { string fileContent = ""; for (int i = 0; i < tasksList.Count; i++) { NewTaskList temp = new NewTaskList(tasksList[i].objTitle, tasksList[i].objText, tasksList[i].objColor, tasksList[i].objDay, tasksList[i].objMonth, tasksList[i].objYear, tasksList[i].objHour, tasksList[i].objMinute, tasksList[i].objIndex); fileContent += JsonUtility.ToJson(temp) + "\n"; } System.IO.File.WriteAllText(filePath, fileContent); }
void readTaskFromJson() { string fileJson = ""; fileJson = System.IO.File.ReadAllText(filePath); string[] splitTextContent = fileJson.Split('\n'); foreach (string textContent in splitTextContent) { if (textContent.Trim() != "") { NewTaskList temp = JsonUtility.FromJson <NewTaskList>(textContent.Trim()); createButtonPressed(temp.objTitle, temp.objText, temp.objColor, temp.objDay, temp.objMonth, temp.objYear, temp.objHour, temp.objMinute, temp.objIndex); } } }