2016-12-10 10:08:24 +08:00
|
|
|
|
using System.Globalization;
|
2016-08-22 04:49:38 +08:00
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using BuildFeed.Code.Options;
|
|
|
|
|
|
|
|
|
|
namespace BuildFeed.Code
|
|
|
|
|
{
|
2017-02-24 04:53:49 +08:00
|
|
|
|
public class OutputCachePushAttribute : ActionFilterAttribute
|
|
|
|
|
{
|
|
|
|
|
public override void OnResultExecuted(ResultExecutedContext filterContext)
|
|
|
|
|
{
|
|
|
|
|
bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
|
2018-02-07 06:16:37 +08:00
|
|
|
|
var theme = new Theme(Theme.DetectTheme(filterContext.HttpContext));
|
2016-08-22 04:49:38 +08:00
|
|
|
|
|
2017-02-24 04:53:49 +08:00
|
|
|
|
filterContext.HttpContext.Response.PushPromise("/res/css/default.css");
|
|
|
|
|
filterContext.HttpContext.Response.PushPromise(VirtualPathUtility.ToAbsolute(theme.CssPath));
|
|
|
|
|
if (isRtl)
|
|
|
|
|
{
|
|
|
|
|
filterContext.HttpContext.Response.PushPromise("/res/css/rtl.css");
|
|
|
|
|
}
|
2018-02-07 06:16:37 +08:00
|
|
|
|
|
2017-02-24 04:53:49 +08:00
|
|
|
|
filterContext.HttpContext.Response.PushPromise("/res/ts/bfs.js");
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-22 04:49:38 +08:00
|
|
|
|
}
|