private void MessageReceived(GameServer server, IProtocol message) { switch ((ProtocolDef)message.ProtocolId) { case ProtocolDef.g2e_getcpuload_def: { g2e_getcpuload protocol = message as g2e_getcpuload; ushort[] loads = new ushort[protocol.nCPUCount]; Array.Copy(protocol.nLoad, loads, loads.Length); server.UpdateCpuLoad(loads); } break; case ProtocolDef.g2e_getcpubaseinfo_def: { g2e_getcpubaseinfo protocol = message as g2e_getcpubaseinfo; cpubaseinfo[] infos = new cpubaseinfo[protocol.nCPUCount]; Array.Copy(protocol.Processor, infos, infos.Length); server.UpdateCpuBasicInfo(infos); } break; default: break; } }