Beispiel #1
0
        /// <inheritdoc />
        public void SetVariableWorkout(string serialNumber, IEnumerable <Interval> intervals)
        {
            if (string.IsNullOrWhiteSpace(serialNumber))
            {
                _logger.LogError("Serial number must not be null. No workout has been set.");
                return;
            }

            if (intervals == null)
            {
                _logger.LogError("Intervals must be defined. No workout has been set.");
                return;
            }

            IEnumerable <ICommand>?commands = BuildVariableWorkout(intervals);

            if (commands == null)
            {
                _logger.LogError("An error occurred while building commands for variable workout. No workout has been set.");
                return;
            }

            ICommandList commandList = _commandListFactory.Create(commands);

            commandList.Prepare();
            _pmCommunicator.Send(serialNumber, commandList);
        }
Beispiel #2
0
 protected void RaiseShowPopupMenu(ICommandList menu, System.Drawing.Point location)
 {
     if (ShouldShowPopupMenu != null)
     {
         ShouldShowPopupMenu(menu, location);
     }
 }
        public void CreateInputObject_Should_CreateNewInstance_When_CallFor_ICommandList()
        {
            ICommandList inputObject1 = _factory.CreateInputObject <ICommandList>();
            ICommandList inputObject2 = _factory.CreateInputObject <ICommandList>();

            Assert.AreNotSame(inputObject1, inputObject2);
        }
        /// <summary>
        /// Actually polls the device
        /// </summary>
        /// <param name="serialNumber">The serial number</param>
        /// <param name="pollIntervals">The intervals to poll for</param>
        /// <returns>The populated commands</returns>
        private ICommandList?ExecutePoll(string serialNumber, IEnumerable <PollInterval> pollIntervals)
        {
            ICommandList commands = _commandListFactory.Create();

            foreach (PollInterval pollInterval in pollIntervals)
            {
                try
                {
                    commands.AddRange(_pollIntervals[pollInterval]);
                }
                catch (Exception e)
                {
                    _logger.LogCritical("Could not add poll intervals");
                }
            }

            commands.Prepare();

            try
            {
                _pmCommunicator.Send(serialNumber, commands);
                return(commands);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Exception occurred while sending poll commands to serial number [{SerialNumber}]", serialNumber);
            }

            return(null);
        }
Beispiel #5
0
        public CommandExecutor(
            GameState state,
            ICommandList commands,
            IXleGameControl gameControl,
            IXleInput input,
            ISoundMan soundMan,
            IPlayerDeathHandler deathHandler,
            IPlayerAnimator characterAnimator,
            ITextArea textArea)
        {
            gameState           = state;
            this.commands       = commands;
            this.gameControl    = gameControl;
            this.input          = input;
            this.textArea       = textArea;
            this.soundMan       = soundMan;
            this.playerAnimator = characterAnimator;
            this.deathHandler   = deathHandler;

            input.DoCommand += (sender, args) =>
            {
                DoCommand(args.Command, args.KeyString);
            };

            mDirectionMap[Keys.Right] = Direction.East;
            mDirectionMap[Keys.Up]    = Direction.North;
            mDirectionMap[Keys.Left]  = Direction.West;
            mDirectionMap[Keys.Down]  = Direction.South;

            mDirectionMap[Keys.OemOpenBrackets] = Direction.North;
            mDirectionMap[Keys.OemSemicolon]    = Direction.West;
            mDirectionMap[Keys.OemQuotes]       = Direction.East;
            mDirectionMap[Keys.OemQuestion]     = Direction.South;
        }
Beispiel #6
0
        public override void SetCommands(ICommandList commands)
        {
            base.SetCommands(commands);

            commands.Items.Remove(commands.Items.First(x => x.Name == "Speak"));

            commands.Items.Add(CommandFactory.Speak("MarthbaneSpeak"));
        }
Beispiel #7
0
        /// <inheritdoc />
        public void TerminateWorkout(string serialNumber)
        {
            ICommandList commandList = _commandListFactory.Create();

            commandList.Add(new SetScreenStateCommand(ScreenType.Workout, ScreenValueWorkout.TerminateWorkout));
            commandList.Prepare();
            _pmCommunicator.Send(serialNumber, commandList);
        }
Beispiel #8
0
        public CustomBot()
        {
            bot = new TelegramBotClient("1041441332:AAHUjAvx8q15W9yuwRyaFxhzHHsp5z3DfQY");

            commands = new CommandList();

            bot.OnMessage += OnMessage;
        }
Beispiel #9
0
        public TelegramBot()
        {
            bot = new TelegramBotClient("959998721:AAGeoAdV8y8ApBCKMI57vO9ofjl6o6Xb7i4");

            commands = new CommandList();

            bot.OnMessage += OnMessage;
            OnLog?.Invoke(this, new BotLogEventArgs("", "Бот создан"));
        }
Beispiel #10
0
        /// <summary>
        /// Executes a deferred command list.
        /// </summary>
        /// <param name="commandList">The deferred command list.</param>
        public void ExecuteCommandList(ICommandList commandList)
        {
            if (commandList == null)
            {
                throw new ArgumentNullException("commandList");
            }

            NativeDeviceContext.ExecuteCommandList(((CommandList)commandList).NativeCommandList, false);
            commandList.Release();
        }
Beispiel #11
0
        public override void SetCommands(ICommandList commands)
        {
            base.SetCommands(commands);

            commands.Items.Remove(commands.Items.First(x => x.Name.Equals("Climb", StringComparison.OrdinalIgnoreCase)));

            commands.Items.Add(CommandFactory.Climb("BlackmireClimb"));

            commands.Items.Remove(commands.Items.First(x => x.Name.Equals("Use", StringComparison.OrdinalIgnoreCase)));

            commands.Items.Add(CommandFactory.Use("BlackmireUse"));
        }
Beispiel #12
0
 public TelegramBotService
 (
     ICommandList commandList,
     Bot bot,
     IUnitOfWorkFactory unitOfWorkFactory,
     ILogger <TelegramBotService> logger
 )
 {
     _commandList       = commandList;
     _client            = bot.Get();
     _unitOfWorkFactory = unitOfWorkFactory;
     _logger            = logger;
 }
Beispiel #13
0
        /// <inheritdoc />
        public void SetJustRowWorkout(string serialNumber, bool splits)
        {
            if (string.IsNullOrWhiteSpace(serialNumber))
            {
                _logger.LogError("Serial number must not be null. No workout has been set.");
                return;
            }

            IEnumerable <ICommand> commands = BuildJustRowWorkout(splits);

            ICommandList commandList = _commandListFactory.Create(commands);

            commandList.Prepare();
            _pmCommunicator.Send(serialNumber, commandList);
        }
Beispiel #14
0
 public XleRenderer(
     ICommandList commands,
     IXleImages images,
     IPlayerAnimator playerAnimator,
     IXleScreen screen,
     IRectangleRenderer rects,
     IStatsDisplay statsDisplay)
 {
     this.commands       = commands;
     this.images         = images;
     this.Screen         = screen;
     this.rects          = rects;
     this.playerAnimator = playerAnimator;
     this.statsDisplay   = statsDisplay;
 }
Beispiel #15
0
        public override void RenderEntity(Renderer renderer, ICommandList commandList, Node node, object renderableResource, int subEntity)
        {
            //Bind the render pipeline
            commandList.BindPipeline(pipeline);
            //Push the height/upper color/lower color to the fragment shader
            pushConstant
            .Write(1000.0f)
            .Write(0.22f, 0.2f, 0.13f, 1.0f)
            .Write(0.2f, 0.3f, 0.3f, 1.0f)
            .Commit(ShaderStage.FragmentShader, commandList);


            //draw a triangle(without vertex buffer)
            commandList.Draw(0, 3);
        }
Beispiel #16
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Fight("ArchiveFight"));
            commands.Items.Add(CommandFactory.Leave(promptText: "Leave the archives?"));
            commands.Items.Add(CommandFactory.Open("ArchiveOpen"));
            commands.Items.Add(CommandFactory.Rob());
            commands.Items.Add(CommandFactory.Take());
            commands.Items.Add(CommandFactory.Use("LobUse"));
            commands.Items.Add(CommandFactory.Xamine("ArchiveXamine"));
        }
