Exemple #1
0
 public PostCategoryCommanderServices(ICommander <PostCategory> commader, IMapper mapper,
                                      IFilter <PostCategory> filter) : base(commader, mapper)
 {
     _commader = commader;
     _mapper   = mapper;
     _filter   = filter;
 }
Exemple #2
0
 public Queue(IClock clock, ICommander commander, IDb db, UserContext userContext)
 {
     _clock = clock;
     _commander = commander;
     _db = db;
     _userContext = userContext;
 }
Exemple #3
0
        public static async Task Call(this ICommander commander,
                                      ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = await commander.Run(command, isolate, cancellationToken).ConfigureAwait(false);

            await context.UntypedResultTask.ConfigureAwait(false);
        }
Exemple #4
0
        public void SellCommand(ICommander order)
        {
            Console.WriteLine("Calling Invoker Class");
            Console.WriteLine("Sell Command");

            _commands.Add(order);
        }
Exemple #5
0
        /// <summary>
        /// Serializes an object that implements ICommander and places it into the packet.
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="commander"></param>
        public static void AddCommander(this Packet packet, ICommander commander)
        {
            packet.PutInt(commander.Handle);
            packet.PutInt(0);
            packet.AddAppearancePc(commander);
            packet.PutFloat(commander.Position.X);
            packet.PutFloat(commander.Position.Y);
            packet.PutFloat(commander.Position.Z);
            packet.PutInt(commander.Exp);
            packet.PutInt(commander.MaxExp);
            packet.PutInt(commander.TotalExp);

            packet.PutLong(commander.Id);

            // TODO: Assign new IDs to characters such that the social ID does not conflict.
            packet.PutLong(commander.Id + 1);               // SocialInfoId

            packet.PutInt(commander.Hp);
            packet.PutInt(commander.MaxHp);
            packet.PutShort(commander.Sp);
            packet.PutShort(commander.MaxSp);
            packet.PutInt(commander.Stamina);
            packet.PutInt(commander.MaxStamina);
            packet.PutShort(0);             // Shield
            packet.PutShort(0);             // MaxShield
        }
Exemple #6
0
 /// <summary>
 /// Register a module commander.
 /// </summary>
 /// <param name="commander"></param>
 public void RegisterModuleCommander(ICommander commander)
 {
     lock (m_moduleCommanders)
     {
         m_moduleCommanders.Add(commander.Name, commander);
     }
 }
Exemple #7
0
 public CommandsController(ICommander commander, CommandProfile mapper, ILogger <CommandsController> logger, TelemetryClient telemetryClient)    //IMapper mapper
 {
     _commander       = commander;
     _mapper          = mapper;
     _logger          = logger;
     _telemetryClient = telemetryClient;
 }
Exemple #8
0
 public MissionService(IUnitOfWork unitOfWork, ICommander commander, IIdentityProvider identityProvider,
                       ICommandFactory commandFactory)
 {
     _unitOfWork       = unitOfWork;
     _commander        = commander;
     _identityProvider = identityProvider;
     _commandFactory   = commandFactory;
 }
Exemple #9
0
        public static CommandContext Start(this ICommander commander,
                                           ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = CommandContext.New(commander, command, isolate);

            commander.Run(context, isolate, cancellationToken).Ignore();
            return(context);
        }
Exemple #10
0
        public static async Task <CommandContext> Run(this ICommander commander,
                                                      ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = CommandContext.New(commander, command, isolate);
            await commander.Run(context, isolate, cancellationToken).ConfigureAwait(false);

            return(context);
        }
Exemple #11
0
        // CallAsync overloads

        public static async Task <TResult> CallAsync <TResult>(this ICommander commander,
                                                               ICommand <TResult> command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context      = commander.Start(command, isolate, cancellationToken);
            var typedContext = (CommandContext <TResult>)context;

            return(await typedContext.ResultTask.ConfigureAwait(false));
        }
Exemple #12
0
        public WatcherHost(ICommander commander, IIgnorePatternCollection ignorePatternCollection, ILogger logger, IWatcher watcher)
        {
            _commander = commander;
            _ignorePatternCollection = ignorePatternCollection;
            _logger  = logger;
            _watcher = watcher;

            _watcher.FileChanged += FileChanged;
        }
Exemple #13
0
 public Game(ICommander console, IServiceProvider gameServices, CommandMap allCommands, CommandMap globalCommands, ISet <Type> areas, IGameOptions gameOptions)
 {
     Commander       = console;
     GameOptions     = gameOptions;
     _gameServices   = gameServices;
     _allCommands    = allCommands;
     _globalCommands = globalCommands;
     _areas          = areas;
 }
