public ClientConnectionDispatcher(IPackageParser packageParser, ClientConnection clientConnection)
    {
        this.packageParser    = packageParser;
        this.clientConnection = clientConnection;

        IncomingPackage += ClientConnectionDispatcher_IncomingPackage;
    }
コード例 #2
0
 public NetworkService(IConfigurationRoot configuration, ILogger <NetworkService> logger, IServiceProvider serviceProvider, IPackageParser packageParser, IPackageDispatcher packageDispatcher)
 {
     _tcpListener       = new TcpListener(IPAddress.Parse(configuration.GetValue <string>("host")), configuration.GetValue <int>("port"));
     Running            = false;
     _logger            = logger;
     _serviceProvider   = serviceProvider;
     _packageParser     = packageParser;
     _packageDispatcher = packageDispatcher;
 }
コード例 #3
0
 public RaceSelection()
 {
     configService = ConfigurationService.CreateInstance(s =>
     {
         s.AddSingleton <IPackageParser, PackageParser>();
     });
     packageParser = configService.ServiceProvider.GetRequiredService <IPackageParser>();
     menuManager   = new MenuManager();
 }
コード例 #4
0
 public NetworkService(IPAddress address, int port, ILogger <NetworkService> logger, IServiceProvider serviceProvider, IPackageParser packageParser, IPackageDispatcher packageDispatcher)
 {
     _tcpListener       = new TcpListener(address, port);
     Running            = false;
     _logger            = logger;
     _serviceProvider   = serviceProvider;
     _packageParser     = packageParser;
     _packageDispatcher = packageDispatcher;
 }
コード例 #5
0
 public NetworkService(IConfiguration config, ILogger <NetworkService> logger, IServiceProvider serviceProvider,
                       IPackageParser packageParser, IPackageDispatcher packageDispatcher)
 {
     tcpListener            = new TcpListener(IPAddress.Parse(config.GetValue <string>("host")), config.GetValue <int>("port"));
     IsRunning              = false;
     this.logger            = logger;
     this.serviceProvider   = serviceProvider;
     this.packageParser     = packageParser;
     this.packageDispatcher = packageDispatcher;
 }
コード例 #6
0
 public ServerConnectionHandler(ILogger <ServerConnectionHandler> logger,
                                IPackageParser packageParser,
                                IUserRepository UserRepo,
                                ICharacterRepositiory CharacterRepo,
                                IAuthStore authStore)
 {
     this.logger        = logger;
     this.packageParser = packageParser;
     this.UserRepo      = UserRepo;
     this.CharacterRepo = CharacterRepo;
     this.authStore     = authStore;
 }
コード例 #7
0
        public EmailDataSender(IMapper mapper, ILogic logic, ILifetimeScope autofac,
                               EmailExporterConfig config, IPackageParser parser)
        {
            this.parser = parser;
            mapper.Map(config, this);
            mapper.Map(config, Properties);

            addresses = config.RecepientGroupId > 0
                ? logic.GetRecepientAddressesByGroupId(config.RecepientGroupId)
                : new RecipientAddresses();
            this.autofac = autofac;
        } //ctor
コード例 #8
0
        public EmailDataSender(IMapper mapper, ILogic logic, ILifetimeScope autofac,
                               EmailExporterConfig config, IPackageParser parser, IConfigurationRoot serviceConfig)
        {
            this.parser = parser;
            mapper.Map(config, this);
            mapper.Map(config, Properties);

            smtpServer  = serviceConfig["EmailSenderSettings:SMTPServer"];
            fromAddress = serviceConfig["EmailSenderSettings:From"];

            addresses = config.RecepientGroupId > 0
                ? logic.GetRecepientAddressesByGroupId(config.RecepientGroupId)
                : new RecipientAddresses();
            this.autofac = autofac;
        } //ctor
コード例 #9
0
 public DbPackageExportScriptCreator(IPackageParser packageParser) : base(packageParser)
 {
     ScalarTypesToSqlTypes =
         new Dictionary <ScalarType, string>
     {
         { ScalarType.Int32, "INT" },
         { ScalarType.Double, "FLOAT" },
         { ScalarType.Int64, "BIGINT" },
         { ScalarType.Bool, "BIT" },
         { ScalarType.String, "NVARCHAR(4000)" },
         { ScalarType.Bytes, "VARBINARY(MAX)" },
         { ScalarType.DateTime, "DATETIME" },
         { ScalarType.Int16, "SMALLINT" },
         { ScalarType.Int8, "TINYINT" },
         { ScalarType.DateTimeOffset, "DATETIMEOFFSET(3)" },
         { ScalarType.TimeSpan, "TIME" },
         { ScalarType.Decimal, "DECIMAL" }
         // {ScalarType.TimeStamp, typeof(DateTime)}
     };
 }
コード例 #10
0
 public PostgresDbExporter(IMapper mapper, DbExporterConfig config, IPackageParser parser) :
     base(mapper, config, parser)
 {
     ScalarTypesToSqlTypes =
         new Dictionary <ScalarType, string>
     {
         { ScalarType.Int32, "INT" },
         { ScalarType.Double, "DOUBLE PRECISION" },
         { ScalarType.Int64, "BIGINT" },
         { ScalarType.Bool, "BOOLEAN" },
         { ScalarType.String, "VARCHAR(4000)" },
         { ScalarType.Bytes, "BYTEA" },
         { ScalarType.DateTime, "TIMESTAMP(3)" },
         { ScalarType.Int16, "SMALLINT" },
         { ScalarType.Int8, "SMALLINT" },
         { ScalarType.DateTimeOffset, "TIMESTAMP(3) WITH TIME ZONE" },
         { ScalarType.TimeSpan, "TIME" },
         { ScalarType.Decimal, "NUMERIC" }
         // {ScalarType.TimeStamp, typeof(DateTime)}
     };
 }
コード例 #11
0
        public DbExporter(IMapper mapper, DbExporterConfig config, IPackageParser parser)
        {
            mapper.Map(config, this);
            mapper.Map(config, Properties);
            packageParser = parser;

            scalarTypesToSqlTypes =
                new Dictionary <ScalarType, string>
            {
                { ScalarType.Int32, "int" },
                { ScalarType.Double, "float" },
                { ScalarType.Int64, "bigint" },
                { ScalarType.Bool, "bit" },
                { ScalarType.String, "nvarchar(4000)" },
                { ScalarType.Bytes, "varbinary(MAX)" },
                { ScalarType.DateTime, "datetime" },
                { ScalarType.Int16, "smallint" },
                { ScalarType.Int8, "tinyint" },
                { ScalarType.DateTimeOffset, "datetimeoffset" },
                { ScalarType.TimeSpan, "time" },
                { ScalarType.Decimal, "decimal" }
                // {ScalarType.TimeStamp, typeof(DateTime)}
            };
        }
コード例 #12
0
 public ServerConnectionHandler(ILogger <ServerConnectionHandler> logger, IPackageParser packageParser, IUserRepository userRepository)
 {
     _logger         = logger;
     _packageParser  = packageParser;
     _userRepository = userRepository;
 }
コード例 #13
0
 public BaseDbExporter(IMapper mapper, DbExporterConfig config, IPackageParser parser)
 {
     mapper.Map(config, this);
     mapper.Map(config, Properties);
     packageParser = parser;
 }
コード例 #14
0
 public ClientManager()
 {
     _packageParser    = GameContext.ServiceProvider.GetRequiredService <IPackageParser>();
     _clientConnection = GameContext.ServiceProvider.GetRequiredService <ClientConnection>();
 }
コード例 #15
0
 public CommonTableViewExecutor(IPackageParser parser) : base(parser)
 {
 }
コード例 #16
0
 public PackageDispatcher(ILogger <IPackageDispatcher> logger, IServiceProvider serviceProvider, IPackageParser packageParser)
 {
     this.logger          = logger;
     this.serviceProvider = serviceProvider;
     this.packageParser   = packageParser;
 }
コード例 #17
0
 public GroupedViewExecutor(IPackageParser parser) : base(parser)
 {
 }
コード例 #18
0
 public CommonViewExecutor(IPackageParser parser)
 {
     PackageParser = parser;
 }
コード例 #19
0
 public PackageDispatcher(ILogger <PackageDispatcher> logger, IServiceProvider serviceProvider, IPackageParser packageParser)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _packageParser   = packageParser ?? throw new ArgumentNullException(nameof(packageParser));
 }
コード例 #20
0
        /// <summary>
        /// Asynchronously adds a package file to the database.
        /// </summary>
        /// <param name="stream">An instance of the <see cref="Stream" /> class for reading data from the package resource.</param>
        /// <param name="parentId">The unique file identifier from the data source for the file.</param>
        /// <param name="ownerId">The unique user identifier from the data source for the user.</param>
        /// <param name="format">The package format.</param>
        /// <param name="parser">The parser.</param>
        /// <returns>
        /// A task that represents the asynchronous create operation.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">Thrown when a null reference is passed to the method.</exception>
        public virtual async Task <IList <FileItem> > CreateFromStreamAsync(Stream stream, int?parentId, int ownerId, PackageFormat format, IPackageParser parser, CancellationToken cancellationToken)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            if (parser == null)
            {
                throw new ArgumentNullException(nameof(parser));
            }

            var list    = new List <FileItem>();
            var entries = parser.Parse(stream, format);

            foreach (PackageEntry entry in entries)
            {
                using (Stream entryStream = entry.Open())
                {
                    list.Add(await CreateFromStreamAsync(entryStream, parentId, ownerId, entry.Name, cancellationToken));
                }
            }

            return(list);
        }