private void Form1_FormClosing(object sender, FormClosingEventArgs e) { String dateTime = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"); dateTime += ".json"; String myBackupPath = backupFilePath + "\\" + dateTime; JSONProcess.backup(myBackupPath, questions); }
private bool QuestionAdder(Question question) { try { questions.Add(question); JSONProcess.Write(jsonPath, questions); return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
private bool ReadQuestionsFromFile() { try { string questionsStr = File.ReadAllText(jsonFilePath); if (questionsStr != null && !(questionsStr.Equals(""))) { var result = JSONProcess.Read(jsonFilePath); if (result != null) { questions = result; } } return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }