forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEContextType.cs
More file actions
123 lines (116 loc) · 3.02 KB
/
EContextType.cs
File metadata and controls
123 lines (116 loc) · 3.02 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
namespace SiteServer.CMS.StlParser.Model
{
public enum EContextType
{
Content,
Channel,
Comment,
Photo,
Each,
InputContent,
SqlContent,
Site,
Undefined
}
public class EContextTypeUtils
{
public static string GetValue(EContextType type)
{
if (type == EContextType.Content)
{
return "Content";
}
else if (type == EContextType.Channel)
{
return "Channel";
}
else if (type == EContextType.Comment)
{
return "Comment";
}
else if (type == EContextType.Photo)
{
return "Photo";
}
else if (type == EContextType.Each)
{
return "Each";
}
else if (type == EContextType.InputContent)
{
return "InputContent";
}
else if (type == EContextType.SqlContent)
{
return "SqlContent";
}
else if (type == EContextType.Site)
{
return "Site";
}
else if (type == EContextType.Undefined)
{
return "Undefined";
}
else
{
throw new Exception();
}
}
public static EContextType GetEnumType(string typeStr)
{
var retval = EContextType.Undefined;
if (Equals(EContextType.Content, typeStr))
{
retval = EContextType.Content;
}
else if (Equals(EContextType.Channel, typeStr))
{
retval = EContextType.Channel;
}
else if (Equals(EContextType.Comment, typeStr))
{
retval = EContextType.Comment;
}
else if (Equals(EContextType.Photo, typeStr))
{
retval = EContextType.Photo;
}
else if (Equals(EContextType.Each, typeStr))
{
retval = EContextType.Each;
}
else if (Equals(EContextType.InputContent, typeStr))
{
retval = EContextType.InputContent;
}
else if (Equals(EContextType.SqlContent, typeStr))
{
retval = EContextType.SqlContent;
}
else if (Equals(EContextType.Site, typeStr))
{
retval = EContextType.Site;
}
else if (Equals(EContextType.Undefined, typeStr))
{
retval = EContextType.Undefined;
}
return retval;
}
public static bool Equals(EContextType type, string typeStr)
{
if (string.IsNullOrEmpty(typeStr)) return false;
if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
{
return true;
}
return false;
}
public static bool Equals(string typeStr, EContextType type)
{
return Equals(type, typeStr);
}
}
}