Beispiel #17
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Hold());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Fight("MuseumFight"));
            commands.Items.Add(CommandFactory.Rob("LotaMuseumRob"));
            commands.Items.Add(CommandFactory.Take("MuseumTake"));
            commands.Items.Add(CommandFactory.Speak("MuseumSpeak"));
            commands.Items.Add(CommandFactory.Use("LotaMuseumUse"));
            commands.Items.Add(CommandFactory.Xamine("LotaMuseumXamine"));
        }
Beispiel #18
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Climb("TempleClimb"));
            commands.Items.Add(CommandFactory.Fight("TempleFight"));
            commands.Items.Add(CommandFactory.Leave());
            commands.Items.Add(CommandFactory.Magic("TempleMagic"));
            commands.Items.Add(CommandFactory.Speak());
            commands.Items.Add(CommandFactory.Use("LobUse"));
            commands.Items.Add(CommandFactory.Xamine());
        }
Beispiel #19
0
 public override void SetCommands(ICommandList commands)
 {
     commands.Items.Add(CommandFactory.Armor());
     commands.Items.Add(CommandFactory.Gamespeed());
     commands.Items.Add(CommandFactory.Hold());
     commands.Items.Add(CommandFactory.Inventory());
     commands.Items.Add(CommandFactory.Pass());
     commands.Items.Add(CommandFactory.Weapon());
     commands.Items.Add(CommandFactory.Disembark());
     commands.Items.Add(CommandFactory.End());
     commands.Items.Add(CommandFactory.Fight("OutsideFight"));
     commands.Items.Add(CommandFactory.Magic("LotaOutsideMagic"));
     commands.Items.Add(CommandFactory.Speak("OutsideSpeak"));
     commands.Items.Add(CommandFactory.Use("LotaUse"));
     commands.Items.Add(CommandFactory.Xamine("OutsideXamine"));
 }
Beispiel #20
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Fight("FightAgainstGuard"));
            commands.Items.Add(CommandFactory.Leave("TownLeave"));
            commands.Items.Add(CommandFactory.Magic("TownMagic"));
            commands.Items.Add(CommandFactory.Rob());
            commands.Items.Add(CommandFactory.Speak("TownSpeak"));
            commands.Items.Add(CommandFactory.Use("LobUse"));
            commands.Items.Add(CommandFactory.Xamine());
        }
Beispiel #21
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Hold());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Fight("FightAgainstGuard"));
            commands.Items.Add(CommandFactory.Magic("TownMagic"));
            commands.Items.Add(CommandFactory.Leave("TownLeave", confirmPrompt: Options.EnhancedUserInterface));
            commands.Items.Add(CommandFactory.Rob());
            commands.Items.Add(CommandFactory.Speak("TownSpeak"));
            commands.Items.Add(CommandFactory.Use("LotaUse"));
            commands.Items.Add(CommandFactory.Xamine());
        }
        public void Should_Throw_ArgumentOutOfRangeException_And_ReturnStartPosition_When_RoverGetsOutOfPlato()
        {
            IPosition startPosition = CurrentFactory.CreateInputObject <IPosition>();

            startPosition.X         = 3;
            startPosition.Y         = 3;
            startPosition.Direction = Direction.East;

            IDriver driver = new Driver.Driver(CurrentPlato, startPosition);

            ICommandList commandLists = CurrentFactory.CreateInputObject <ICommandList>();

            commandLists.AddRange("MMMMMM".Select(p => (CommandType)p).ToArray());

            Assert.Throws <ArgumentOutOfRangeException>(() => driver.Drive(commandLists));
            Assert.IsTrue(startPosition.Equals(driver.CurrentPosition));
        }
Beispiel #23
0
        public ConsoleBirthdayManager(TextWriter consoleTextWriter, TextReader consoleTextReader,
                                      TextWriter errorWriter = null)
        {
            this.TextWriter  = consoleTextWriter;
            this.TextReader  = consoleTextReader;
            this.ErrorWriter = errorWriter ?? TextWriter;

            Commands           = new CommandList();
            CommandListAdapter = new CommandListAdapter(TextWriter);
            CommandParser      = new CommandParserService(Commands);
            CommandReader      = new CommandReaderService(TextReader, CommandParser);

            var personValidator = new ValidatorFactory().NewValidator <Person>();

            PersonRepository  = new RepositoryFactory().NewRepository(StorageOption.Filesystem, personValidator);
            PersonListAdapter = new PersonListAdapter(TextWriter, ErrorWriter);
        }
