Esempio n. 1
0
        public void Register <T>(ISystemHandler <T> handler) where T : SystemMessage
        {
            Ensure.NotNull(handler, nameof(handler));

            this.handlers[SystemMessageIdProvider.MessageTypeIdByType[typeof(T)]]
            .Add(new MessageHandler <T>(handler));
        }
Esempio n. 2
0
        public NonBlockingConnection(string host, int port, int receiveBufferSize, ISystemHandler handler)
        {
            this.hostname          = host;
            this.port              = port;
            this.receiveBufferSize = receiveBufferSize;
            this.handler           = handler;
            this.eHandler          = new InnerEventHandler(handler, this);

            // IP解析
            EndPoint e = new IPEndPoint(IPAddress.Parse(host), port);

            session = new AsyncTcpSession(e, receiveBufferSize);

            // 注册回调事件
            session.Error        += this.eHandler.ConnException;
            session.Closed       += this.eHandler.ConnDisConnected;
            session.Connected    += this.eHandler.ConnConnected;
            session.DataReceived += this.eHandler.DataReceive;
        }
Esempio n. 3
0
        public ImperaturMarket(string SystemLocation)
        {
            _databaseHandler           = ImperaturGlobal.Kernel.Get <IDatabaseHandler>();
            _accountHandler            = ImperaturGlobal.Kernel.Get <IAccountHandler>();
            _userHandler               = ImperaturGlobal.Kernel.Get <IUserHandler>();
            _tradeHandler              = ImperaturGlobal.Kernel.Get <ITradeHandler>();
            _securityHandler           = ImperaturGlobal.Kernel.Get <ISecurityHandler>();
            _systemHandler             = ImperaturGlobal.Kernel.Get <ISystemHandler>();
            _logicalTransactionHandler = ImperaturGlobal.Kernel.Get <ILogicalTransactionHandler>();

            ImperaturGlobal.InitHandlers(DatabaseHandler, AccountHandler, UserHandler, SystemLocation);


            if (!_systemHandler.VerifySystem(SystemLocation))
            {
                _systemHandler.CreateSystem(SystemLocation);
            }
            //var t = _accountHandler.Accounts();
            //int gg = 0;

            /*
             *
             * var UserToAdd = new User
             * {
             *  _firstName = "Urban",
             *  _city = "Slätte",
             *  _lastName = "Kolkesson",
             *  _postalCode = "1234",
             *  _cultureInfo = "sv-se",
             *  _hashedPassword = "******",
             *  _idNumber = "7451651",
             *  _salt = new byte[] {22},
             *  _street = "poasdas vägen"
             * };
             * int id = _userHandler.AddUser(UserToAdd);
             * var AccountToAdd = new Account
             * {
             *  AccountType = AccountType.Customer,
             *  Owner = _userHandler.GetUser(id)
             * };
             *
             * _accountHandler.AddAccount(AccountToAdd);
             *
             * var HouseUserToAdd = new User
             * {
             *  _firstName = "New Shiny Bolaget AB",
             *  _city = "Stockholm",
             *  _lastName = "",
             *  _postalCode = "11040",
             *  _cultureInfo = "sv-se",
             *  _hashedPassword = "******",
             *  _idNumber = "7451651",
             *  _salt = new byte[] { 22 },
             *  _street = "fina gatan 22B"
             * };
             *
             * int Houseid = _userHandler.AddUser(HouseUserToAdd);
             *
             * var HouseAccountToAdd = new Account
             * {
             *  AccountType = AccountType.House,
             *  Owner =_userHandler.GetUser(Houseid)
             * };
             * int HouseAccountId = _accountHandler.AddAccount(HouseAccountToAdd);
             *
             * var sdf = _userHandler.GetUser(Houseid);
             *
             * AccountToAdd = new Account
             * {
             *  AccountType = AccountType.Bank,
             *  Owner = _userHandler.GetUser(Houseid)
             * };
             * _accountHandler.AddAccount(AccountToAdd);
             */
        }
Esempio n. 4
0
 public NonBlockingConnection(string host, int port, ISystemHandler handler) : this(host, port, 2048, handler)
 {
 }
Esempio n. 5
0
            //数据缓冲池

            public InnerEventHandler(ISystemHandler handler, NonBlockingConnection conn)
            {
                this.conn    = conn;
                this.handler = handler;
            }
Esempio n. 6
0
        public MessageHandler(ISystemHandler <T> handler)
        {
            Ensure.NotNull(handler, nameof(handler));

            this.handler = handler;
        }