示例#1
0
 public static void SaveTextFile(string theFilePath, string theText, bool encrypt)
 {
     try
     {
         string toSave = (encrypt) ? CryptographyHelper.Encrypt(theText) : theText;
         File.WriteAllText(theFilePath, toSave);
     }
     catch (Exception ex)
     {
         Trace.TraceError(ex.ToString());
         Trace.Flush();
     }
 }
示例#2
0
 public static string LoadTextFile(string theFilePath, bool decrypt)
 {
     try
     {
         if (File.Exists(theFilePath))
         {
             string theText = File.ReadAllText(theFilePath);
             return((decrypt) ? CryptographyHelper.Decrypt(theText) : theText);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         Trace.TraceError(ex.ToString());
         Trace.Flush();
         return(null);
     }
 }