Add vw start and vw stop
This commit is contained in:
parent
09a35bc7d6
commit
41650c4106
|
@ -6,6 +6,7 @@ using LyokoCMD.Sim;
|
|||
using LyokoCMD.Sim.Virtual;
|
||||
using LyokoCMD.Sim.Virtual.World;
|
||||
using LyokoCMD.CommandLine.Apps;
|
||||
using LyokoCMD.Sim.Workers;
|
||||
|
||||
namespace LyokoCMD.CommandLine.Commands
|
||||
{
|
||||
|
@ -19,11 +20,13 @@ namespace LyokoCMD.CommandLine.Commands
|
|||
|
||||
public override void Run(CommandApp app, string[] args)
|
||||
{
|
||||
Supercomputer sc = Game.Objects.Get<Supercomputer>();
|
||||
if (!sc.Running) throw new InvalidOperationException("Impossible de se connecter au supercalculateur.");
|
||||
if (!sc.GetWorker("lyoko").Running) throw new InvalidOperationException("Monde virtuel arrêté.");
|
||||
if (args.Length < 1) throw new ArgumentException(HelpText);
|
||||
switch (args[0].ToLower())
|
||||
Supercomputer sc = Game.Objects.Get<Supercomputer>();
|
||||
if (!sc.Running)
|
||||
throw new InvalidOperationException("Impossible de se connecter au supercalculateur.");
|
||||
if (!sc.Workers.Get<VirtualWorldWorker>().Running && args[0].ToLower().Trim() != "start")
|
||||
throw new InvalidOperationException("Monde virtuel arrêté.");
|
||||
switch (args[0].ToLower().Trim())
|
||||
{
|
||||
case "sectors":
|
||||
Console.WriteLine(Text.BuildTable(Game.Objects.Get<VirtualWorld>().Sectors));
|
||||
|
@ -38,6 +41,12 @@ namespace LyokoCMD.CommandLine.Commands
|
|||
app.Settings
|
||||
).Run();
|
||||
break;
|
||||
case "start":
|
||||
sc.Workers.Get<VirtualWorldWorker>().Start();
|
||||
break;
|
||||
case "stop":
|
||||
sc.Workers.Get<VirtualWorldWorker>().Stop();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(HelpText);
|
||||
}
|
||||
|
|
Reference in New Issue