Ejemplo n.º 1
0
        public static void Main()
        {
            ServiceCollection service = new ServiceCollection();

            ConfigureServices(service);
            ServiceProvider       serviceProvider      = service.BuildServiceProvider();
            IServerCommandHandler serverCommandHandler = new ServerCommandHandler(serviceProvider);
            IServer          server           = new CommandResponseProtocol.CRServer.Server(serverCommandHandler);
            RunPropertyModel runPropertyModel = InputAdress();

            server.Run(runPropertyModel);
        }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        string[] args = Environment.GetCommandLineArgs();

        _textfield.text = "";

        for (int i = 0; i < args.Length; i++)
        {
            _textfield.text += "argument " + i + ": " + args[i] + " ";
        }
        try
        {
            portToUse = int.Parse(args[1]);
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }

        _textfield.text += "      Using port: " + portToUse;

        _commandHandler   = new ServerCommandHandler();
        _objectList       = new List <GameObject>();
        _nextObjectID     = 0;
        _nextNetworkingID = 0;
        _clients          = new List <TcpClient>();
        _writers          = new List <BinaryWriter>();
        _readers          = new List <BinaryReader>();
        _timesSinceClientsLastHeartBeat = new List <float>();
        _listener = new TcpListener(IPAddress.Any, portToUse);
        _listener.Start();

        //just here to response to the instantiator
        TcpClient    client = new TcpClient("127.0.0.1", 45153);
        BinaryWriter writer = new BinaryWriter(client.GetStream());

        writer.Write(portToUse);

        writer = null;
        client.Close();
        client = null;
    }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            AllPlayers = new List <Player>();

            LoggerManager = new LoggerManager();

            //temp
            string destPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\MapMaker\MongoLogin\");

            Directory.CreateDirectory(destPath);

            var filePath = Path.Combine(destPath, "login" + ".txt");

            var loginString = File.ReadAllText(filePath);

            var tempIndex = loginString.IndexOf(" ");

            var mongoName = loginString.Substring(0, tempIndex);

            var mongoPass = loginString.Substring(tempIndex + 1, loginString.Length - tempIndex - 1);

            //temp end

            _server = new Server(LoggerManager, AllPlayers, mongoName, mongoPass);

            PlayersDataGrid.DataContext = _server;
            ConsoleDataGrid.DataContext = LoggerManager;
            TxbCommand.DataContext      = this;

            var _lock = new object();

            BindingOperations.EnableCollectionSynchronization(LoggerManager.LogMessages, _lock);

            ServerCommandHandler = new ServerCommandHandler(LoggerManager, AllPlayers);

            _cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
            _ramCounter = new PerformanceCounter("Process", "Working Set", Process.GetCurrentProcess().ProcessName);

            BtnStart_Click(_lock, new RoutedEventArgs());
        }
Ejemplo n.º 4
0
        public static void Main()
        {
            FConsole.Title = "CLIENT APP";
            GlobalExceptionHandler.Setup();
            Jit.PreJit();

            StartupScreen.Draw();

            while (true)
            {
                DrawUI();
                //HomeScreen.Draw();
                var input = FConsole.ReadLine();

                if (input.StartsWith('/'))
                {
                    var command = input.Split(' ')[0];
                    switch (command)
                    {
                    case "/s":
                        ServerCommandHandler.Process(input);
                        break;

                    case "/c":
                        ChannelCommandHandler.Process(input);
                        break;

                    case "/dm":
                        ServerCommandHandler.Process("/s 0");
                        break;
                    }
                }
                else
                {
                    Core.MyUser.SendMessage(input);
                }
            }
        }
Ejemplo n.º 5
0
 public TriggerQueueElement(ServerCommandHandler handler, string[] args)
 {
     this.handler = handler;
     this.args    = args;
 }
Ejemplo n.º 6
0
        public virtual void Prepare()
        {
            ServerInformation  = new ServerInformation( "OSTBLOCK COMMAND SERVER", "OSTBLOCK COMMAND SERVER", new Version(0,1,0,0))
                                     {ServerState = EServerState.Prepareing};

            _commandSerializer = new CommandSerializer();
            CommandFactory = new ServerCommandFactory();
            _streamIOService = new StreamIOService();
            CommandQueueService = new CommandQueueService();
            ServerCommandHandler = new ServerCommandHandler(this);

            ClientManager = new ClientManager(this,CommandQueueService, _commandSerializer, _streamIOService);

            CommandQueueService.OnCommandPending += CommandQueueService_OnCommandPending;

            ServerInformation.ServerState = EServerState.Prepared;
            if(OnPrepared != null)
                OnPrepared.Invoke(this,new EventArgs());
        }