public void PipeMessage(NamedPipeConnection <PipeData, PipeData> conn, PipeData message) { Console.WriteLine("Received " + message.id); if (message.id == "SigWorldData") { SigWorldData data = (SigWorldData)message.data.ToObject(); if (data != null) { Console.WriteLine(string.Format("CLIENT WORLD: {0}", data.world)); } } }
public void PipeMessage(NamedPipeConnection <PipeData, PipeData> conn, PipeData message) { Type type = Type.GetType(message.id + ",FFMemoryParser"); if (type == null) { return; } Object obj = message.data.ToObject(); if (obj != null) { if (type.Name == "SignatureList") { Memory.SignatureList data = (obj as Memory.SignatureList); if (data != null) { foreach (Signature item in data) { Console.WriteLine(string.Format("Signature {0} Not found!", item.Key)); } } } if (type.Name == "SigWorldData") { SigWorldData data = (obj as SigWorldData); if (data != null) { World = data.world; } } if (type.Name == "SigCharIdData") { SigCharIdData data = (obj as SigCharIdData); if (data != null) { CharacterID = data.id; OnCharacterId?.Invoke(this, CharacterID); } } // ... if (type.Name == "SigPerfData") { SigPerfData data = (obj as SigPerfData); if (data != null) { performanceData = data; OnPerformanceChanged?.Invoke(this, performanceData); } } if (type.Name == "SigActorsData") { SigActorsData data = (obj as SigActorsData); if (data != null) { actorData = data; ActorData local = null; if (actorData.currentActors.Count > 0) { local = actorData.currentActors.First().Value; } if (localPlayer == null || local.name != localPlayer.name) { localPlayer = local; if (localPlayer != null) { OnLocalPlayerLogin?.Invoke(this, localPlayer); } else { OnLocalPlayerLogout?.Invoke(this, localPlayer); } } } } if (type.Name == "SigChatLogData") { SigChatLogData data = (obj as SigChatLogData); if (data != null) { foreach (ChatLogItem item in data.chatMessages) { OnChatReceived?.Invoke(this, item); } } } if (type.Name == "SigChatInputData") { SigChatInputData data = (obj as SigChatInputData); if (data != null) { ChatInputOpen = data.open; if (data.open) { Console.WriteLine(data.text); } } } } }