Skip to content

Commit

Permalink
Changed the name of SpecialModesFileResolver to DisplayModesFileResol…
Browse files Browse the repository at this point in the history
…ver and moved it to Composite.AspNet namespace.
  • Loading branch information
burningice2866 committed Feb 19, 2016
1 parent 99d4275 commit 1b03ba8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;
using System.IO;
using System.IO;
using System.Web;
using System.Web.Hosting;
using System.Web.WebPages;

namespace Composite.Core.IO
namespace Composite.AspNet
{
/// <exclude />
public static class SpecialModesFileResolver
public static class DisplayModesFileResolver
{
/// <exclude />
public static string ResolveFileInInDirectory(string directory, string file, string extension, HttpContextBase context)
Expand All @@ -17,7 +16,7 @@ public static string ResolveFileInInDirectory(string directory, string file, str

foreach (var mode in modes)
{
var specialFile = Path.Combine(directory, String.Format("{0}{1}", file, extension));
var specialFile = Path.Combine(directory, $"{file}{extension}");

var displayInfo = mode.GetDisplayInfo(context, specialFile, pathProvider.FileExists);
if (displayInfo != null)
Expand Down
4 changes: 1 addition & 3 deletions Composite/AspNet/Razor/RazorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//using System.Web.Instrumentation;
using System.Web.WebPages;
using System.Xml;
using System.Xml.Linq;
using Composite.Core.IO;
//using Composite.Core.Extensions;
//using Composite.Core.IO;
using Composite.Core.Types;
Expand Down Expand Up @@ -45,7 +43,7 @@ public static object ExecuteRazorPage(
var directory = Path.GetDirectoryName(virtualPath);
var function = Path.GetFileNameWithoutExtension(virtualPath);

virtualPath = SpecialModesFileResolver.ResolveFileInInDirectory(directory, function, ".cshtml", new HttpContextWrapper(currentContext));
virtualPath = DisplayModesFileResolver.ResolveFileInInDirectory(directory, function, ".cshtml", new HttpContextWrapper(currentContext));
}

webPage = WebPageBase.CreateInstanceFromVirtualPath(virtualPath);
Expand Down
2 changes: 1 addition & 1 deletion Composite/Composite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<Compile Include="C1Console\Trees\SortDirection.cs" />
<Compile Include="Core\Application\ServiceLocator.cs" />
<Compile Include="Core\Application\Job.cs" />
<Compile Include="Core\IO\SpecialModesFileResolver.cs" />
<Compile Include="AspNet\DisplayModesFileResolver.cs" />
<Compile Include="Core\Caching\FileRelatedDataCache.cs" />
<Compile Include="Core\Extensions\StackTraceExtensionMethods.cs" />
<Compile Include="Core\Instrumentation\LogExecutionTime.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Web;
using System.Web.UI;
using Composite.AspNet;
using Composite.Core.Application;
using Composite.Core.IO;
using Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;

Expand Down Expand Up @@ -56,9 +55,9 @@ public override object Execute(Composite.Functions.ParameterList parameters,

var directory = Path.GetDirectoryName(VirtualPath);
var function = Path.GetFileNameWithoutExtension(VirtualPath);
var virtualPath = SpecialModesFileResolver.ResolveFileInInDirectory(directory, function, ".ascx", new HttpContextWrapper(httpContext));
var virtualPath = DisplayModesFileResolver.ResolveFileInInDirectory(directory, function, ".ascx", new HttpContextWrapper(httpContext));

var userControl = currentPage.LoadControl(VirtualPath);
var userControl = currentPage.LoadControl(virtualPath);


foreach (var param in parameters.AllParameterNames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.Linq;
using System.Web;
using Composite.AspNet;
using Composite.C1Console.Security;
using Composite.Core.Collections.Generic;
using Composite.Core.Extensions;
using Composite.Core.IO;
using Composite.Core.PageTemplates;
using Composite.Core.WebClient.Renderings.Page;
using Composite.Core.Xml;
using Composite.Data.Types;


namespace Composite.Plugins.PageTemplates.MasterPages
{
internal class MasterPagePageRenderer : IPageRenderer
Expand Down Expand Up @@ -57,7 +55,7 @@ public void AttachToPage(Page aspnetPage, PageContentToRender contentToRender)

var dir = Path.GetDirectoryName(rendering.VirtualPath);
var template = Path.GetFileNameWithoutExtension(rendering.VirtualPath);
var file = SpecialModesFileResolver.ResolveFileInInDirectory(dir, template, ".master", new HttpContextWrapper(HttpContext.Current));
var file = DisplayModesFileResolver.ResolveFileInInDirectory(dir, template, ".master", new HttpContextWrapper(HttpContext.Current));

aspnetPage.MasterPageFile = file;
aspnetPage.PreRender += (e, args) => PageOnPreRender(aspnetPage, contentToRender.Page);
Expand Down
4 changes: 2 additions & 2 deletions Composite/Plugins/PageTemplates/Razor/RazorPageRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using System.Web.UI;
using System.Web.WebPages;
using System.Xml.Linq;
using Composite.AspNet;
using Composite.AspNet.Razor;
using Composite.Core.Collections.Generic;
using Composite.Core.Extensions;
using Composite.Core.Instrumentation;
using Composite.Core.IO;
using Composite.Core.PageTemplates;
using Composite.Core.WebClient.Renderings.Page;
using Composite.Functions;
Expand Down Expand Up @@ -64,7 +64,7 @@ private void RendererPage(object sender, EventArgs e)
{
var directory = Path.GetDirectoryName(renderingInfo.ControlVirtualPath);
var template = Path.GetFileNameWithoutExtension(renderingInfo.ControlVirtualPath);
var file = SpecialModesFileResolver.ResolveFileInInDirectory(directory, template, ".cshtml", new HttpContextWrapper(HttpContext.Current));
var file = DisplayModesFileResolver.ResolveFileInInDirectory(directory, template, ".cshtml", new HttpContextWrapper(HttpContext.Current));

webPage = WebPageBase.CreateInstanceFromVirtualPath(file);

Expand Down

0 comments on commit 1b03ba8

Please sign in to comment.