-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransfer.cs
91 lines (87 loc) · 2.69 KB
/
Transfer.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace voice_programming
{
class Transfer
{
public Transfer(string[] pattern)
{
// 词法分析
int length = pattern.Length;
// 动词
string act = pattern[0];
// 路径
string originalPath = "";
int i = 1, j = 0;
for (; i < length - 1; i++)
{
if (isDir(pattern[i]))
{
originalPath += pattern[i];
}
}
// 条件
string[] condition = null;
int k = 0;
for (; i < length - 1; i++)
{
condition[k++] = pattern[i];
}
// 操作对象
string target = pattern[length - 1];
}
public string generateOpen(string path, string[] condition, string target)
{
if (!File.Exists("C:\\function\\open.txt"))
{
FileStream fs1 = new FileStream("C:\\function\\open.txt", FileMode.Create, FileAccess.Write);
StreamWriter writer = new StreamWriter(fs1);
writer.WriteLine("CD " + path);
writer.WriteLine("ENABALE RET_LIST");
writer.WriteLine("FOREACH f IN READ_ALL_FILES(CWD)");
writer.WriteLine("");
writer.WriteLine("IF F3()");
writer.WriteLine();
}
return "";
}
public bool isDongci(string word)
{
FileStream fs = new FileStream("dongci.txt", FileMode.Open);
StreamReader reader = new StreamReader(fs);
string line = null;
while ((line = reader.ReadLine()) != null)
{
if (line == word)
{
fs.Close();
return true;
}
}
fs.Close();
return false;
}
public bool isDir(string word)
{
Regex reg_root = new Regex("盘");
Regex reg_dir = new Regex("文件夹");
Regex reg_table = new Regex("桌面");
Regex reg_jieci = new Regex("下的");
if (reg_root.IsMatch(word) || reg_dir.IsMatch(word) || reg_table.IsMatch(word) || reg_jieci.IsMatch(word))
{
return true;
}
return false;
}
//时间、人物、类型、应用程序;
public string getPath(string[] pathWords)
{
string s = "C盘下";
return "";
}
}
}