Ejemplo n.º 1
0
        public static void AppendRule(File input, StylesheetRule rule)
        {
            var contents = Encoding.UTF8.GetString(input.ContentBytes);

            contents          += Environment.NewLine + Environment.NewLine + rule.ToString();
            input.ContentBytes = Encoding.UTF8.GetBytes(contents);
        }
Ejemplo n.º 2
0
        public static void ReplaceRule(File input, string oldRuleName, StylesheetRule rule)
        {
            var contents  = Encoding.UTF8.GetString(input.ContentBytes);
            var ruleRegex = new Regex(string.Format(_ruleRegexFormat, oldRuleName), RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);

            contents           = ruleRegex.Replace(contents, rule != null ? rule.ToString() : "");
            input.ContentBytes = Encoding.UTF8.GetBytes(contents);
        }