BuildFeed/BuildFeed/Code/OutputCachePushAttribute.cs

27 lines
909 B
C#
Raw Normal View History

2016-08-22 04:49:38 +08:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BuildFeed.Code.Options;
namespace BuildFeed.Code
{
public class OutputCachePushAttribute: ActionFilterAttribute
{
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
Theme theme = new Theme(Theme.DetectTheme(filterContext.HttpContext));
2016-11-05 09:36:36 +08:00
filterContext.HttpContext.Response.PushPromise("/res/css/default.css");
2016-08-22 04:49:38 +08:00
filterContext.HttpContext.Response.PushPromise(VirtualPathUtility.ToAbsolute(theme.CssPath));
if (isRtl)
{
2016-11-05 09:36:36 +08:00
filterContext.HttpContext.Response.PushPromise("/res/css/rtl.css");
2016-08-22 04:49:38 +08:00
}
filterContext.HttpContext.Response.PushPromise("/res/ts/bfs.min.js");
}
}
}