Migrating data from Access 97 to Postgres database
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

42 lignes
1.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. namespace acc_pgsql
  7. {
  8. public static class FileHelper
  9. {
  10. public static string ReadFile(string path)
  11. {
  12. return File.ReadAllText(path);
  13. }
  14. public static void AppendTxt(string path, string text)
  15. {
  16. if (!File.Exists(path))
  17. File.Create(path);
  18. File.AppendAllText(path, text);
  19. }
  20. public static void AppendTxt(string path, List<string> text)
  21. {
  22. foreach (string t in text)
  23. AppendTxt(path, t);
  24. }
  25. public static void Log(string message, bool isError = false)
  26. {
  27. string dir = Environment.CurrentDirectory;
  28. dir = Path.Combine(dir, "logs");
  29. string path = string.Empty;
  30. if (isError)
  31. path = Path.Combine(dir, "error.log");
  32. else
  33. path = Path.Combine(dir, "success.log");
  34. AppendTxt(path, message);
  35. }
  36. }
  37. }