/// <summary> /// Initializes a new instance of the <see cref="FindExpiredRecordsToDeleteQueryPrepareHandler" /> class. /// </summary> /// <param name="commandCache">The command cache.</param> /// <param name="timeFactory">The time factory.</param> public FindExpiredRecordsToDeleteQueryPrepareHandler(CommandStringCache commandCache, IGetTimeFactory timeFactory) { Guard.NotNull(() => commandCache, commandCache); _commandCache = commandCache; _getTime = timeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class. /// </summary> /// <param name="optionsFactory">The options factory.</param> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="receivedMessageFactory">The received message factory.</param> /// <param name="commandCache">The command cache.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="headers">The headers.</param> /// <param name="serialization">The serialization.</param> /// <param name="getTimeFactory">The get time factory.</param> public ReceiveMessageQueryHandler(IPostgreSqlMessageQueueTransportOptionsFactory optionsFactory, ITableNameHelper tableNameHelper, IReceivedMessageFactory receivedMessageFactory, PostgreSqlCommandStringCache commandCache, IMessageFactory messageFactory, IHeaders headers, ICompositeSerialization serialization, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => receivedMessageFactory, receivedMessageFactory); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => messageFactory, messageFactory); Guard.NotNull(() => serialization, serialization); Guard.NotNull(() => headers, headers); Guard.NotNull(() => getTimeFactory, getTimeFactory); _options = new Lazy <PostgreSqlMessageQueueTransportOptions>(optionsFactory.Create); _tableNameHelper = tableNameHelper; _receivedMessageFactory = receivedMessageFactory; _commandCache = commandCache; _messageFactory = messageFactory; _headers = headers; _serialization = serialization; _getTime = getTimeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="World"/> class. /// </summary> /// <param name="getTime">Interface to get the current time.</param> /// <param name="camera">Primary world view camera.</param> /// <param name="userInfo">The user info. Can be null.</param> public World(IGetTime getTime, ICamera2D camera, UserInfo userInfo) { _userInfo = userInfo; _getTime = getTime; _camera = camera; MapDrawingExtensions.Add(new EmoticonMapDrawingExtension <Emoticon, EmoticonInfo <Emoticon> >(_emoticonDisplayManager)); if (userInfo != null) { Func <QuestID, bool> questStartReqs = x => UserInfo.HasStartQuestRequirements.HasRequirements(x) ?? false; Func <QuestID, bool> questFinishReqs = x => UserInfo.QuestInfo.ActiveQuests.Contains(x) && (UserInfo.HasFinishQuestRequirements.HasRequirements(x) ?? false); var e = new QuestMapDrawingExtension <Character>(userInfo.QuestInfo, questStartReqs, questFinishReqs, m => m.Spatial.GetMany <Character>(m.Camera.GetViewArea(), c => !c.ProvidedQuests.IsEmpty()), c => c.ProvidedQuests) { QuestAvailableCanStartIndicator = new Grh(GrhInfo.GetData("Quest", "can start")), QuestStartedIndicator = new Grh(GrhInfo.GetData("Quest", "started")), QuestAvailableCannotStartIndicator = new Grh(GrhInfo.GetData("Quest", "cannot start")), QuestTurnInIndicator = new Grh(GrhInfo.GetData("Quest", "turnin")) }; MapDrawingExtensions.Add(e); } }
/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="serializer">The serializer.</param> /// <param name="optionsFactory">The options factory.</param> /// <param name="headers">The headers.</param> /// <param name="commandCache">The command cache.</param> /// <param name="configurationSend">The configuration send.</param> /// <param name="sendJobStatus">The send job status.</param> /// <param name="jobExistsHandler">The job exists handler.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> /// <param name="getTimeFactory">The get time factory.</param> public SendMessageCommandHandlerAsync(ITableNameHelper tableNameHelper, ICompositeSerialization serializer, IPostgreSqlMessageQueueTransportOptionsFactory optionsFactory, IHeaders headers, PostgreSqlCommandStringCache commandCache, TransportConfigurationSend configurationSend, ICommandHandler <SetJobLastKnownEventCommand <NpgsqlConnection, NpgsqlTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <NpgsqlConnection, NpgsqlTransaction>, QueueStatuses> jobExistsHandler, IJobSchedulerMetaData jobSchedulerMetaData, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => headers, headers); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => configurationSend, configurationSend); Guard.NotNull(() => sendJobStatus, sendJobStatus); Guard.NotNull(() => jobExistsHandler, jobExistsHandler); Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData); Guard.NotNull(() => getTimeFactory, getTimeFactory); _tableNameHelper = tableNameHelper; _serializer = serializer; _options = new Lazy <PostgreSqlMessageQueueTransportOptions>(optionsFactory.Create); _headers = headers; _commandCache = commandCache; _configurationSend = configurationSend; _sendJobStatus = sendJobStatus; _jobExistsHandler = jobExistsHandler; _jobSchedulerMetaData = jobSchedulerMetaData; _getTime = getTimeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="SkeletonCharacterSprite"/> class. /// </summary> /// <param name="getTime">The interface used to get the current time.</param> /// <param name="character">The character that this sprite is for.</param> /// <param name="skeletonManager">The skeleton manager.</param> /// <param name="speedModifier">The animation speed modifier.</param> public SkeletonCharacterSprite(IGetTime getTime, Entity character, SkeletonManager skeletonManager, float speedModifier) { _character = character; _skelManager = skeletonManager; _speedModifier = speedModifier; _getTime = getTime; }
/// <inheritdoc /> public ResetHeartbeatLua(IRedisConnection connection, RedisNames redisNames, IGetTimeFactory getTime, ICompositeSerialization serialization) : base(connection, redisNames) { _getTime = getTime.Create(); _serialization = serialization; Script = @"local returnData = {} local uuids = redis.call('zrangebyscore', @workingkey, 0, @heartbeattime, 'LIMIT', 0, @limit) if #uuids == 0 then return nil end local index = 1 for k, v in pairs(uuids) do redis.call('zrem', @workingkey, v) local routeName = redis.call('hget', @RouteIDKey, v) if(routeName) then local routePending = @pendingkey .. '_}' .. routeName redis.call('rpush', routePending, v) else redis.call('rpush', @pendingkey, v) end redis.call('hset', @StatusKey, v, '0') returnData[index] = {v, redis.call('hget', @headerskey, v)} index = index + 1 end redis.call('publish', @channel, '') return returnData"; }
/// <summary> /// Initializes a new instance of the <see cref="World"/> class. /// </summary> /// <param name="getTime">Interface to get the current time.</param> /// <param name="camera">Primary world view camera.</param> /// <param name="userInfo">The user info. Can be null.</param> public World(IGetTime getTime, ICamera2D camera, UserInfo userInfo) { _userInfo = userInfo; _getTime = getTime; _camera = camera; MapDrawingExtensions.Add(new EmoticonMapDrawingExtension<Emoticon, EmoticonInfo<Emoticon>>(_emoticonDisplayManager)); if (userInfo != null) { Func<QuestID, bool> questStartReqs = x => UserInfo.HasStartQuestRequirements.HasRequirements(x) ?? false; Func<QuestID, bool> questFinishReqs = x => UserInfo.QuestInfo.ActiveQuests.Contains(x) && (UserInfo.HasFinishQuestRequirements.HasRequirements(x) ?? false); var e = new QuestMapDrawingExtension<Character>(userInfo.QuestInfo, questStartReqs, questFinishReqs, m => m.Spatial.GetMany<Character>(m.Camera.GetViewArea(), c => !c.ProvidedQuests.IsEmpty()), c => c.ProvidedQuests) { QuestAvailableCanStartIndicator = new Grh(GrhInfo.GetData("Quest", "can start")), QuestStartedIndicator = new Grh(GrhInfo.GetData("Quest", "started")), QuestAvailableCannotStartIndicator = new Grh(GrhInfo.GetData("Quest", "cannot start")), QuestTurnInIndicator = new Grh(GrhInfo.GetData("Quest", "turnin")) }; MapDrawingExtensions.Add(e); } }
/// <summary> /// Creates the <see cref="ICharacterSprite"/> to be used by a <see cref="Character"/>. /// </summary> /// <param name="getTime">The <see cref="IGetTime"/> provider.</param> /// <param name="entity">The <see cref="Entity"/> the sprite is for (usually the <see cref="Character"/>).</param> /// <param name="skeletonManager">The <see cref="SkeletonManager"/> to use (ignored in TopDown builds).</param> /// <returns>The <see cref="ICharacterSprite"/> instance.</returns> public static ICharacterSprite CreateCharacterSprite(IGetTime getTime, Entity entity, SkeletonManager skeletonManager) { #if !TOPDOWN return(new SkeletonCharacterSprite(getTime, entity, skeletonManager, GameData.AnimationSpeedModifier)); #else return(new GrhCharacterSprite(entity, "Character.Top Down")); #endif }
/// <summary> /// Initializes a new instance of the <see cref="SendHeartBeatCommandPrepareHandler"/> class. /// </summary> /// <param name="commandCache">The command cache.</param> /// <param name="getTimeFactory">The get time factory.</param> public SendHeartBeatCommandPrepareHandler(CommandStringCache commandCache, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => getTimeFactory, getTimeFactory); _commandCache = commandCache; _getTime = getTimeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="MoveRecordToErrorQueueCommandPrepareHandler" /> class. /// </summary> /// <param name="buildSql">The build SQL.</param> /// <param name="getTimeFactory">The get time factory.</param> public MoveRecordToErrorQueueCommandPrepareHandler(IBuildMoveToErrorQueueSql buildSql, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => buildSql, buildSql); Guard.NotNull(() => getTimeFactory, getTimeFactory); _buildSql = buildSql; _getTime = getTimeFactory.Create(); }
/// <summary> /// Creates the <see cref="ICharacterSprite"/> to be used by a <see cref="Character"/>. /// </summary> /// <param name="getTime">The <see cref="IGetTime"/> provider.</param> /// <param name="entity">The <see cref="Entity"/> the sprite is for (usually the <see cref="Character"/>).</param> /// <param name="skeletonManager">The <see cref="SkeletonManager"/> to use (ignored in TopDown builds).</param> /// <returns>The <see cref="ICharacterSprite"/> instance.</returns> public static ICharacterSprite CreateCharacterSprite(IGetTime getTime, Entity entity, SkeletonManager skeletonManager) { #if SKELETON_SPRITES return(new SkeletonCharacterSprite(getTime, entity, skeletonManager, GameData.AnimationSpeedModifier)); #else return(new GrhCharacterSprite(entity, "Character")); #endif }
internal static SQLiteCommand CreateMetaDataRecord(TimeSpan? delay, TimeSpan expiration, SQLiteConnection connection, IMessage message, IAdditionalMessageData data, TableNameHelper tableNameHelper, IHeaders headers, SqLiteMessageQueueTransportOptions options, IGetTime getTime) { var command = new SQLiteCommand(connection); BuildMetaCommand(command, tableNameHelper, headers, data, message, 0, options, delay, expiration, getTime.GetCurrentUtcDate()); return command; }
/// <summary> /// Initializes a new instance of the <see cref="StatusEffectsForm"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="position">The position.</param> /// <param name="getTime">The get time.</param> public StatusEffectsForm(Control parent, Vector2 position, IGetTime getTime) : base(parent, position, _iconSize) { IsCloseButtonVisible = false; _getTime = getTime; Border = null; CanFocus = false; CanDrag = false; }
/// <summary> /// Initializes a new instance of the <see cref="FindErrorRecordsToDeleteQueryPrepareHandler"/> class. /// </summary> /// <param name="commandCache">The command cache.</param> /// <param name="timeFactory">The time factory.</param> /// <param name="configuration">The configuration.</param> public FindErrorRecordsToDeleteQueryPrepareHandler(CommandStringCache commandCache, IGetTimeFactory timeFactory, IMessageErrorConfiguration configuration) { Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => timeFactory, timeFactory); _commandCache = commandCache; _configuration = configuration; _getTime = timeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="FindRecordsToResetByHeartBeatQueryPrepareHandler" /> class. /// </summary> /// <param name="commandCache">The command cache.</param> /// <param name="configuration">The configuration.</param> /// <param name="getTimeFactory">The get time factory.</param> public FindRecordsToResetByHeartBeatQueryPrepareHandler(CommandStringCache commandCache, QueueConsumerConfiguration configuration, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => getTimeFactory, getTimeFactory); _commandCache = commandCache; _configuration = configuration; _getTime = getTimeFactory.Create(); }
/// <summary> /// Initializes a new instance of the <see cref="ResetHeartBeat{T}"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="commandHandler">The command handler.</param> /// <param name="queryHandler">The query handler.</param> /// <param name="getTime">The get time.</param> public ResetHeartBeat(QueueConsumerConfiguration configuration, ICommandHandlerWithOutput <ResetHeartBeatCommand <T>, long> commandHandler, IQueryHandler <FindMessagesToResetByHeartBeatQuery <T>, IEnumerable <MessageToReset <T> > > queryHandler, IGetTimeFactory getTime) { Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => commandHandler, commandHandler); Guard.NotNull(() => queryHandler, queryHandler); _configuration = configuration; _commandHandler = commandHandler; _queryHandler = queryHandler; _getTime = getTime.Create(); }
internal ScheduledJob(JobScheduler scheduler, string name, IJobSchedule schedule, IProducerMethodJobQueue queue, Expression<Action<IReceivedMessage<MessageExpression>, IWorkerNotification>> actionToRun, IGetTime time, string route) { _scheduler = scheduler; Name = name; Schedule = schedule; _queue = queue; _actionToRun = actionToRun; _getTime = time; Route = route; }
internal ScheduledJob(JobScheduler scheduler, string name, IJobSchedule schedule, IProducerMethodJobQueue queue, LinqExpressionToRun expressionToRun, IGetTime time, string route ) { _scheduler = scheduler; Name = name; Schedule = schedule; _queue = queue; _expressionToRun = expressionToRun; _getTime = time; Route = route; }
internal ScheduledJob(JobScheduler scheduler, string name, IJobSchedule schedule, IProducerMethodJobQueue queue, Expression <Action <IReceivedMessage <MessageExpression>, IWorkerNotification> > actionToRun, IGetTime time, string route, bool rawExpression) { _scheduler = scheduler; Name = name; Schedule = schedule; _queue = queue; _actionToRun = actionToRun; _getTime = time; Route = route; RawExpression = rawExpression; }
/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="serializer">The serializer.</param> /// <param name="optionsFactory">The options factory.</param> /// <param name="headers">The headers.</param> /// <param name="commandCache">The command cache.</param> /// <param name="configurationSend">The configuration send.</param> /// <param name="getTimeFactory">The get time factory.</param> /// <param name="dbFactory">The database factory.</param> /// <param name="sendJobStatus">The send job status.</param> /// <param name="jobExistsHandler">The job exists handler.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> /// <param name="databaseExists">The database exists.</param> /// <param name="readerAsync">The reader asynchronous.</param> public SendMessageCommandHandlerAsync(TableNameHelper tableNameHelper, ICompositeSerialization serializer, ISqLiteMessageQueueTransportOptionsFactory optionsFactory, IHeaders headers, IDbCommandStringCache commandCache, TransportConfigurationSend configurationSend, IGetTimeFactory getTimeFactory, IDbFactory dbFactory, ICommandHandler <SetJobLastKnownEventCommand <IDbConnection, IDbTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <IDbConnection, IDbTransaction>, QueueStatuses> jobExistsHandler, IJobSchedulerMetaData jobSchedulerMetaData, DatabaseExists databaseExists, IReaderAsync readerAsync) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => headers, headers); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => configurationSend, configurationSend); Guard.NotNull(() => getTimeFactory, getTimeFactory); Guard.NotNull(() => sendJobStatus, sendJobStatus); Guard.NotNull(() => jobExistsHandler, jobExistsHandler); Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData); Guard.NotNull(() => databaseExists, databaseExists); Guard.NotNull(() => readerAsync, readerAsync); _tableNameHelper = tableNameHelper; _serializer = serializer; _options = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create); _headers = headers; _commandCache = commandCache; _configurationSend = configurationSend; _getTime = getTimeFactory.Create(); _dbFactory = dbFactory; _sendJobStatus = sendJobStatus; _jobExistsHandler = jobExistsHandler; _jobSchedulerMetaData = jobSchedulerMetaData; _databaseExists = databaseExists; _readerAsync = readerAsync; }
public ClockViewModel(INavigationService navigationService, ICanvasDrawing canvasDrawing, IGetTime getTime, IServerConnection serverConnection, ICurrentData currentData) : base(navigationService) { this.canvasDrawing = canvasDrawing; this.getTime = getTime; this.serverConnection = serverConnection; this.currentData = currentData; HubConnection connection = serverConnection.Connection; connection.On <string>("GetAllProfiles", async(messege) => { await GetAllProfiles(messege); }); connection.Closed += async(error) => { await Task.Delay(2000); await connection.StartAsync(); }; }
/// <summary> /// Initializes a new instance of the <see cref="Map"/> class. /// </summary> /// <param name="mapID">The ID of the map.</param> /// <param name="camera">The camera used to view the map.</param> /// <param name="getTime">The object used to get the current time.</param> public Map(MapID mapID, ICamera2D camera, IGetTime getTime) : base(mapID, getTime) { _camera = camera; DrawParticles = true; }
/// <summary> /// Initializes a new instance of the <see cref="EditorMap"/> class. /// </summary> /// <param name="mapID">The ID of the map.</param> /// <param name="camera">The camera used to view the map.</param> /// <param name="getTime">The object used to get the current time.</param> public EditorMap(MapID mapID, ICamera2D camera, IGetTime getTime) : base(mapID, camera, getTime) { _undoManager = new MapUndoManager(this, GlobalState.Instance.DynamicEntityFactory); }
/// <summary> /// Creates the <see cref="ICharacterSprite"/> to be used by a <see cref="Character"/>. /// </summary> /// <param name="getTime">The <see cref="IGetTime"/> provider.</param> /// <param name="entity">The <see cref="Entity"/> the sprite is for (usually the <see cref="Character"/>).</param> /// <param name="skeletonManager">The <see cref="SkeletonManager"/> to use (ignored in TopDown builds).</param> /// <returns>The <see cref="ICharacterSprite"/> instance.</returns> public static ICharacterSprite CreateCharacterSprite(IGetTime getTime, Entity entity, SkeletonManager skeletonManager) { #if SKELETON_SPRITES return new SkeletonCharacterSprite(getTime, entity, skeletonManager, GameData.AnimationSpeedModifier); #else return new GrhCharacterSprite(entity, "Character"); #endif }
internal static IDbCommand CreateMetaDataRecord(TimeSpan?delay, TimeSpan expiration, IDbConnection connection, IMessage message, IAdditionalMessageData data, TableNameHelper tableNameHelper, IHeaders headers, SqLiteMessageQueueTransportOptions options, IGetTime getTime) { var command = connection.CreateCommand(); BuildMetaCommand(command, tableNameHelper, data, options, delay, expiration, getTime.GetCurrentUtcDate()); return(command); }
/// <summary> /// Initializes a new instance of the <see cref="RespawnTaskList"/> class. /// </summary> /// <param name="getTime">The <see cref="IGetTime"/>.</param> public RespawnTaskList(IGetTime getTime) { _getTime = getTime; }
/// <summary> /// Initializes a new instance of the <see cref="EditorMap"/> class. /// </summary> /// <param name="mapID">The ID of the map.</param> /// <param name="camera">The camera used to view the map.</param> /// <param name="getTime">The object used to get the current time.</param> public EditorMap(MapID mapID, ICamera2D camera, IGetTime getTime) : base(mapID, camera, getTime) { }
public BuildDequeueCommand(IGetTimeFactory getTimeFactory) { Guard.NotNull(() => getTimeFactory, getTimeFactory); _getTime = getTimeFactory.Create(); }
/// <summary> /// Creates the <see cref="ICharacterSprite"/> to be used by a <see cref="Character"/>. /// </summary> /// <param name="getTime">The <see cref="IGetTime"/> provider.</param> /// <param name="entity">The <see cref="Entity"/> the sprite is for (usually the <see cref="Character"/>).</param> /// <param name="skeletonManager">The <see cref="SkeletonManager"/> to use (ignored in TopDown builds).</param> /// <returns>The <see cref="ICharacterSprite"/> instance.</returns> public static ICharacterSprite CreateCharacterSprite(IGetTime getTime, Entity entity, SkeletonManager skeletonManager) { #if !TOPDOWN return new SkeletonCharacterSprite(getTime, entity, skeletonManager, GameData.AnimationSpeedModifier); #else return new GrhCharacterSprite(entity, "Character.Top Down"); #endif }