Example #1
0
        public Server()
        {
            this._settings = new Settings();
            this._items = new Items();
            this.clients = new ClientList(ref this._settings, ref this._items);
            this._listener = new Listener(ref this._settings, ref this.clients);
            this.iu = new InterfaceUpdater(ref this._settings, ref this._listener, ref this.clients, ref _items);

            this._items.Bind(ref this.clients);
        }
        public ClientList(ref Settings _settings, ref Items _items)
        {
            this.clientObjects = new ClientObject[_settings.ServerSize];

            this.runing = false;

            this._items = _items;

            this.worker = new Thread(new ThreadStart(Taskworker));
            this.worker.IsBackground = false;
            this.worker.Name = THREAD_NAME_WORKER;
        }
        public InterfaceUpdater(ref Settings _settings, ref Listener _listener, ref ClientList clients, ref Items auctionItems)
        {
            this.runnig = false;
            this.updateing = false;

            this._settings = _settings;
            this._listener = _listener;
            this.clients = clients;
            this.auctionItems = auctionItems;

            this.task = new Thread(new ThreadStart(Task));
            this.task.Name = THREAD_NAME;

            Console.Title = CONSOLE_TITLE + " - " + this._settings.ServerIP;
        }
Example #4
0
        public Player(string playerName, IWebSocketConnection socket, Settings settings)
        {
            Settings = settings;
            Socket = socket;

            Data = new PlayerData();
            Data.Name = playerName;
            Data.ID = Guid.NewGuid().ToString();

            socket.OnClose += () =>
            {
                if (OnConnectionClosed != null)
                    OnConnectionClosed(this, new PlayerConnectionClosed(this, PlayerCloseReason.Disconnected));
            };

            socket.OnMessage += (json) => OnRecieveMessage(json);
            socket.OnBinary += (bytes) => OnRecieveMessage(Encoding.UTF8.GetString(bytes));
        }
        public Listener(ref Settings _settings, ref ClientList _clientList)
        {
            this.runnig = false;
            this.closed = false;

            this.idConter = 0;

            this._clientList = _clientList;

            // Socket setup
            this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this._socket.Bind(_settings.ServerIP);
            this._socket.Listen(_settings.ServerQueueSize);

            // Worker thread setup
            this._task = new Thread(new ThreadStart(Task));
            this._task.IsBackground = false;
            this._task.Name = THREAD_NAME;
        }
Example #6
0
File: Main.cs Project: DQST/Chat
 private void настройкиToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Settings f2 = new Settings();
     f2.Show(this);
 }