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; }
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); }
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); }
public void Connect(ConnectionToken token) { throw new NotImplementedException(); }