mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Removing unused code. Adjusting assemblyloaded method to match the exact name.
--HG-- branch : dev
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
|
||||||
using Autofac.Features.OwnedInstances;
|
using Autofac.Features.OwnedInstances;
|
||||||
using Orchard.Environment.Extensions.Models;
|
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using Orchard.Mvc.ModelBinders;
|
using Orchard.Mvc.ModelBinders;
|
||||||
using Orchard.Mvc.Routes;
|
using Orchard.Mvc.Routes;
|
||||||
@@ -17,21 +14,18 @@ namespace Orchard.Environment {
|
|||||||
private readonly IRoutePublisher _routePublisher;
|
private readonly IRoutePublisher _routePublisher;
|
||||||
private readonly IEnumerable<IModelBinderProvider> _modelBinderProviders;
|
private readonly IEnumerable<IModelBinderProvider> _modelBinderProviders;
|
||||||
private readonly IModelBinderPublisher _modelBinderPublisher;
|
private readonly IModelBinderPublisher _modelBinderPublisher;
|
||||||
private readonly ViewEngineCollection _viewEngines;
|
|
||||||
|
|
||||||
public DefaultOrchardShell(
|
public DefaultOrchardShell(
|
||||||
Func<Owned<IOrchardShellEvents>> eventsFactory,
|
Func<Owned<IOrchardShellEvents>> eventsFactory,
|
||||||
IEnumerable<IRouteProvider> routeProviders,
|
IEnumerable<IRouteProvider> routeProviders,
|
||||||
IRoutePublisher routePublisher,
|
IRoutePublisher routePublisher,
|
||||||
IEnumerable<IModelBinderProvider> modelBinderProviders,
|
IEnumerable<IModelBinderProvider> modelBinderProviders,
|
||||||
IModelBinderPublisher modelBinderPublisher,
|
IModelBinderPublisher modelBinderPublisher) {
|
||||||
ViewEngineCollection viewEngines) {
|
|
||||||
_eventsFactory = eventsFactory;
|
_eventsFactory = eventsFactory;
|
||||||
_routeProviders = routeProviders;
|
_routeProviders = routeProviders;
|
||||||
_routePublisher = routePublisher;
|
_routePublisher = routePublisher;
|
||||||
_modelBinderProviders = modelBinderProviders;
|
_modelBinderProviders = modelBinderProviders;
|
||||||
_modelBinderPublisher = modelBinderPublisher;
|
_modelBinderPublisher = modelBinderPublisher;
|
||||||
_viewEngines = viewEngines;
|
|
||||||
|
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
@@ -42,8 +36,6 @@ namespace Orchard.Environment {
|
|||||||
_routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes()));
|
_routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes()));
|
||||||
_modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));
|
_modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));
|
||||||
|
|
||||||
//AddOrchardLocationsFormats();
|
|
||||||
|
|
||||||
using (var events = _eventsFactory()) {
|
using (var events = _eventsFactory()) {
|
||||||
events.Value.Activated();
|
events.Value.Activated();
|
||||||
}
|
}
|
||||||
@@ -54,62 +46,5 @@ namespace Orchard.Environment {
|
|||||||
events.Value.Terminating();
|
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Hosting;
|
using System.Web.Hosting;
|
||||||
using Orchard.Services;
|
using Orchard.Services;
|
||||||
@@ -36,7 +37,7 @@ namespace Orchard.Environment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool IsAssemblyLoaded(string name) {
|
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() {
|
public void RestartAppDomain() {
|
||||||
|
Reference in New Issue
Block a user