|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
-
- namespace acc_pgsql
- {
- public static class FileHelper
- {
- public static string ReadFile(string path)
- {
- return File.ReadAllText(path);
- }
-
- public static void AppendTxt(string path, string text)
- {
- if (!File.Exists(path))
- File.Create(path);
- File.AppendAllText(path, text);
- }
-
- public static void AppendTxt(string path, List<string> text)
- {
- foreach (string t in text)
- AppendTxt(path, t);
- }
-
- public static void Log(string message, bool isError = false)
- {
- string dir = Environment.CurrentDirectory;
- dir = Path.Combine(dir, "logs");
- string path = string.Empty;
- if (isError)
- path = Path.Combine(dir, "error.log");
- else
- path = Path.Combine(dir, "success.log");
- AppendTxt(path, message);
- }
- }
- }
|