CSV.cs
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//using System;
//using System.Text;
//namespace DAL
//{
// public class CSV
// {
// private readonly string PATH;
// private string[][] content;
// public CSV(string path)
// {
// try
// {
// PATH = path;
// if (!System.IO.File.Exists(path))
// System.IO.File.WriteAllText(path, "", Encoding.UTF8);
// string[] lines = System.IO.File.ReadAllLines(path, Encoding.UTF8);
// content = new string[lines.Length][];
// for (int i = 0; i < lines.Length; i++)
// content[i] = lines[i].Split(',');
// }
// catch (Exception ex)
// {
// content = new string[0][];
// Common.log.Error("CSV.Open", ex);
// }
// }
// public string[][] Read()
// {
// return content;
// }
// public string[] Read(int row)
// {
// if (row >= content.Length)
// return null;
// else
// return content[row];
// }
// public void Save()
// {
// try
// {
// string[] lines = new string[content.Length];
// for (int i = 0; i < content.Length; i++)
// lines[i] = string.Join(",", content[i]);
// System.IO.File.WriteAllLines(PATH, lines);
// Common.log.Debug("文件已保存," + PATH);
// }
// catch (Exception ex)
// {
// Common.log.Error("CSV.Save", ex);
// }
// }
// }
//}