Rebel.Cms.Web.StylesheetHelper.ReplaceRule C# (CSharp) Method

ReplaceRule() public static method

public static ReplaceRule ( File input, string oldRuleName, StylesheetRule rule ) : void
input Rebel.Framework.Persistence.Model.IO.File
oldRuleName string
rule Rebel.Cms.Web.Model.StylesheetRule
return void
        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);
        }