Repository navigation
Expand file tree
/
Copy pathItem.cs
More file actions
executable file
·59 lines (55 loc) · 1.5 KB
/
Copy pathItem.cs
File metadata and controls
executable file
·59 lines (55 loc) · 1.5 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CustomCommandPlugin
{
public enum Action
{
打开程序,关闭程序,关机
}
public class Item
{
public string Cmd { get; set; }
public string Parameter { get; set; }
public Action Action { get; set; }
public static Item Parse(string str)
{
Item i = new Item();
string[] s = str.Split(',');
if(s.Length==3)
{
i.Cmd = s[0];
int at = 0;
int.TryParse(s[1], out at);
i.Action = (Action)at;
i.Parameter = s[2];
return i;
}
return null;
}
public string ToCmd()
{
string header = "";
switch(Action)
{
case Action.打开程序:
header = "Open|";
break;
case Action.关闭程序:
header = "Open|";
break;
case Action.关机:
header = "Open|";
Parameter = "Shutdown -s";
break;
}
return header+Parameter;
}
public override string ToString()
{
string s=Cmd+","+((int)Action).ToString()+","+Parameter;
return s;
}
}
}