/// <summary> /// Converts from a message type to the expected BaseStation text. /// </summary> /// <param name="messageType"></param> /// <returns></returns> public static string ConvertToString(BaseStationMessageType messageType) { string result = null; switch (messageType) { case BaseStationMessageType.NewAircraft: result = "AIR"; break; case BaseStationMessageType.NewIdentifier: result = "ID"; break; case BaseStationMessageType.StatusChange: result = "STA"; break; case BaseStationMessageType.Transmission: result = "MSG"; break; case BaseStationMessageType.Unknown: result = ""; break; case BaseStationMessageType.UserClicked: result = "SEL"; break; case BaseStationMessageType.UserDoubleClicked: result = "CLK"; break; default: throw new NotImplementedException(); } return(result); }
/// <summary> /// Converts from a message type to the expected BaseStation text. /// </summary> /// <param name="messageType"></param> /// <returns></returns> public static string ConvertToString(BaseStationMessageType messageType) { string result = null; switch(messageType) { case BaseStationMessageType.NewAircraft: result = "AIR"; break; case BaseStationMessageType.NewIdentifier: result = "ID"; break; case BaseStationMessageType.StatusChange: result = "STA"; break; case BaseStationMessageType.Transmission: result = "MSG"; break; case BaseStationMessageType.Unknown: result = ""; break; case BaseStationMessageType.UserClicked: result = "SEL"; break; case BaseStationMessageType.UserDoubleClicked: result = "CLK"; break; default: throw new NotImplementedException(); } return result; }
/// <summary> /// Converts from a message type to the expected BaseStation text. /// </summary> /// <param name="messageType"></param> /// <param name="isMlatSourced"></param> /// <param name="useExtendedFormat"></param> /// <returns></returns> public static string ConvertToString(BaseStationMessageType messageType, bool isMlatSourced = false, bool useExtendedFormat = false) { switch (messageType) { case BaseStationMessageType.NewAircraft: return("AIR"); case BaseStationMessageType.NewIdentifier: return("ID"); case BaseStationMessageType.StatusChange: return("STA"); case BaseStationMessageType.Unknown: return(""); case BaseStationMessageType.UserClicked: return("SEL"); case BaseStationMessageType.UserDoubleClicked: return("CLK"); case BaseStationMessageType.Transmission: return(!isMlatSourced || !useExtendedFormat ? "MSG" : "MLAT"); default: throw new NotImplementedException(); } }
/// <summary> /// Converts from BaseStation text to a message type. /// </summary> /// <param name="text"></param> /// <returns></returns> public static BaseStationMessageType ConvertToBaseStationMessageType(string text) { BaseStationMessageType result = BaseStationMessageType.Unknown; if (!String.IsNullOrEmpty(text)) { switch (text) { case "SEL": result = BaseStationMessageType.UserClicked; break; case "ID": result = BaseStationMessageType.NewIdentifier; break; case "AIR": result = BaseStationMessageType.NewAircraft; break; case "STA": result = BaseStationMessageType.StatusChange; break; case "CLK": result = BaseStationMessageType.UserDoubleClicked; break; case "MSG": result = BaseStationMessageType.Transmission; break; } } return(result); }