protected override void ParseMessage(IncomingMessage inMessage) { worldName = inMessage.ReadString(); status = inMessage.ReadBool(); hostname = inMessage.ReadString(); port = inMessage.ReadInt32(); try { patcherUrl = inMessage.ReadString(); updateUrl = inMessage.ReadString(); } catch (System.IO.EndOfStreamException) { log.Warn("Got old style world resolve response"); // ignore this - it means we got an old style response } }
protected override void ParseMessage(IncomingMessage inMessage) { int numEntries = inMessage.ReadInt32(); for (int i = 0; i < numEntries; ++i) { string type = inMessage.ReadString(); switch (type) { case "add": AnimationEntry entry = new AnimationEntry(); entry.animationName = inMessage.ReadString(); entry.animationSpeed = 1.0f; entry.loop = inMessage.ReadBool(); if (animations.Count > 0) { AnimationEntry last = animations[animations.Count - 1]; if (last.loop) animations.RemoveAt(animations.Count - 1); } animations.Add(entry); break; case "clear": animations.Clear(); clear = true; break; default: log.WarnFormat("Invalid animation message type: {0}", type); break; } } }
public TestClass() { SetupDebug(); // const int ServerPort = 200; const int ServerPort = 5001; const int ClientPort = 6666; IPHostEntry IPHost = Dns.GetHostEntry("cedeno-dxp.corp.multiverse.net"); IPAddress[] addr = IPHost.AddressList; IPEndPoint sendpt = new IPEndPoint(addr[0], ServerPort); RdpClient rdpClient = new RdpClient(ClientPort, 100, 1000, true); RdpClient rdpClient2 = new RdpClient(ClientPort + 1, 100, 1000, false); //RdpServer rdpServer = new RdpServer(ServerPort, 100, 1000, true); RdpConnection rdpClientConn = rdpClient.Connect(sendpt); RdpConnection rdpClientConn2 = rdpClient2.Connect(sendpt); // RdpConnection rdpServerConn = rdpServer.Accept(); rdpClientConn.WaitForState(ConnectionState.Open); rdpClientConn2.WaitForState(ConnectionState.Open); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); OutgoingMessage outMessage = new OutgoingMessage(); outMessage.Write("Good morning"); outMessage.Send(rdpClientConn); outMessage.Send(rdpClientConn2); // byte[] msg = Encoding.ASCII.GetBytes("Test"); // rdpClientConn.Send(msg); // rdpClientConn.Send(msg); // rdpClientConn.Send(msg); IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); IncomingMessage inMessage; inMessage = new IncomingMessage(rdpClientConn); Console.WriteLine("Got message: {0}", inMessage.ReadString()); inMessage = new IncomingMessage(rdpClientConn2); Console.WriteLine("Got message2: {0}", inMessage.ReadString()); // for (int i = 0; i < 3; ++i) { // byte[] rcvdMessage = rdpServerConn.Receive(ref remoteEP); // Console.WriteLine("Server got message from {1}: '{0}'", // Encoding.ASCII.GetString(rcvdMessage), remoteEP); // rdpServerConn.Send(msg); // } // // for (int i = 0; i < 3; ++i) { // byte[] rcvdMessage = rdpClientConn.Receive(ref remoteEP); // Console.WriteLine("Client got message from {1}: '{0}'", // Encoding.ASCII.GetString(rcvdMessage), remoteEP); // } // // rdpServerConn.Close(); Thread.Sleep(100); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); Thread.Sleep(31000); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); FinishDebug(); //rdpConn.Open(false, 1, 2, 3, 4, true); //rdpConn.Send(new Multiverse.Network.Rdp.RdpPacket(50)); //this.Hide(); //this.WindowState = FormWindowState.Minimized; }
public static BaseWorldMessage ReadMessage(IncomingMessage inMessage) { BaseWorldMessage rv; long oid = inMessage.ReadInt64(); WorldMessageType messageType = inMessage.ReadMessageType(); switch (messageType) { case WorldMessageType.LoginResponse: rv = new LoginResponseMessage(); break; case WorldMessageType.Comm: rv = new CommMessage(); break; case WorldMessageType.Direction: rv = new DirectionMessage(); break; case WorldMessageType.Orientation: rv = new OrientationMessage(); break; case WorldMessageType.TerrainConfig: rv = new TerrainConfigMessage(); break; case WorldMessageType.SkyboxMaterial: rv = new SkyboxMaterialMessage(); break; case WorldMessageType.NewObject: rv = new NewObjectMessage(); break; case WorldMessageType.FreeObject: rv = new FreeObjectMessage(); break; case WorldMessageType.AcquireResponse: rv = new AcquireResponseMessage(); break; case WorldMessageType.EquipResponse: rv = new EquipResponseMessage(); break; case WorldMessageType.UnequipResponse: rv = new UnequipResponseMessage(); break; case WorldMessageType.Attach: rv = new AttachMessage(); break; case WorldMessageType.Detach: rv = new DetachMessage(); break; case WorldMessageType.StatUpdate: rv = new StatUpdateMessage(); break; case WorldMessageType.Damage: rv = new DamageMessage(); break; case WorldMessageType.Animation: rv = new AnimationMessage(); break; case WorldMessageType.Sound: rv = new SoundMessage(); break; case WorldMessageType.AmbientSound: rv = new AmbientSoundMessage(); break; case WorldMessageType.FollowTerrain: rv = new FollowTerrainMessage(); break; case WorldMessageType.Portal: rv = new PortalMessage(); break; case WorldMessageType.AmbientLight: rv = new AmbientLightMessage(); break; case WorldMessageType.NewLight: rv = new NewLightMessage(); break; case WorldMessageType.TradeStartRequest: rv = new TradeStartRequestMessage(); break; case WorldMessageType.TradeStart: rv = new TradeStartMessage(); break; case WorldMessageType.TradeOfferRequest: rv = new TradeOfferRequestMessage(); break; case WorldMessageType.TradeComplete: rv = new TradeCompleteMessage(); break; case WorldMessageType.TradeOfferUpdate: rv = new TradeOfferUpdateMessage(); break; case WorldMessageType.StateMessage: rv = new StateMessage(); break; case WorldMessageType.QuestInfoRequest: rv = new QuestInfoRequestMessage(); break; case WorldMessageType.QuestInfoResponse: rv = new QuestInfoResponseMessage(); break; case WorldMessageType.QuestResponse: rv = new QuestResponseMessage(); break; case WorldMessageType.RegionConfig: rv = new RegionConfigMessage(); break; case WorldMessageType.InventoryUpdate: rv = new InventoryUpdateMessage(); break; case WorldMessageType.QuestLogInfo: rv = new QuestLogInfoMessage(); break; case WorldMessageType.QuestStateInfo: rv = new QuestStateInfoMessage(); break; case WorldMessageType.RemoveQuestRequest: rv = new RemoveQuestRequestMessage(); break; case WorldMessageType.RemoveQuestResponse: rv = new RemoveQuestResponseMessage(); break; case WorldMessageType.GroupInfo: rv = new GroupInfoMessage(); break; case WorldMessageType.UiTheme: rv = new UiThemeMessage(); break; case WorldMessageType.LootAll: rv = new LootAllMessage(); break; case WorldMessageType.OldModelInfo: rv = new OldModelInfoMessage(); break; case WorldMessageType.FragmentMessage: rv = new FragmentMessage(); break; case WorldMessageType.RoadInfo: rv = new RoadInfoMessage(); break; case WorldMessageType.Fog: rv = new FogMessage(); break; case WorldMessageType.AbilityInfo: rv = new AbilityInfoMessage(); break; case WorldMessageType.AbilityUpdate: rv = new AbilityUpdateMessage(); break; case WorldMessageType.OldObjectProperty: rv = new OldObjectPropertyMessage(); break; case WorldMessageType.ObjectProperty: rv = new ObjectPropertyMessage(); break; case WorldMessageType.AddParticleEffect: rv = new AddParticleEffectMessage(); break; case WorldMessageType.RemoveParticleEffect: rv = new RemoveParticleEffectMessage(); break; case WorldMessageType.TrackObjectInterpolation: rv = new TrackObjectInterpolationMessage(); break; case WorldMessageType.TrackLocationInterpolation: rv = new TrackLocationInterpolationMessage(); break; case WorldMessageType.OldExtension: rv = new OldExtensionMessage(); break; case WorldMessageType.Extension: rv = new ExtensionMessage(); break; case WorldMessageType.InvokeEffect: rv = new InvokeEffectMessage(); break; case WorldMessageType.MobPath: rv = new MobPathMessage(); break; case WorldMessageType.AggregatedRDP: rv = new AggregatedRDPMessage(); break; case WorldMessageType.NewDecal: rv = new NewDecalMessage(); break; case WorldMessageType.FreeDecal: rv = new FreeDecalMessage(); break; case WorldMessageType.ModelInfo: rv = new ModelInfoMessage(); break; case WorldMessageType.SoundControl: rv = new SoundControlMessage(); break; case WorldMessageType.DirLocOrient: rv = new DirLocOrientMessage(); break; case WorldMessageType.AuthorizedLogin: rv = new AuthorizedLoginMessage(); break; case WorldMessageType.AuthorizedLoginResponse: rv = new AuthorizedLoginResponseMessage(); break; case WorldMessageType.LoadingState: rv = new LoadingStateMessage(); break; default: log.ErrorFormat("Unhandled world message type: {0}", messageType); return null; } rv.ParseWorldMessage(oid, inMessage); return rv; }
protected override void ParseMessage(IncomingMessage inMessage) { color = inMessage.ReadColor(); }
protected override void ParseMessage(IncomingMessage inMessage) { uiModules = new List<string>(); int numModules = inMessage.ReadInt32(); for (int i = 0; i < numModules; ++i) uiModules.Add(inMessage.ReadString()); try { // introduced in 1.0 keyBindingsFile = inMessage.ReadString(); } catch (Exception) { } }
protected override void ParseMessage(IncomingMessage inMessage) { version = inMessage.ReadString(); worldToken = inMessage.ReadBytes(); error = inMessage.ReadString(); int entryCount = inMessage.ReadInt32(); entries = new List<PropertyMap>(); for (int i = 0; i < entryCount; ++i) { PropertyMap entry = new PropertyMap(); entry.OldParseMessage(inMessage); entries.Add(entry); } }
protected override void ParseMessage(IncomingMessage inMessage) { statValues.Clear(); int numElements = inMessage.ReadInt32(); for (int i = 0; i < numElements; ++i) { string statName = inMessage.ReadString(); int statValue = inMessage.ReadInt32(); statValues[statName] = statValue; } }
protected override void ParseMessage(IncomingMessage inMessage) { objectId = inMessage.ReadInt64(); }
protected override void ParseMessage(IncomingMessage inMessage) { int numEntries = inMessage.ReadInt32(); for (int i = 0; i < numEntries; ++i) { string type = inMessage.ReadString(); switch (type) { case "add": SoundEntry entry = new SoundEntry(); entry.soundName = inMessage.ReadString(); if (entry.soundName == "idle") { sounds.Clear(); clear = true; break; } else if (entry.soundName == "strike") { entry.soundName = "swing.wav"; } else if (entry.soundName == "run") { entry.soundName = "gravelwalk.wav"; } else if (entry.soundName == "death") { entry.soundName = "ugh.wav"; } entry.soundSpeed = 1.0f; entry.soundGain = 1.0f; entry.loop = inMessage.ReadBool(); log.InfoFormat("Playing Sound {0}, looping = {1}", entry.soundName, entry.loop); if (sounds.Count > 0) { SoundEntry last = sounds[sounds.Count - 1]; if (last.loop) sounds.RemoveAt(sounds.Count - 1); } sounds.Add(entry); break; case "clear": sounds.Clear(); clear = true; break; default: log.ErrorFormat("Invalid sound message type: {0}", type); break; } } }
protected override void ParseMessage(IncomingMessage inMessage) { int stateCount = inMessage.ReadInt32(); while (stateCount > 0) { string key = inMessage.ReadString(); int val = inMessage.ReadInt32(); states[key] = val; stateCount--; } }
protected override void ParseMessage(IncomingMessage inMessage) { newSoundEntries = new Dictionary<string, PropertyMap>(); freeSoundEntries = new List<string>(); clearSounds = false; int numEntries = inMessage.ReadInt32(); for (int i = 0; i < numEntries; ++i) { string msgType = inMessage.ReadString(); switch (msgType) { case "on": { string soundName = inMessage.ReadString(); PropertyMap propertyMap = new PropertyMap(); propertyMap.ParseMessage(inMessage); newSoundEntries[soundName] = propertyMap; } break; case "off": freeSoundEntries.Add(inMessage.ReadString()); break; case "clear": clearSounds = true; break; } } }
protected override void ParseMessage(IncomingMessage inMessage) { material = inMessage.ReadString(); }
protected override void ParseMessage(IncomingMessage inMessage) { name = inMessage.ReadString(); points = new List<Vector3>(); int numPoints = inMessage.ReadInt32(); for (int i = 0; i < numPoints; ++i) { IntVector3 point = inMessage.ReadIntVector(); points.Add(point.ToVector3()); } try { halfWidth = inMessage.ReadInt32(); } catch (System.IO.EndOfStreamException) { log.Warn("Got old style road message"); // ignore this - it means we got an old style message halfWidth = -1; // Use default } }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); int numItems = inMessage.ReadInt32(); for (int i = 0; i < numItems; ++i) { InvItemInfo info = new InvItemInfo(); info.itemId = inMessage.ReadInt64(); info.name = inMessage.ReadString(); info.icon = inMessage.ReadString(); offer1.Add(info); } accepted1 = inMessage.ReadBool(); numItems = inMessage.ReadInt32(); for (int i = 0; i < numItems; ++i) { InvItemInfo info = new InvItemInfo(); info.itemId = inMessage.ReadInt64(); info.name = inMessage.ReadString(); info.icon = inMessage.ReadString(); offer2.Add(info); } accepted2 = inMessage.ReadBool(); }
protected override void ParseMessage(IncomingMessage inMessage) { configKind = inMessage.ReadString(); configString = inMessage.ReadString(); }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); }
protected override void ParseMessage(IncomingMessage inMessage) { timestamp = inMessage.ReadTimestamp(); }
protected override void ParseMessage(IncomingMessage inMessage) { int subMessageCount = inMessage.ReadInt32(); for (int i = 0; i < subMessageCount; i++) { byte[] subMessageBytes = inMessage.ReadBytes(); IncomingMessage subMessage = new IncomingMessage(subMessageBytes, inMessage); BaseWorldMessage msg = WorldMessageFactory.ReadMessage(subMessage); if (msg != null) subMessages.Add(msg); else log.WarnFormat("AggregatedRDP.ParseMessage got null when reading message from {0} bytes", subMessageBytes.Length); } }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); particleOid = inMessage.ReadInt64(); timeToImpact = inMessage.ReadInt32(); timestamp = inMessage.ReadTimestamp(); location = inMessage.ReadIntVector(); }
protected override void ParseMessage(IncomingMessage inMessage) { propertyMap = new PropertyMap(); propertyMap.ParseMessage(inMessage); }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); particleOid = inMessage.ReadInt64(); timeToImpact = inMessage.ReadInt32(); timestamp = inMessage.ReadTimestamp(); targetSocket = inMessage.ReadString(); }
public static BaseWorldTcpMessage ReadMessage(IncomingMessage inMessage) { BaseWorldTcpMessage rv; byte[] data = inMessage.ReadBytes(); IncomingMessage subMsg = new IncomingMessage(data, inMessage); WorldTcpMessageType messageType = subMsg.ReadWorldTcpMessageType(); switch (messageType) { case WorldTcpMessageType.CharacterResponse: rv = new WorldCharacterResponseMessage(); break; case WorldTcpMessageType.CharacterCreateResponse: rv = new WorldCharacterCreateResponseMessage(); break; case WorldTcpMessageType.CharacterDeleteResponse: rv = new WorldCharacterDeleteResponseMessage(); break; case WorldTcpMessageType.CharacterSelectResponse: rv = new WorldCharacterSelectResponseMessage(); break; default: log.ErrorFormat("Unhandled world tcp message type: {0}", messageType); return null; } log.InfoFormat("WorldTcpMessageFactory got message type: {0}", messageType); rv.ParseWorldTcpMessage(subMsg); return rv; }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); status = inMessage.ReadInt32(); }
protected override void ParseMessage(IncomingMessage inMessage) { active = inMessage.ReadBool(); sound = inMessage.ReadString(); }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); accepted = inMessage.ReadBool(); cancelled = inMessage.ReadBool(); int numItems = inMessage.ReadInt32(); for (int i = 0; i < numItems; ++i) { offer.Add(inMessage.ReadInt64()); } }
public IncomingMessage(byte[] buf, IncomingMessage source) { Init(buf, source.remoteIpEndPoint); }
protected override void ParseMessage(IncomingMessage inMessage) { base.ParseMessage(inMessage); slotName = inMessage.ReadString(); effectName = inMessage.ReadString(); orientation = inMessage.ReadQuaternion(); velocityMultiplier = inMessage.ReadSingle(); particleSizeMultiplier = inMessage.ReadSingle(); particleBooleans = inMessage.ReadByte(); if (GetFlag(Flags.HasColor)) color = inMessage.ReadColor(); }
public static void RunIncoming() { int receiveCount = 0; long lastReceiveCounterResetTime = CurrentTime; try { while (true) { long currentTime = CurrentTime; long interval = currentTime - lastReceiveCounterResetTime; if (interval > 1000) { lastReceiveCounterResetTime = currentTime; Logit("Received " + receiveCount + " messages" + " in the last " + interval + "ms"); receiveCount = 0; } Debug.Assert(rdpConnection != null, "In TestRDPClient.RunIncoming, rdpConnection is null!"); IncomingMessage inMessage = new IncomingMessage(rdpConnection); receiveCount++; Trace.TraceInformation("TestRDPClient got message '" + inMessage.ReadString()); } } catch(Exception e) { Logit("TestRDPClient.RunIncoming got error: " + e.ToString()); } }
protected override void ParseMessage(IncomingMessage inMessage) { questId = inMessage.ReadInt64(); int numEntries = inMessage.ReadInt32(); for (int i = 0; i < numEntries; ++i) objectives.Add(inMessage.ReadString()); }