public static void Receive(string message) { try { MessageStruct ms = JsonConvert.DeserializeObject <MessageStruct>(message); switch (ms.type) { case MessageType.setting: SettingsManager.Deal(ms.content); break; case MessageType.action: ActionManager.Deal(ms.content); break; case MessageType.nursery: NurseryManager.Deal(ms.content); break; case MessageType.logging: LoggingManager.Deal(ms.content); break; default: LoggingManager.Warn("Invalid message type"); break; } } catch (JsonException e) { LoggingManager.Warn($"Deserialize MessageSettingStruct failed:{e.Message}"); } }