Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandlerSelector"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        public HandlerSelector(ILogger <HandlerSelector> logger)
        {
            logger.ThrowIfNull(nameof(logger));

            this.logger      = logger;
            this.handlersMap = new Dictionary <Type, ITcpRequestHandler>();
        }
Exemple #2
0
 public CredentialManager(
     ILogger <CredentialManager> logger,
     ILiveUpdateableOptions <ApplicationConfiguration> liveOptions)
 {
     this.liveOptions = liveOptions.ThrowIfNull(nameof(liveOptions));
     this.logger      = logger.ThrowIfNull(nameof(logger));
 }
        /// <summary>
        ///     Initialize a new instance of the <see cref="DisposableBase" /> class.
        /// </summary>
        /// <param name="logger">A <see cref="ILogger" />.</param>
        protected DisposableBase(ILogger logger)
            : base(logger)
        {
            logger.ThrowIfNull(nameof(logger));

            Logger.Trace("Enter Ctor - Exit.");
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagementProtocol"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger to use.</param>
        /// <param name="handlerSelector">A reference to the handler selector to use in this protocol.</param>
        public ManagementProtocol(ILogger logger, IHandlerSelector handlerSelector)
            : base(handlerSelector)
        {
            logger.ThrowIfNull(nameof(logger));

            this.Logger = logger.ForContext <GameProtocol>();
        }
Exemple #5
0
 /// <summary>Constructor</summary>
 /// <param name="secretStore">Vault Secret Store</param>
 /// <param name="logger">Logger</param>
 public VaultBasicAuthenticationSecretParser(
     IVaultSecretStore secretStore,
     ILogger <VaultBasicAuthenticationSecretParser> logger)
 {
     this.secretStore = secretStore.ThrowIfNull(nameof(secretStore));
     this.logger      = logger.ThrowIfNull(nameof(logger));
 }
Exemple #6
0
 public BuilderBase(ICountingFileSystem fileSystem, ILogger logger, Settings settings)
 {
     FileSystem = fileSystem.ThrowIfNull("fileSystem");
     Logger     = logger.ThrowIfNull("logger");
     Settings   = settings.ThrowIfNull("settings");
     Steps      = new List <IBuildStep>();
 }
Exemple #7
0
 protected Client(HttpClient httpClient, ILogger <Client> logger, string source, string endpoint)
 {
     _httpClient   = httpClient.ThrowIfNull(nameof(httpClient));
     _logger       = logger.ThrowIfNull(nameof(logger));
     this.Source   = new Uri(source);
     this.Endpoint = endpoint.ThrowIfNullOrEmpty(nameof(endpoint));
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorLoggingMiddleware" /> class.
 /// </summary>
 /// <param name="next">The next.</param>
 /// <param name="logger">The logger.</param>
 public ErrorLoggingMiddleware(
     RequestDelegate next,
     ILogger <ErrorLoggingMiddleware> logger)
 {
     _next   = next.ThrowIfNull(nameof(next));
     _logger = logger.ThrowIfNull(nameof(logger));
 }
 public PrivilegeManager(
     IViewManager viewManager,
     ILogger <PrivilegeManager> logger)
 {
     this.logger      = logger.ThrowIfNull(nameof(logger));
     this.viewManager = viewManager.ThrowIfNull(nameof(viewManager));
 }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandlerSelector"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        public HandlerSelector(ILogger logger)
        {
            logger.ThrowIfNull(nameof(logger));

            this.logger      = logger.ForContext <HandlerSelector>();
            this.handlersMap = new Dictionary <Type, IHandler>();
        }
Exemple #11
0
        /// <summary>
        /// Adds parsed content elements to this container.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="itemFactory">A reference to the item factory in use.</param>
        /// <param name="contentElements">The content elements to add.</param>
        public void AddContent(ILogger logger, IItemFactory itemFactory, IEnumerable <IParsedElement> contentElements)
        {
            logger.ThrowIfNull(nameof(logger));
            itemFactory.ThrowIfNull(nameof(itemFactory));
            contentElements.ThrowIfNull(nameof(contentElements));

            foreach (var element in contentElements)
            {
                if (element.IsFlag)
                {
                    // A flag is unexpected in this context.
                    logger.Warning($"Unexpected flag {element.Attributes?.First()?.Name}, ignoring.");

                    continue;
                }

                IItem item = itemFactory.Create((ushort)element.Id);

                if (item == null)
                {
                    logger.Warning($"Item with id {element.Id} not found in the catalog, skipping.");

                    continue;
                }

                item.SetAttributes(logger.ForContext <IItem>(), itemFactory, element.Attributes);

                // TODO: we should be able to go over capacity here.
                this.AddContent(itemFactory, item, 0xFF);
            }
        }
Exemple #12
0
        /// <summary>
        ///     Initialize a new instance of the <see cref="LoggingBase" /> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">loggerFactory can not be null</exception>
        /// <param name="logger">A <see cref="ILogger" />.</param>
        protected LoggingBase(ILogger logger)
        {
            logger.ThrowIfNull(nameof(logger));

            logger.Trace("Enter Ctor - After next line.");
            Logger = logger;
        }
Exemple #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventContext"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="currentTimeFunc">A functiont to get the current time.</param>
        public EventContext(ILogger logger, Func <DateTimeOffset> currentTimeFunc)
        {
            logger.ThrowIfNull(nameof(logger));

            this.Logger         = logger.ForContext(this.GetType());
            this.getCurrentTime = currentTimeFunc;
        }
Exemple #14
0
 public VaultCertificateStore(IVaultClient vaultClient, string roleName, string commonName, ILogger logger)
 {
     this.vaultClient = vaultClient.ThrowIfNull(nameof(vaultClient));
     this.roleName    = roleName.ThrowIfNullOrEmpty(nameof(roleName));
     this.commonName  = commonName.ThrowIfNullOrEmpty(nameof(commonName));
     this.logger      = logger.ThrowIfNull(nameof(logger));
 }
Exemple #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectorMapLoader"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger instance in use.</param>
        /// <param name="itemFactory">A reference to the item factory.</param>
        /// <param name="tileFactory">A reference to the tile factory.</param>
        /// <param name="sectorMapLoaderOptions">The options for this map loader.</param>
        public SectorMapLoader(
            ILogger <SectorMapLoader> logger,
            IItemFactory itemFactory,
            ITileFactory tileFactory,
            IOptions <SectorMapLoaderOptions> sectorMapLoaderOptions)
        {
            logger.ThrowIfNull(nameof(logger));
            itemFactory.ThrowIfNull(nameof(itemFactory));
            tileFactory.ThrowIfNull(nameof(tileFactory));
            sectorMapLoaderOptions.ThrowIfNull(nameof(sectorMapLoaderOptions));

            DataAnnotationsValidator.ValidateObjectRecursive(sectorMapLoaderOptions.Value);

            this.mapDirInfo = new DirectoryInfo(sectorMapLoaderOptions.Value.LiveMapDirectory);

            if (!this.mapDirInfo.Exists)
            {
                throw new ApplicationException($"The map directory '{sectorMapLoaderOptions.Value.LiveMapDirectory}' could not be found.");
            }

            this.logger      = logger;
            this.itemFactory = itemFactory;
            this.tileFactory = tileFactory;

            this.totalTileCount   = 1;
            this.totalLoadedCount = default;

            this.loadLock = new object();

            this.sectorsLengthX = 1 + SectorXMax - SectorXMin;
            this.sectorsLengthY = 1 + SectorYMax - SectorYMin;
            this.sectorsLengthZ = 1 + SectorZMax - SectorZMin;

            this.sectorsLoaded = new bool[this.sectorsLengthX, this.sectorsLengthY, this.sectorsLengthZ];
        }
Exemple #16
0
        public MsSqlCheckpointManager(IOptions <MsSqlEventSourcingOptions> options, ILogger <MsSqlCheckpointManager> logger)
        {
            _options = options.ThrowIfNull(nameof(options)).Value;
            _logger  = logger.ThrowIfNull(nameof(logger));
            _scripts = new Scripts.Scripts(_options.Schema);

            _createConnection = () => new SqlConnection(_options.ConnectionString);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientConnectionFactory{TProtocol}"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="protocol">A reference to the protocol to target.</param>
        public ClientConnectionFactory(ILogger <ClientConnectionFactory <TProtocol> > logger, TProtocol protocol)
        {
            logger.ThrowIfNull(nameof(logger));
            protocol.ThrowIfNull(nameof(protocol));

            this.logger   = logger;
            this.protocol = protocol;
        }
Exemple #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseItemEventFactory"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="scriptFactory">A reference to the script factory.</param>
        public MoveUseItemEventFactory(ILogger logger, IScriptApi scriptFactory)
        {
            logger.ThrowIfNull(nameof(logger));
            scriptFactory.ThrowIfNull(nameof(scriptFactory));

            this.Logger        = logger;
            this.ScriptFactory = scriptFactory;
        }
Exemple #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureManager"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger to use.</param>
        public CreatureManager(ILogger <CreatureManager> logger)
        {
            logger.ThrowIfNull(nameof(logger));

            this.creatureMap = new ConcurrentDictionary <uint, ICreature>();

            this.Logger = logger;
        }
Exemple #20
0
        public IoOperations(IFileSystem fileSystem, string outputFolderPath, ILogger logger)
        {
            this.FileSystem = fileSystem.ThrowIfNull(nameof(fileSystem));
            this.OutputFolderPath = outputFolderPath;
            this.Logger = logger.ThrowIfNull(nameof(logger));

            this.WriteLog("outputFolderPath = " + outputFolderPath);
        }
 /// <summary>
 ///   Конструктор адаптера
 /// </summary>
 /// <param name="connectionFactory">Фабрика подключений</param>
 /// <param name="queueConfiguration">Параметры очереди</param>
 /// <param name="logger">Сервис логирования</param>
 public ActiveMqQueueMessageAdapter(IActiveMqConnectionFactory connectionFactory,
                                    ActiveMqQueueConfiguration queueConfiguration,
                                    ILogger logger)
 {
     _connectionFactory = connectionFactory.ThrowIfNull(nameof(connectionFactory));
     _configuration     = queueConfiguration.ThrowIfNull(nameof(queueConfiguration));
     _logger            = logger.ThrowIfNull(nameof(logger));
 }
Exemple #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameProtocol_v772"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        public GameProtocol_v772(ILogger logger)
        {
            logger.ThrowIfNull(nameof(logger));

            this.logger = logger.ForContext <GameProtocol_v772>();

            this.packetReadersMap = new Dictionary <IncomingGamePacketType, IPacketReader>();
            this.packetWritersMap = new Dictionary <OutgoingGamePacketType, IPacketWriter>();
        }
Exemple #23
0
        public EmptyWindow(ILogger logger, IEmptyWindowModel viewModel)
        {
            DataContext = viewModel;
            InitializeComponent();
            Loaded += EmptyWindow_Loaded;

            logger.ThrowIfNull(nameof(logger));
            _logger = logger;
        }
        public PostgresCheckpointManager(IOptions <PostgresEventSourcingOptions> options,
                                         ILogger <PostgresCheckpointManager> logger)
        {
            _options = options.ThrowIfNull(nameof(options)).Value;
            _logger  = logger.ThrowIfNull(nameof(logger));
            _scripts = new Scripts.Scripts(_options.Schema);

            _createConnection = () => new PostgresConnection(options).Build();
        }
Exemple #25
0
 public RedisDatabase(bool useCompression, IDatabase database, ILogger <RedisDatabase> logger,
                      IDictionary <string, TimeSpan> keyLifetimes, string prefixKey)
 {
     _database       = database.ThrowIfNull(nameof(database));
     _logger         = logger.ThrowIfNull(nameof(logger));
     _prefixKey      = prefixKey;
     _keyLifetimes   = keyLifetimes;
     _useCompression = useCompression;
 }
        public VoyageDataContext(string connectionString, IIdentityProvider identityProvider, ILogger logger)
            : base(connectionString)
        {
            _identityProvider = identityProvider.ThrowIfNull(nameof(identityProvider));
            _logger           = logger.ThrowIfNull(nameof(logger));

            // Configure the username factory for the auditing
            ConfigureUsername(() => _identityProvider.GetUserName());
        }
Exemple #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GatewayProtocol_v772"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        public GatewayProtocol_v772(ILogger <GatewayProtocol_v772> logger)
        {
            logger.ThrowIfNull(nameof(logger));

            this.logger = logger;

            this.packetReadersMap = new Dictionary <IncomingPacketType, IPacketReader>();
            this.packetWritersMap = new Dictionary <OutgoingPacketType, IPacketWriter>();
        }
Exemple #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectsFileItemTypeLoader"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger instance.</param>
        /// <param name="options">The options for this loader.</param>
        public ObjectsFileItemTypeLoader(
            ILogger logger,
            IOptions <ObjectsFileItemTypeLoaderOptions> options)
        {
            logger.ThrowIfNull(nameof(logger));
            options.ThrowIfNull(nameof(options));

            this.LoaderOptions = options.Value;
            this.Logger        = logger.ForContext <ObjectsFileItemTypeLoader>();
        }
Exemple #29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseScriptApiAdapter"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="scriptApi">A reference to the script api in use.</param>
        public MoveUseScriptApiAdapter(
            ILogger logger,
            IScriptApi scriptApi)
        {
            logger.ThrowIfNull(nameof(logger));
            scriptApi.ThrowIfNull(nameof(scriptApi));

            this.Logger    = logger.ForContext <MoveUseScriptApiAdapter>();
            this.ScriptApi = scriptApi;
        }
Exemple #30
0
        public StandardScriptApi(
            ILogger logger,
            ITileAccessor tileAccessor)
        {
            logger.ThrowIfNull(nameof(logger));
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            this.Logger       = logger.ForContext <StandardScriptApi>();
            this.TileAccessor = tileAccessor;
        }
Exemple #31
0
 public RequestElevationView(
     IApplicationLauncher applicationLauncher,
     IViewManager viewManager,
     ILogger <RequestElevationView> logger)
 {
     this.applicationLauncher = applicationLauncher.ThrowIfNull(nameof(applicationLauncher));
     this.viewManager         = viewManager.ThrowIfNull(nameof(viewManager));
     this.logger = logger.ThrowIfNull(nameof(logger));
     this.InitializeComponent();
 }
        public GreetService(IServiceNameProvider serviceNameProvider, ILogger logger, Func<Owned<IGreetServiceWorker>> workerFactory)
        {
            serviceNameProvider.ThrowIfNull("serviceNameProvider");

            ServiceName =
                serviceNameProvider.ServiceName
                    .ThrowIfNullOrEmpty("serviceNameProvider.ServiceName");

            Logger = logger.ThrowIfNull("logger");
            WorkerFactory = workerFactory.ThrowIfNull("workerFactory");

            CanStop = true;
            AutoLog = true;
        }
 public Greeter(SettingsProviders.IGreetingFileName fileNameProvider, ILogger logger)
 {
     FileName = fileNameProvider.FileName;
     Logger = logger.ThrowIfNull("logger");
 }