コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationContext"/> class.
        /// </summary>
        /// <param name="options">A reference to the application configuration.</param>
        /// <param name="rsaDecryptor">A reference to the RSA decryptor in use.</param>
        /// <param name="itemTypeLoader">A reference to the item type loader in use.</param>
        /// <param name="monsterTypeLoader">A reference to the monster type loader in use.</param>
        /// <param name="telemetryClient">A reference to the telemetry client.</param>
        /// <param name="cancellationTokenSource">A reference to the master cancellation token source.</param>
        /// <param name="dbContextGenerationFunc">A reference to a function to generate the database context.</param>
        public ApplicationContext(
            IOptions <ApplicationContextOptions> options,
            IRsaDecryptor rsaDecryptor,
            IItemTypeLoader itemTypeLoader,
            IMonsterTypeLoader monsterTypeLoader,
            TelemetryClient telemetryClient,
            CancellationTokenSource cancellationTokenSource,
            Func <IFibulaDbContext> dbContextGenerationFunc)
        {
            options.ThrowIfNull(nameof(options));
            rsaDecryptor.ThrowIfNull(nameof(rsaDecryptor));
            itemTypeLoader.ThrowIfNull(nameof(itemTypeLoader));
            monsterTypeLoader.ThrowIfNull(nameof(monsterTypeLoader));
            cancellationTokenSource.ThrowIfNull(nameof(cancellationTokenSource));
            dbContextGenerationFunc.ThrowIfNull(nameof(dbContextGenerationFunc));

            DataAnnotationsValidator.ValidateObjectRecursive(options.Value);

            this.Options                 = options.Value;
            this.RsaDecryptor            = rsaDecryptor;
            this.CancellationTokenSource = cancellationTokenSource;

            this.TelemetryClient = telemetryClient;

            this.itemTypeLoader            = itemTypeLoader;
            this.monsterTypeLoader         = monsterTypeLoader;
            this.contextGenerationFunction = dbContextGenerationFunc;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GatewayLogInPacketReader"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="rsaDecryptor">A reference to the RSA decryptor in use.</param>
        public GatewayLogInPacketReader(
            ILogger <GatewayLogInPacketReader> logger,
            IRsaDecryptor rsaDecryptor)
            : base(logger)
        {
            rsaDecryptor.ThrowIfNull(nameof(rsaDecryptor));

            this.RsaDecryptor = rsaDecryptor;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameLogInPacketReader"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="applicationContext">A reference to the application context.</param>
        /// <param name="rsaDecryptor">A reference to the RSA decryptor in use.</param>
        public GameLogInPacketReader(
            ILogger <GameLogInPacketReader> logger,
            IApplicationContext applicationContext,
            IRsaDecryptor rsaDecryptor)
            : base(logger)
        {
            applicationContext.ThrowIfNull(nameof(applicationContext));
            rsaDecryptor.ThrowIfNull(nameof(rsaDecryptor));

            this.ApplicationContext = applicationContext;
            this.RsaDecryptor       = rsaDecryptor;
        }