123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using static StackExchange.Redis.Role;
- namespace OASystem.API.OAMethodLib
- {
- public class IOOperatorHelper
- {
-
-
-
-
-
-
-
- public string Write_CoverFile(string content, string dir, string fileName)
- {
- if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir);
-
- String filePath = dir + fileName;
- System.IO.StreamWriter file1 = new System.IO.StreamWriter(filePath, false);
- file1.Write(content);
- file1.Close();
- file1.Dispose();
- return filePath;
- }
- public string Read(string filePath)
- {
- string result = string.Empty;
- try
- {
-
- using (StreamReader sr = new StreamReader(filePath))
- {
- string line;
-
-
- while ((line = sr.ReadLine()) != null)
- {
- result += line;
- }
- }
- }
- catch (Exception e)
- {
- }
- result = JsonConvert.DeserializeObject<string>(result);
- return result;
- }
-
-
-
-
-
-
- public void MoveFile(string sourceFileFullPath, string RecycleBinPath)
- {
-
- if (!string.IsNullOrEmpty(sourceFileFullPath) && System.IO.File.Exists(sourceFileFullPath))
- {
- string fileName = Path.GetFileName(sourceFileFullPath);
- System.IO.File.Move(sourceFileFullPath, RecycleBinPath + fileName);
- }
- }
- }
- }
|