Beispiel #24
0
        public override void SetCommands(ICommandList commands)
        {
            commands.Items.Add(CommandFactory.Armor());
            commands.Items.Add(CommandFactory.Gamespeed());
            commands.Items.Add(CommandFactory.Inventory());
            commands.Items.Add(CommandFactory.Pass());
            commands.Items.Add(CommandFactory.Weapon());

            commands.Items.Add(CommandFactory.Climb("DungeonClimb"));
            commands.Items.Add(CommandFactory.End());
            commands.Items.Add(CommandFactory.Fight("LobDungeonFight"));
            commands.Items.Add(CommandFactory.Magic("LobDungeonMagic"));
            commands.Items.Add(CommandFactory.Open("DungeonOpen"));
            commands.Items.Add(CommandFactory.Speak());
            commands.Items.Add(CommandFactory.Use("LobUse"));
            commands.Items.Add(CommandFactory.Xamine("LobDungeonXamine"));
        }
Beispiel #25
0
 public override void CorrectionSequence(ICommandList command)
 {
     Old.IsChange = true;
     if (Next != null && Next.IsChange == false)
     {
         if (Old.Type == eTypeObjectStream.Continue && Next.Type == eTypeObjectStream.Continue && Type != eTypeObjectStream.Acquisition)
         {
             Next.IsChange = true;
             command.Add(new ClearObjectCommand(((Command)command).Document, Parent, TypeCollection, Next.IndexEvent));
         }
         else if (Old.Type == eTypeObjectStream.Acquisition && Next.Type == eTypeObjectStream.Continue)
         {
             Next.IsChange = true;
             command.Add(new SetObjectCommand(((Command)command).Document, Parent, TypeCollection, Next.IndexEvent, eTypeObjectStream.Acquisition, ((ObjectSequence)Old).Acquisition));
         }
     }
 }
Beispiel #26
0
 public MapChanger(
     GameState gameState,
     IXleScreen screen,
     IXleImages images,
     ITextArea textArea,
     ICommandList commands,
     IMapLoader mapLoader,
     IMuseumCoinSale museumCoinSale)
 {
     this.gameState      = gameState;
     this.screen         = screen;
     this.images         = images;
     this.textArea       = textArea;
     this.commands       = commands;
     this.mapLoader      = mapLoader;
     this.museumCoinSale = museumCoinSale;
 }
Beispiel #27
0
        private TableContainer CreateCommandTableGUI(VisualElement root, ICommandList onStart, ICommandList onEnd)
        {
            var tableContainer = new TableContainer();

            root.Add(tableContainer);

            tableContainer.Add(new Label("Commands"));

            var columnContainer = new ColumnContainer();

            tableContainer.Add(columnContainer);

            CreateCommandList <OnStartColumnElement>(columnContainer, "On Start", onStart);
            CreateCommandList <OnEndColumnElement>(columnContainer, "On End", onEnd);

            return(tableContainer);
        }
Beispiel #28
0
        /// <inheritdoc />
        public void SetFixedWorkout(string serialNumber, Interval interval)
        {
            if (string.IsNullOrWhiteSpace(serialNumber))
            {
                _logger.LogError("Serial number must not be null. No workout has been set.");
                return;
            }

            if (interval == null)
            {
                _logger.LogError("Interval must be defined when setting a fixed workout. No workout has been set.");
                return;
            }

            switch (interval.WorkoutType)
            {
            case WorkoutType.FixedCalorieInterval:
            case WorkoutType.FixedCalorieWithSplits:
            case WorkoutType.FixedDistanceInterval:
            case WorkoutType.FixedDistanceNoSplits:
            case WorkoutType.FixedDistanceWithSplits:
            case WorkoutType.FixedTimeInterval:
            case WorkoutType.FixedTimeNoSplits:
            case WorkoutType.FixedTimeWithSplits:
            case WorkoutType.FixedWattMinuteWithSplits:
                break;

            default:
                _logger.LogError("Only fixed interval workout types with defined rest can be provided when setting a fixed workout. Now workout has been set.");
                return;
            }

            IEnumerable <ICommand>?commands = BuildFixedWorkout(interval);

            if (commands == null)
            {
                _logger.LogError("An error occurred while building commands for fixed workout. No workout has been set.");
                return;
            }

            ICommandList commandList = _commandListFactory.Create(commands);

            commandList.Prepare();
            _pmCommunicator.Send(serialNumber, commandList);
        }
