Esempio n. 1
0
        public void CanFindFromAssembly()
        {
            Assembly           assembly  = this.GetType().Assembly;
            IFinder <ICommand> cmdFinder = new CommandFinder(assembly);
            ICommand           cmd       = cmdFinder.Find <FirstTestCommand>();

            Assert.True(cmd != null && cmd.GetType() == typeof(FirstTestCommand));
        }
Esempio n. 2
0
        public void CanFindSingleCommand(string assemblyName)
        {
            string             dllFile   = $@"{Directory.GetCurrentDirectory()}\{assemblyName}";
            IFinder <ICommand> cmdFinder = new CommandFinder(dllFile);
            ICommand           cmd       = cmdFinder.Find <FirstTestCommand>();

            Assert.True(cmd != null, $"Did not find '{typeof(FirstTestCommand).Name}'");
            Assert.True(cmd.GetType() == typeof(FirstTestCommand));
        }
Esempio n. 3
0
        /// <summary>
        /// TODO
        /// </summary>
        /// <param name="bytes"></param>
        public void HandleServerCommand(byte[] bytes)
        {
            var parser = new ByteParser(bytes);

            Console.WriteLine($"Received parser id ->{parser.CMD_ID}");
            Console.WriteLine($"Received from Server ->{CommandFinder.Find(parser.CMD_ID)}");
            switch (parser.CMD_ID)
            {
            case ShipInitializationCommand.ID:

                break;
            }

            MainController.Instance.User.RedirectPacket(PacketDestinations.SERVER_TO_CLIENT, bytes);
        }
Esempio n. 4
0
        public void HandleClientCommand(byte[] bytes)
        {
            var parser = new ByteParser(bytes);

            Console.WriteLine($"Received parser id ->{parser.CMD_ID}");
            Console.WriteLine($"Received from Client ->{CommandFinder.Find(parser.CMD_ID)}");

            if (parser.CMD_ID == 666)
            {
                MainForm.Connected = true;
                MainController.Instance.User.RedirectPacket(PacketDestinations.SERVER_TO_CLIENT, ShipInitializationCommand.write(2103, "devsnowy", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, true, 1, 1, 1, 1, 1, 1, 1, "", 1, false, false, new List <VisualModifierCommand>()));
                Console.WriteLine("STAY ALIIIIVE");
            }

            MainController.Instance.User.RedirectPacket(PacketDestinations.CLIENT_TO_SERVER, bytes);
        }