mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Web.Hosting;
|
|
using Orchard.Environment;
|
|
using Orchard.Localization;
|
|
|
|
namespace Orchard.Commands {
|
|
public class OrchardCommandHostRetryException : OrchardCoreException {
|
|
public OrchardCommandHostRetryException(LocalizedString message)
|
|
: base(message) {
|
|
}
|
|
|
|
public OrchardCommandHostRetryException(LocalizedString message, Exception innerException)
|
|
: base(message, innerException) {
|
|
}
|
|
|
|
protected OrchardCommandHostRetryException(SerializationInfo info, StreamingContext context)
|
|
: base(info, context) {
|
|
}
|
|
}
|
|
|
|
public class CommandHostEnvironment : IHostEnvironment {
|
|
public CommandHostEnvironment() {
|
|
T = NullLocalizer.Instance;
|
|
}
|
|
|
|
public Localizer T { get; set; }
|
|
|
|
public bool IsFullTrust {
|
|
get { return AppDomain.CurrentDomain.IsFullyTrusted; }
|
|
}
|
|
|
|
public string MapPath(string virtualPath) {
|
|
return HostingEnvironment.MapPath(virtualPath);
|
|
}
|
|
|
|
public bool IsAssemblyLoaded(string name) {
|
|
return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == name);
|
|
}
|
|
|
|
public void RestartAppDomain() {
|
|
ResetSiteCompilation();
|
|
}
|
|
|
|
public void ResetSiteCompilation() {
|
|
throw new OrchardCommandHostRetryException(T("A change of configuration requires the session to be restarted."));
|
|
}
|
|
}
|
|
} |