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