Example #1
0
        public StatusCode Connect()
        {
            SystemProcessor = new SystemProcessor(this);
            KexProcessor    = new KeyExchangeProcessor(this);
            var ident = new IdentificationProcessor(this);

            Socket = new SshSocket(this);
            var code = Socket.Connect(Hostname, Port);

            if (code == StatusCode.OK)
            {
                ident.Wait();
                if (ident.StatusCode != StatusCode.OK)
                {
                    return(ident.StatusCode);
                }

                KexProcessor.Wait();
                if (KexProcessor.StatusCode != StatusCode.OK)
                {
                    return(KexProcessor.StatusCode);
                }

                var auth = new AuthenticationProcessor(this);
                auth.Wait();
                IsAuthenticated = auth.StatusCode == StatusCode.OK;
                return(auth.StatusCode);
            }
            return(code);
        }
Example #2
0
        public void Run(SystemDefinition systemDefinition, SystemState systemState, DateTime tsFrom, DateTime tsTo)
        {
            systemDefinition.Prepare();

            SystemProcessor processor = new SystemProcessor(
                _dataProvider,
                _dataLoader,
                systemDefinition.DataDefinitionProvider,
                systemDefinition.SignalGeneratorOnOpen,
                systemDefinition.SignalGeneratorOnClose,
                systemDefinition.Commission,
                systemDefinition.Slippage,
                systemDefinition.MMPositionCloseCalculator);

            processor.Process(systemState, tsFrom, tsTo);
        }
Example #3
0
        private static void Main(string[] args)
        {
            var cm = new ComponentManager();

            var sp = new SystemProcessor(cm);

            sp.RegisterSystem(new MoverSystem());
            sp.RegisterSystem(new ControllerSystem());
            sp.RegisterSystem(new ConsoleRenderSystem());

            var em     = new EntityManager(sp, cm);
            var entity = em.CreateEntity();

            em.AddComponent <Position>(entity);
            em.AddComponent <Velocity>(entity);

            var nw = new NativeWindow(960, 540, "WINDOW", GameWindowFlags.Default, GraphicsMode.Default,
                                      DisplayDevice.Default);

            nw.KeyDown += OnKeyDown;
            nw.KeyUp   += OnKeyUp;

            nw.Visible = true;

            while (nw.Exists)
            {
                nw.ProcessEvents();
                var keyboardState = Keyboard.GetState();
                foreach (var key in Enum.GetValues(typeof(Key)))
                {
                    if (keyboardState.IsKeyDown((Key)key))
                    {
                        Console.WriteLine(key);
                    }
                }
                sp.Process(1f / 60f);
            }
        }