Beispiel #29
0
 /// <summary>
 /// Корректирует объекты схемы в зависимости от текущего объекта команды
 /// </summary>
 /// <param name="command">Объект комманды</param>
 public virtual void CorrectionSequence(ICommandList command)
 {
     Old.IsChange = true;
     if (Next != null && Next.IsChange == false)
     {
         if (Old.Type == eTypeObjectStream.Continue && Next.Type == eTypeObjectStream.Continue && Type != eTypeObjectStream.TableShape)
         {
             Next.IsChange = true;
             command.Add(new ClearObjectCommand(((Command)command).Document, Parent, TypeCollection, Next.IndexEvent));
         }
         else if (Old.Type == eTypeObjectStream.TableShape && Next.Type == eTypeObjectStream.Continue)
         {
             Next.IsChange = true;
             command.Add(new SetObjectCommand(((Command)command).Document, Parent, TypeCollection, Next.IndexEvent, eTypeObjectStream.TableShape,
                                              ((ObjectStream)Parent[TypeCollection][IndexEvent]).Table));
         }
     }
 }
        /// <summary>
        /// Метод CommandProcessing() обрабатывает комманды пользователя.
        /// </summary>
        /// <param name="command">Наименование комманды передается в качестве параметра command.</param>
        /// <param name="myList">Пользовательский список передается в качестве параметра myList.</param>
        public static void CommandProcessing(string command, ICommandList <string> myList)
        {
            var commandArgs = command.Split();

            switch (commandArgs[0])
            {
            case "1":
                myList.Add(commandArgs[1]);
                break;

            case "2":
                myList.Remove(int.Parse(commandArgs[1]));
                break;

            case "3":
                Console.WriteLine(myList.Contains(commandArgs[1]));
                break;

            case "4":
                myList.Swap(int.Parse(commandArgs[1]), int.Parse(commandArgs[2]));
                break;

            case "5":
                Console.WriteLine(myList.CountGreaterThan(commandArgs[1]));
                break;

            case "6":
                Console.Write("Maximum element in the list: ");
                Console.WriteLine(myList.Max());
                break;

            case "7":
                Console.Write("Minimum element in the list: ");
                Console.WriteLine(myList.Min());
                break;

            case "8":
                myList.Print();
                break;

            default:
                break;
            }
        }
Beispiel #31
0
 protected void RaiseShowPopupMenu(ICommandList menu, System.Drawing.Point location)
 {
     if (ShouldShowPopupMenu != null)
     {
         ShouldShowPopupMenu(menu, location);
     }
 }
 /// <summary>
 /// Executes the command list.
 /// </summary>
 /// <param name="commandList">The command list.</param>
 public void ExecuteCommandList(ICommandList commandList)
 {
     throw new NotImplementedException();
 }
Beispiel #33
0
        /// <summary>
        /// Executes a deferred command list.
        /// </summary>
        /// <param name="commandList">The deferred command list.</param>
        public void ExecuteCommandList(ICommandList commandList)
        {
            if (commandList == null) throw new ArgumentNullException("commandList");

            NativeDeviceContext.ExecuteCommandList(((CommandList)commandList).NativeCommandList, false);
            commandList.Release();
        }
Beispiel #34
0
 public CommandSequence(ICommandList commandList, CommandsComplete allCommandsComplete)
 {
     _commandList = commandList;
       _allCommandsComplete = allCommandsComplete;
 }
Beispiel #35
0
 public void Dispose()
 {
     _commandList = null;
       _allCommandsComplete = null;
 }
Beispiel #36
0
 public void ShowPopupMenu(ICommandList menu, System.Drawing.Point location)
 {
     RaiseShowPopupMenu(menu, location);
 }