1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.IO;
6
7 namespace PrintLableCode
8 {
9 class FileHelper
10 {
11 List<string> readList = null;
12 /// <summary>
13 /// 读取文件
14 /// </summary>
15 /// <param name="path"></param>
16 /// <returns></returns>
17 public List<string> readFiles(string path)
18 {
19 StreamReader reader = new StreamReader(path,Encoding.Default);
20 string lines;
21 while((lines=reader.ReadLine())!=null)
22 {
23 readList.Add(lines.ToString());
24 }
25 return readList;
26 }
27 /// <summary>
28 /// 文件写入
29 /// </summary>
30 /// <param name="path"></param>
31 /// <param name="str"></param>
32 public void writeFiles(string path,string str)
33 {
34 FileStream fs = new FileStream(path, FileMode.Append);
35 StreamWriter sw = new StreamWriter(fs);
36 sw.WriteLine(str);
37 sw.Flush();
38 sw.Close();
39 }
40 }
41 }