Removing unused code. Adjusting assemblyloaded method to match the exact name.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-11-03 15:24:10 -07:00
parent 760f8020a8
commit 6f15acaf5f
2 changed files with 3 additions and 67 deletions

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using Autofac.Features.OwnedInstances;
using Orchard.Environment.Extensions.Models;
using Orchard.Logging;
using Orchard.Mvc.ModelBinders;
using Orchard.Mvc.Routes;
@@ -17,21 +14,18 @@ namespace Orchard.Environment {
private readonly IRoutePublisher _routePublisher;
private readonly IEnumerable<IModelBinderProvider> _modelBinderProviders;
private readonly IModelBinderPublisher _modelBinderPublisher;
private readonly ViewEngineCollection _viewEngines;
public DefaultOrchardShell(
Func<Owned<IOrchardShellEvents>> eventsFactory,
IEnumerable<IRouteProvider> routeProviders,
IRoutePublisher routePublisher,
IEnumerable<IModelBinderProvider> modelBinderProviders,
IModelBinderPublisher modelBinderPublisher,
ViewEngineCollection viewEngines) {
IModelBinderPublisher modelBinderPublisher) {
_eventsFactory = eventsFactory;
_routeProviders = routeProviders;
_routePublisher = routePublisher;
_modelBinderProviders = modelBinderProviders;
_modelBinderPublisher = modelBinderPublisher;
_viewEngines = viewEngines;
Logger = NullLogger.Instance;
}
@@ -42,8 +36,6 @@ namespace Orchard.Environment {
_routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes()));
_modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));
//AddOrchardLocationsFormats();
using (var events = _eventsFactory()) {
events.Value.Activated();
}
@@ -54,62 +46,5 @@ namespace Orchard.Environment {
events.Value.Terminating();
}
}
/// <summary>
/// Adds view locations formats for non-themed views in custom orchard modules.
/// </summary>
private void AddOrchardLocationsFormats() {
IEnumerable<string> orchardMasterLocationFormats = new[] {
"~/Modules/{2}/Views/{1}/{0}.master",
"~/Modules/{2}/Views/Shared/{0}.master",
"~/Themes/{2}/Views/{1}/{0}.master",
"~/Themes/{2}/Views/Shared/{0}.master",
"~/Core/{2}/Views/{1}/{0}.master",
"~/Core/{2}/Views/Shared/{0}.master",
"~/Areas/{2}/Views/{1}/{0}.master",
"~/Areas/{2}/Views/Shared/{0}.master",
};
IEnumerable<string> orchardLocationFormats = new[] {
"~/Modules/{2}/Views/{1}/{0}.aspx",
"~/Modules/{2}/Views/{1}/{0}.ascx",
"~/Modules/{2}/Views/Shared/{0}.aspx",
"~/Modules/{2}/Views/Shared/{0}.ascx",
"~/Themes/{2}/Views/{1}/{0}.aspx",
"~/Themes/{2}/Views/{1}/{0}.ascx",
"~/Themes/{2}/Views/Shared/{0}.aspx",
"~/Themes/{2}/Views/Shared/{0}.ascx",
"~/Core/{2}/Views/{1}/{0}.aspx",
"~/Core/{2}/Views/{1}/{0}.ascx",
"~/Core/{2}/Views/Shared/{0}.aspx",
"~/Core/{2}/Views/Shared/{0}.ascx",
"~/Areas/{2}/Views/{1}/{0}.aspx",
"~/Areas/{2}/Views/{1}/{0}.ascx",
"~/Areas/{2}/Views/Shared/{0}.aspx",
"~/Areas/{2}/Views/Shared/{0}.ascx",
};
var viewEngine = _viewEngines.OfType<VirtualPathProviderViewEngine>().Single();
viewEngine.AreaMasterLocationFormats = orchardMasterLocationFormats
.Concat(viewEngine.AreaMasterLocationFormats)
.Distinct()
.ToArray();
viewEngine.AreaViewLocationFormats = orchardLocationFormats
.Concat(viewEngine.AreaViewLocationFormats)
.Distinct()
.ToArray();
viewEngine.AreaPartialViewLocationFormats = orchardLocationFormats
.Concat(viewEngine.AreaPartialViewLocationFormats)
.Distinct()
.ToArray();
}
private static string ModelsLocationFormat(ExtensionDescriptor descriptor) {
return Path.Combine(Path.Combine(descriptor.Location, descriptor.Name), "Views/Shared/{0}.ascx");
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Hosting;
using Orchard.Services;
@@ -36,7 +37,7 @@ namespace Orchard.Environment {
}
public bool IsAssemblyLoaded(string name) {
return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.FullName.Contains(name));
return AppDomain.CurrentDomain.GetAssemblies().Any(assembly => new AssemblyName(assembly.FullName).Name == name);
}
public void RestartAppDomain() {