-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsample.txt
82 lines (82 loc) · 3.37 KB
/
sample.txt
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
using System;
using System.Text.RegularExpressions;
namespace SharpVectors.Dom.Css
{
/// <summary>
/// The CSSFontFaceRule interface represents a @font-face rule in a CSS style sheet. The @font-face rule is used to hold a set of font descriptions.
/// </summary>
/// <developer>[email protected]</developer>
/// <completed>80</completed>
public class CssFontFaceRule : CssRule, ICssFontFaceRule
{
#region Static members
private static Regex regex = new Regeх(@"^@font-face");
/// <summary>
/// Parses a string containging CSS and creates a CssFontFaceRule instance if found as the first content
/// </summary>
internal static CssRule Parse(ref string css, object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin)
{
Match match = regex.Match(css);
if(match.Success)
{
CssFontFaceRule rule = new CssFontFaceRule(match, parent, readOnly, replacedStrings, origin);
css = css.Substring(match.Length);
rule.style = new CssStyleDeclaration(ref css, rule, true, origin);
return rule;
}
else
{
// didn't match => do nothing
return null;
}
}
#endregion
#region Constructors
/// <summary>
/// The constructor for CssFontFaceRule
/// </summary>
/// <param name="match">The Regex match that found the charset rule</param>
/// <param name="parent">The parent rule or parent stylesheet</param>
/// <param name="readOnly">True if this instance is readonly</param>
/// <param name="replacedStrings">An array of strings that have been replaced in the string used for matching. These needs to be put back use the DereplaceStrings method</param>
/// <param name="origin">The type of CssStyleSheet</param>
internal CssFontFaceRule(Match match, object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin) : base(parent, true, replacedStrings, origin)
{
// always read-only
}
#endregion
#region Implementation of ICssFontFaceRule
private CssStyleDeclaration style;
/// <summary>
/// The declaration-block of this rule.
/// </summary>
public ICssStyleDeclaration Style
{
get
{
return style;
}
}
#endregion
#region Implementation of ICssRule
/// <summary>
/// The type of the rule. The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type.
/// </summary>
public override CssRuleType Type
{
get
{
return CssRuleType.FontFaceRule;
}
}
#endregion
}
}