Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private bool QuestionAdder(Question question)
 {
     try
     {
         questions.Add(question);
         JSONProcess.Write(jsonPath, questions);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return(false);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }