Migrating data from Access 97 to Postgres database
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FileHelper.cs 1.1 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }