-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFileOperate.cs
60 lines (55 loc) · 1.6 KB
/
FileOperate.cs
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
using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
namespace CellInfo
{
class FileOperate
{
/// <summary>
/// 文件写入操作
/// </summary>
/// <param name="path"></param>
/// <param name="TextIn"></param>
public void WriteToFile(string path, string TextIn)
{
System.IO.File.WriteAllText(path, TextIn);
}
/// <summary>
/// 文件读取操作
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public string ReadFromFile(string path)
{
string Out = System.IO.File.ReadAllText(path);
return Out;
}
/// <summary>
/// 文件读取操作
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public byte[] ReadByte(string path)
{
byte[] Out = new byte[400];
FileStream FS = new FileStream(path, FileMode.Open);
FS.Seek(177, SeekOrigin.Begin);
FS.Read(Out, 0, 2);
return Out;
}
/// <summary>
/// 数据提取
/// </summary>
/// <param name="InPut"></param>
/// <returns></returns>
public static string[] DataPull(string InPut)
{
InPut = InPut.Trim();
string[] str = System.Text.RegularExpressions.Regex.Split(InPut, @"\s+");
return str;
}
}
}