You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
855 B
36 lines
855 B
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.IO;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.Common
|
||
|
{
|
||
|
public class FileHelper
|
||
|
{
|
||
|
private readonly string _filePath;
|
||
|
public FileHelper(string filePath)
|
||
|
{
|
||
|
this._filePath = filePath;
|
||
|
}
|
||
|
|
||
|
private StreamWriter createFile()
|
||
|
{
|
||
|
if (File.Exists(this._filePath)) {
|
||
|
File.Delete(this._filePath);
|
||
|
}
|
||
|
return File.CreateText(this._filePath);
|
||
|
}
|
||
|
|
||
|
public void InsertLines(List<string> lines)
|
||
|
{
|
||
|
StreamWriter streamWriter = this.createFile();
|
||
|
foreach (string line in lines) {
|
||
|
streamWriter.WriteLine(line);
|
||
|
}
|
||
|
streamWriter.Close();
|
||
|
streamWriter.Dispose();
|
||
|
}
|
||
|
}
|
||
|
}
|