-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathExample.cs
More file actions
134 lines (133 loc) · 4.11 KB
/
Copy pathExample.cs
File metadata and controls
134 lines (133 loc) · 4.11 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
124
125
126
127
128
129
130
131
132
133
134
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace JayDataExamples.App_Code
{
public class Example
{
[XmlAttribute("wide")]
public bool IsWide { get; set; }
[XmlElement("Title")]
public string Title { get; set; }
[XmlElement("Lead")]
public string Lead { get; set; }
[XmlElement("Description")]
public string Description { get; set; }
[XmlElement("Meta-KeyWords")]
public string MetaKeyWords { get; set; }
[XmlElement("Meta-Description")]
public string MetaDescription { get; set; }
[XmlElement("Image")]
public string Image { get; set; }
[XmlElement("Link")]
public string Link { get; set; }
[XmlElement("Tags")]
public string Tags { get; set; }
[XmlElement("Download")]
public string Download { get; set; }
[XmlElement("JsFiddle")]
public string JsFiddle { get; set; }
[XmlElement("Suggested")]
public string Suggested { get; set; }
[XmlElement("RunApplication")]
public string RunApp { get; set; }
[XmlElement("Level")]
public int Level { get; set; }
[XmlArray("SupportedBrowsers")]
[XmlArrayItem(typeof(Browser))]
public List<Browser> SupportedBrowsers { get; set; }
[XmlArray("RelatedContents")]
[XmlArrayItem(typeof(ContentLink))]
public List<ContentLink> RelatedContents { get; set; }
[XmlAnyElement]
public XmlNode Includes { get; set; }
[XmlAnyElement("GalleryImages")]
public XmlNode GalleryImagesNode { get; set; }
[XmlIgnore]
public List<string> TagList
{
get
{
if (this.Tags == null) { return new List<string>(); }
return this.Tags.Split(',').Select(s => s.Trim()).ToList();
}
}
[XmlIgnore]
public List<string> LimitedTagList
{
get
{
if (this.Tags == null) { return new List<string>(); }
return this.Tags.Split(',').Take(4).Select(s => s.Trim()).ToList();
}
}
[XmlIgnore]
public int ComputedLevel
{
get
{
var i = string.IsNullOrEmpty(this.Suggested) ? 1 : -1;
return Level * i;
}
}
[XmlIgnore]
public List<XmlNode> ResolvedIncludes
{
get
{
var list = new List<XmlNode>();
if (this.Includes != null)
{
foreach (XmlNode node in this.Includes.SelectNodes("*"))
{
if (node.Name != "group")
{
list.Add(node);
}
else {
var nodeList = ExampleDoc.Instnace.GetIncludes(node.Attributes["name"].Value);
list = new List<XmlNode>( list.Concat(nodeList));
}
}
}
return list;
}
}
[XmlIgnore]
public string IncludesString
{
get {
var sb = new StringBuilder();
foreach (XmlNode node in this.ResolvedIncludes)
{
sb.AppendLine(node.OuterXml);
}
return sb.ToString();
}
}
public string GlobalIncludesString
{
get
{
return ExampleDoc.Instnace.GlobalIncludesString;
}
}
[XmlIgnore]
public XmlNodeList GalleryImages {
get {
if (this.GalleryImagesNode != null)
{
return this.GalleryImagesNode.SelectNodes("*");
}
return null;
}
}
public Example()
{
this.IsWide = false;
this.Level = 1000;
}
}
}