"orchard.exe" can now invoke the CommandAgent

The CommandAgent merely initalizes an Orchard Host and Shell (for now).

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-04-07 17:45:08 -07:00
parent d3cd35600b
commit 118920bbab
7 changed files with 66 additions and 2 deletions

View File

@@ -18,5 +18,10 @@ namespace Orchard.Host {
public void Stop(bool immediate) {
//TODO
}
public void RunCommand(string[] args) {
var agent = Activator.CreateInstance("Orchard.Framework", "Orchard.Commands.CommandAgent").Unwrap();
agent.GetType().GetMethod("RunSingleCommand").Invoke(agent, new object[] { args });
}
}
}

View File

@@ -21,6 +21,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>

View File

@@ -8,5 +8,6 @@ namespace Orchard {
public bool Verbose { get; set; }
public string VirtualPath { get; set; }
public string WorkingDirectory { get; set; }
public string Tenant { get; set; }
}
}

View File

@@ -10,8 +10,9 @@ namespace Orchard {
}
public class OrchardArgumentsParser : IOrchardArgumentsParser {
public OrchardArguments Parse(ParserResult arguments) {
OrchardArguments result = new OrchardArguments();
var result = new OrchardArguments();
foreach (var sw in arguments.Switches) {
switch (sw.Name.ToLowerInvariant()) {
@@ -29,6 +30,11 @@ namespace Orchard {
case "virtualpath":
result.VirtualPath = sw.Value;
break;
case "t":
case "tenant":
result.Tenant = sw.Value;
break;
}
}

View File

@@ -41,8 +41,16 @@ namespace Orchard {
Console.WriteLine("Detected and using orchard directory \"{0}\"", orchardDirectory.FullName);
}
object host = CreateWorkerAppDomainWithHost(arguments.VirtualPath, orchardDirectory.FullName, typeof(CommandHost));
if (arguments.Verbose) {
Console.WriteLine("Creating ASP.NET AppDomain for command agent");
}
var host = (CommandHost)CreateWorkerAppDomainWithHost(arguments.VirtualPath, orchardDirectory.FullName, typeof(CommandHost));
if (arguments.Verbose) {
Console.WriteLine("Executing command in ASP.NET AppDomain");
}
host.RunCommand(_args);
}
private DirectoryInfo GetOrchardDirectory(string directory) {