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);
        }
    public static string AppendRule(string?input, StylesheetRule rule)
    {
        var contents = input;

        contents += Environment.NewLine + Environment.NewLine + rule;
        return(contents);
    }
        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);
        }
Exemple #4
0
		/////////////////////////////////////////////////////////////////////////////

		public Stylesheet Add( StylesheetRule sb )
		{
			Rules.Add( sb );
			return this;
		}