private void DataReceived(string instanceId, string connectionId, string messageType, byte[] data)
{
// Find instance
MonoExpanderInstance instance;
if (!this.clientInstances.TryGetValue(instanceId, out instance))
return;
object messageObject;
Type type;
using (var ms = new MemoryStream(data))
{
lock (this.typeCache)
{
if (!this.typeCache.TryGetValue(messageType, out type))
{
type = typeof(Animatroller.Framework.MonoExpanderMessages.Ping).Assembly.GetType(messageType, true);
this.typeCache.Add(messageType, type);
}
}
messageObject = DeserializeFromStream(ms, type);
}
instance.HandleMessage(connectionId, type, messageObject);
}
}