Exemple #14
0
        private void HandleCommanderHelp(string module, string[] cmd)
        {
            // Only safe for the interactive console, since it won't
            // let us come here unless both scene and commander exist
            ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]);

            if (moduleCommander != null)
            {
                m_console.Notice(moduleCommander.Help);
            }
        }
    public void AddWorker(string FullName, string Position, decimal Wage, ICommander commander)
    {
        Worker worker = new Worker()
        {
            FullName = FullName,
            Position = Position,
            Wage     = Wage
        };

        commander.AddSubordinate(worker);
    }
Exemple #16
0
 public CompletionProducer(Options?options,
                           ICommander commander,
                           AgentInfo agentInfo,
                           ILogger <CompletionProducer>?log = null)
 {
     options ??= new();
     Log       = log ?? NullLogger <CompletionProducer> .Instance;
     LogLevel  = options.LogLevel;
     AgentInfo = agentInfo;
     Commander = commander;
 }
Exemple #17
0
 public OperationInvalidator(
     ICommander commander,
     AgentInfo agentInfo,
     IInvalidationInfoProvider invalidationInfoProvider,
     ILogger <OperationInvalidator>?log = null)
 {
     Log       = log ?? NullLogger <OperationInvalidator> .Instance;
     AgentInfo = agentInfo;
     InvalidationInfoProvider = invalidationInfoProvider;
     Commander = commander;
 }
Exemple #18
0
        public CompletionProducer(Options?options,
                                  ICommander commander,
                                  AgentInfo agentInfo,
                                  ILogger <CompletionProducer>?log = null)
        {
            options ??= new();
            Log = log ?? NullLogger <CompletionProducer> .Instance;
            IsLoggingEnabled = options.IsLoggingEnabled && Log.IsEnabled(LogLevel);

            AgentInfo = agentInfo;
            Commander = commander;
        }
 /// <summary>
 /// Register a module commander.
 /// </summary>
 /// <param name="commander"></param>
 public void RegisterModuleCommander(ICommander commander)
 {
     m_moduleCommandersRwLock.AcquireWriterLock(-1);
     try
     {
         m_moduleCommanders.Add(commander.Name, commander);
     }
     finally
     {
         m_moduleCommandersRwLock.ReleaseWriterLock();
     }
 }
Exemple #20
0
        public WatcherHost(ICommander commander, ILogger logger, IIgnorePatternCollection ignorePatternCollection)
        {
            _commander = commander;
            _logger    = logger;
            _ignorePatternCollection = ignorePatternCollection;

            _watcher = new FileSystemWatcher(Directory.GetCurrentDirectory());
            _watcher.IncludeSubdirectories = true;

            _watcher.NotifyFilter = NotifyFilters.LastWrite;
            _watcher.Changed     += FileChanged;
        }
 public void ChangeFollower(ICommander commander, NPCController follower)
 {
     for (int j = 0; j < stationNPC.Length; j++)
     {
         if (stationNPC[j] == follower)
         {
             return;
         }
     }
     follower.ClearAllCommand();
     commander.AddFollower(follower);
     Followers.Remove(follower);
 }
Exemple #22
0
        protected virtual void AddPluginCommands(ICommandConsole console)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            List <string> topics = GetHelpTopics();

            foreach (string topic in topics)
            {
                string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);

                // This is a hack to allow the user to enter the help command in upper or lowercase.  This will go
                // away at some point.
                console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
                                            "help " + capitalizedTopic,
                                            "Get help on plugin command '" + topic + "'",
                                            HandleCommanderHelp);
                console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
                                            "help " + capitalizedTopic,
                                            "Get help on plugin command '" + topic + "'",
                                            HandleCommanderHelp);

                ICommander commander = null;

                Scene s = SceneManager.CurrentOrFirstScene;

                if (s != null && s.GetCommanders() != null)
                {
                    if (s.GetCommanders().ContainsKey(topic))
                    {
                        commander = s.GetCommanders()[topic];
                    }
                }

                if (commander == null)
                {
                    continue;
                }

                foreach (string command in commander.Commands.Keys)
                {
                    console.Commands.AddCommand(capitalizedTopic, false,
                                                topic + " " + command,
                                                topic + " " + commander.Commands[command].ShortHelp(),
                                                String.Empty, HandleCommanderCommand);
                }
            }
        }
