private static void Send(object sdu, SettingCode sc) { SettingStruct?pdu = null; switch (sdu) { case FormSettingStruct fss: pdu = PDU(SettingType.Form, sc, JsonConvert.SerializeObject(fss)); break; case MessageSettingStruct mss: pdu = PDU(SettingType.Message, sc, JsonConvert.SerializeObject(mss)); break; case LogSettingStruct lss: pdu = PDU(SettingType.Log, sc, JsonConvert.SerializeObject(lss)); break; default: LogClerk.Error("Invalid setting message type.", 2); break; } if (pdu != null) { MessageManager.Send(pdu); } }
private static SettingStruct PDU(SettingType st, SettingCode sc, string sdu) { SettingStruct pdu = new SettingStruct { type = st, code = sc, content = sdu }; return(pdu); }