Example #1
0
 public static string SaveTasksToFile()
 {
     try
     {
         using (FileStream fs = new FileStream(AppPath + "tasks.cst", FileMode.Create, FileAccess.ReadWrite))
         {
             StreamWriter sw = new StreamWriter(fs);
             foreach (ITCTask task in AllTasks)
             {
                 sw.WriteLine(CryptoTools.Encrypt(task.ToString_Short()));
             }
             sw.Close();
         }
         return("operation complete: saved tasks to file");
     }
     catch (Exception ex)
     {
         return("operation failed: " + ex.ToString());
     }
 }
Example #2
0
 public static string LoadTasksFromFile()
 {
     try
     {
         using (FileStream fs = new FileStream(AppPath + "tasks.cst", FileMode.Open, FileAccess.Read))
         {
             AllTasks.Clear();
             StreamReader sr = new StreamReader(fs);
             while (!sr.EndOfStream)
             {
                 AllTasks.Add(ITCTask.ToITCTask_LongPath(CryptoTools.Decrypt(sr.ReadLine())));
             }
             sr.Close();
         }
         return("operation complete: loaded tasks from file");
     }
     catch (Exception ex)
     {
         return("operation failed: " + ex.ToString());
     }
 }