Exemple #23
0
        protected virtual void AddPluginCommands()
        {
            // If console exists add plugin commands.
            if (m_console != null)
            {
                List <string> topics = GetHelpTopics();

                foreach (string topic in topics)
                {
                    string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);

                    // This is a hack to allow the user to enter the help command in upper or lowercase.  This will go
                    // away at some point.
                    m_console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
                                                  "help " + capitalizedTopic,
                                                  "Get help on plugin command '" + topic + "'",
                                                  HandleCommanderHelp);
                    m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
                                                  "help " + capitalizedTopic,
                                                  "Get help on plugin command '" + topic + "'",
                                                  HandleCommanderHelp);

                    ICommander commander = null;

                    Scene s = SceneManager.CurrentOrFirstScene;

                    if (s != null && s.GetCommanders() != null)
                    {
                        if (s.GetCommanders().ContainsKey(topic))
                        {
                            commander = s.GetCommanders()[topic];
                        }
                    }

                    if (commander == null)
                    {
                        continue;
                    }

                    foreach (string command in commander.Commands.Keys)
                    {
                        m_console.Commands.AddCommand(capitalizedTopic, false,
                                                      topic + " " + command,
                                                      topic + " " + commander.Commands[command].ShortHelp(),
                                                      String.Empty, HandleCommanderCommand);
                    }
                }
            }
        }
Exemple #24
0
        public Match(Player white, Player black)
        {
            Board     = new Board(new Coord(9, 9));
            WhitePool = new Pool(true);
            BlackPool = new Pool(false);
            Turn      = new Turn();

            WhitePlayer = white;
            BlackPlayer = black;

            History = new History();

            _textRenderer  = new TextRenderer(Console.Out);
            _textCommander = new TextCommander(Console.In);
        }
 public FusionState(
     IStateFactory stateFactory,
     Session session,
     ICommander commander,
     Func <CancellationToken, Task <T> > computeState,
     Action <FusionStateStatusEnum> onLiveStateChanged)
 {
     StateFactory = stateFactory;
     Session      = session;
     Commander    = commander;
     ComputeState = computeState;
     HandleStateChangedInternal = (state, eventKind) => {
         var status = CurrentFusionStateStatus();
         //if (eventKind == StateEventKind.Updated)
         onLiveStateChanged(status);
     };
 }
Exemple #26
0
        protected virtual void AddPluginCommands()
        {
            // If console exists add plugin commands.
            if (m_console != null)
            {
                List <string> topics = GetHelpTopics();

                foreach (string topic in topics)
                {
                    m_console.Commands.AddCommand("plugin", false, "help " + topic,
                                                  "help " + topic,
                                                  "Get help on plugin command '" + topic + "'",
                                                  HandleCommanderHelp);

                    m_console.Commands.AddCommand("plugin", false, topic,
                                                  topic,
                                                  "Execute subcommand for plugin '" + topic + "'",
                                                  null);

                    ICommander commander = null;

                    Scene s = SceneManager.CurrentOrFirstScene;

                    if (s != null && s.GetCommanders() != null)
                    {
                        if (s.GetCommanders().ContainsKey(topic))
                        {
                            commander = s.GetCommanders()[topic];
                        }
                    }

                    if (commander == null)
                    {
                        continue;
                    }

                    foreach (string command in commander.Commands.Keys)
                    {
                        m_console.Commands.AddCommand(topic, false,
                                                      topic + " " + command,
                                                      topic + " " + commander.Commands[command].ShortHelp(),
                                                      String.Empty, HandleCommanderCommand);
                    }
                }
            }
        }
Exemple #27
0
 public StatusProcessor(ILogger <StatusProcessor> log, IShip ship, ICommander commander, INavRoute navRoute,
                        ICargo cargo, IMarket market, IModules modules, IBackpack backpack, IShipyard shipyard,
                        IOutfitting outfitting, IFileReader fileReader)
 {
     _log        = log;
     _ship       = ship;
     _commander  = commander;
     _navRoute   = navRoute;
     _cargo      = cargo;
     _market     = market;
     _modules    = modules;
     _backpack   = backpack;
     _shipyard   = shipyard;
     _outfitting = outfitting;
     _fileReader = fileReader;
     _cache      = new Dictionary <string, string>();
 }
