コード例 #1
0
 public IEngine()
 {
     championshipController = new ChampionshipController();
 }
コード例 #2
0
 public Engine(IReader reader, IWriter writer)
 {
     this.reader            = reader;
     this.writer            = writer;
     championshipController = new ChampionshipController();
 }
コード例 #3
0
ファイル: IEngine.cs プロジェクト: rosenkolev1/SoftUni-1
        public void Run()
        {
            var input   = string.Empty;
            var handler = new ChampionshipController();

            while ((input = Console.ReadLine()) != "End")
            {
                try
                {
                    var args    = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
                    var command = args[0];
                    switch (command)
                    {
                    case "CreateRider":
                        var name = args[1];
                        Console.WriteLine(handler.CreateRider(name));

                        break;

                    case "CreateMotorcycle":
                        var type  = args[1];
                        var model = args[2];
                        var power = int.Parse(args[3]);
                        Console.WriteLine(handler.CreateMotorcycle(type, model, power));

                        break;

                    case "AddMotorcycleToRider":
                        var ridarName = args[1];
                        var motorName = args[2];
                        Console.WriteLine(handler.AddMotorcycleToRider(ridarName, motorName));

                        break;

                    case "AddRiderToRace":
                        var raceName   = args[1];
                        var ridaarName = args[2];
                        Console.WriteLine(handler.AddRiderToRace(raceName, ridaarName));

                        break;

                    case "CreateRace":
                        var nname = args[1];
                        var laps  = int.Parse(args[2]);
                        Console.WriteLine(handler.CreateRace(nname, laps));
                        break;

                    case "StartRace":
                        var raaaceName = args[1];
                        Console.WriteLine(handler.StartRace(raaaceName));
                        break;
                    }
                }
                catch (InvalidOperationException target)
                {
                    Console.WriteLine(target.Message);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }
        }
コード例 #4
0
ファイル: Engine.cs プロジェクト: AngelHristov/MXGP
 public Engine()
 {
     controler     = new ChampionshipController();
     consoleReader = new ConsoleReader();
     consoleWriter = new ConsoleWriter();
 }
コード例 #5
0
 public IEngine()
 {
     this.reader     = new ConsoleReader();
     this.writer     = new ConsoleWriter();
     this.controller = new ChampionshipController();
 }