Ejemplo n.º 1
0
        public ConnectionToken Parse(string data)
        {
            var result = data.Split(new[] { "\t" }, StringSplitOptions.RemoveEmptyEntries);

            var token = new ConnectionToken
            {
                GameHost = result[7].Substring(9).Trim(_charArray),
                GamePort = Int32.Parse(result[8].Substring(9).Trim(_charArray)),
                Key = result[9].Substring(4).Trim(_charArray)
            };

            return token;
        }
Ejemplo n.º 2
0
        public void splits_data_into_line_feed_chunks()
        {
            const string stream = "\n<streamWindow id=\"main\" title=\"Story\" location=\"center\" target=\"drop\" resident=\"true\"/>\n<streamWindow id='inv' title='My Inventory' target='wear' ifClosed='' resident='true'/>\n<clear";
            const string stream2 = "Stream id='inv' ifClosed=''/>\n";

            const string expect1 = "\n<streamWindow id=\"main\" title=\"Story\" location=\"center\" target=\"drop\" resident=\"true\"/>\n<streamWindow id='inv' title='My Inventory' target='wear' ifClosed='' resident='true'/>\n";
            const string expect2 = "<clearStream id='inv' ifClosed=''/>\n";

            var token = new ConnectionToken();
            token.Key = "abcd1234";

            theGameServer.Connect(token);

            theSocket.FireReceiveMessage(stream);

            Assert.AreEqual(expect1, theGameState.LastReadData);

            theSocket.FireReceiveMessage(stream2);

            Assert.AreEqual(expect2, theGameState.LastReadData);
        }
Ejemplo n.º 3
0
        public void Connect(ConnectionToken token)
        {
            var connectionString = String.Format(ConnectionStringTemplate, token.Key, StormFrontVersion, Environment.OSVersion.Platform);

            _asyncSocket = _services.Get<IAsyncSocket>();
            _asyncSocket.ReceiveMessage += HandleReceiveMessage;
            _asyncSocket.Connect(token.GameHost, token.GamePort);
            _asyncSocket.SendMessage(connectionString);
        }
Ejemplo n.º 4
0
 public void Connect(ConnectionToken token)
 {
     throw new NotImplementedException();
 }