Exemple #28
0
 public TodoPageStore(
     IStateFactory stateFactory,
     Session session,
     ITodoService todoService,
     ICommander commander)
 {
     if (todoService == null)
     {
         throw new ArgumentNullException(nameof(todoService));
     }
     TodoService = todoService;
     SetPageRequest(new TodoPageGetRequest {
         PageRef = new PageRef <string>(Count: 5)
     });
     F = new FusionState <TodoPageGetResponse?>(stateFactory, session, commander, ComputeState, OnLiveStateChanged);
     F.GoLive();
 }
Exemple #29
0
        public List <Employee> DisplayEmployees(ICommander commander)
        {
            employees.Add(commander as Employee);
            foreach (ICommandable item in commander.DirectSubordinates)
            {
                if (item is ICommander)
                {
                    DisplayEmployees(item as ICommander);
                }
                if (!(item is ICommander))
                {
                    employees.Add(item as Employee);
                }
            }

            return(employees);
        }
Exemple #30
0
        public void Setup()
        {
            var services        = ServiceContainerBuilder.ConfigureServices();
            var serviceProvider = services.BuildServiceProvider();

            var plateau = serviceProvider.GetService <IPlateau>();

            plateau.SetSize("5 5");

            _roverCommander         = serviceProvider.GetService <ICommander>();
            _roverCommander.Plateau = plateau;

            _rover = serviceProvider.GetService <IRover>();
            _rover.SetPosition("1 2 N");
            _rover.Commands = "LMLMLMLMM";

            _roverCommander.Plateau.AddRover(_rover);
        }
Exemple #31
0
 public void Think(int turn, int maxTurn, int player, GameField field, ICommander commander)
 {
     if (field.GetPrepareResource(plan.Excavator, player, true) >= 4 && field[plan.Excavator].Terrain == Terrain.Wasteland)
     {
         disposition.AddBuildOrder(1000, plan.Excavator, Terrain.Excavator);
         disposition.AddMoveOrder(100, plan.Excavator, GameField.GetNeedRobot(Terrain.Excavator));
     }
     foreach (Point town in plan.Town)
     {
         if (field.GetPrepareResource(town, player, true) < 9) continue;
         disposition.AddBuildOrder(1000, town, Terrain.Town);
         disposition.AddMoveOrder(100, town, GameField.GetNeedRobot(Terrain.Town));
     }
     DistanceMap distance = new DistanceMap(field, player, InitialPoint);
     BuildPriority priority = new BuildPriority(field, player, InitialPoint, 99);
     foreach (Point point in field.Iterator())
     {
         if (field.GetPrepareResource(point, player, true) < 4) continue;
         if (!field.IsAdjoinTerritory(point, player)) continue;
         if (point == new Point { X = 6, Y = 6 }) continue;
         Terrain building;
         switch(field[point].Terrain)
         {
             case Terrain.Wasteland: building = Terrain.House; break;
             case Terrain.Hole: building = Terrain.Bridge; break;
             default: continue;
         }
         disposition.AddBuildOrder(priority[point] * 10, point, building);
         disposition.AddMoveOrder(priority[point], point, GameField.GetNeedRobot(building));
     }
     foreach (OrderBuild build in disposition.EnumerateOrder<OrderBuild>())
     {
         disposition.AddSecureResource(build.Priority / 10 - 1, build.Point, player, field);
     }
     disposition.AddSecureGround(150, 100, player, field);
     disposition.AddKamikaze(0, player, field);
     disposition.Dispose(field, commander);
 }
 public GameResultController(ICommander commander)
 {
     _commander = commander;
 }
 public MatchStartController(ICommander commander)
 {
     _commander = commander;
 }
Exemple #34
0
 public void Think(int turn, int maxTurn, int player, GameField field, ICommander commander)
 {
     if (!Build(player, field, commander))
     {
         Move(player, field, commander);
     }
     commander.Finish();
 }
Exemple #35
0
 private bool Build(int player, GameField field, ICommander commander)
 {
     Terrain building = (Terrain)random.Next(4, 10);
     foreach (Point point in field.Iterator())
     {
         if (field.IsBuild(point, building))
         {
             commander.Build(point.X, point.Y, building);
             return true;
         }
     }
     return false;
 }
Exemple #36
0
 private void Move(int player, GameField field, ICommander commander)
 {
     foreach (Point point in field.Iterator())
     {
         Direction dir = (Direction)random.Next(1, 7);
         int robot = random.Next(field[point].ActiveRobot) + 1;
         if (field.IsMove(point, dir, robot))
         {
             commander.Move(point.X, point.Y, dir, robot);
         }
     }
 }