private void OnInformationReport(NmsInformationReport report) { var handler = InformationReportReceived; if (handler != null) { var e = new NmsInformationReportEventArgs(report); try { handler(this, e); if (!e.Identified) { Logger.Warn("Unhandled NMS Information Report: id={0}", report.Id); } } catch (Exception exception) { Logger.Error(exception, "NMS Information Report error"); Debug.Fail("NMS Information Report error"); } } }
public static TennisStat GetTennisStat(this NmsInformationReport report) { Contract.Requires(report.Id == TennisProtocol.TennisStats); return(new TennisStat((byte[])report.Value)); }
public static PenaltyStat GetPenaltyStat(this NmsInformationReport report) { Contract.Requires(report.Id == PenaltyStat.PenaltyStatId); return(new PenaltyStat((byte[])report.Value)); }
/// <summary> /// Initializes a new instance of the <see cref="NmsInformationReportEventArgs"/> class. /// </summary> /// <param name="report">Информационное сообщение.</param> public NmsInformationReportEventArgs(NmsInformationReport report) { InformationReport = report; }
/// <summary> /// Извлекает информационное сообщение из <see cref="NmsInformationReport"/>. /// </summary> /// <param name="report">Исходное сообщение.</param> /// <returns></returns> public static InfoMessage GetInfoMessage(this NmsInformationReport report) { Contract.Requires(report.Id == (byte)GameReports.ShowMessage); return(new InfoMessage(report.Datagram.Data.Skip(NmsMessage.NmsHeaderLength).ToArray())); }
public static PlayerStat GetPlayerStat(this NmsInformationReport report) { Contract.Requires(report.Id == (byte)GameReports.PlayerStat); return(new PlayerStat((byte[])report.Value)); }
public static bool IsTimerReport(this NmsInformationReport informationReport) { return(informationReport.Id == (byte)GameReports.Timer); }
public static int GetTimerId(this NmsInformationReport informationReport) { Contract.Requires(informationReport.Id == (byte)GameReports.Timer); return(informationReport.Datagram.Data[NmsMessage.NmsHeaderLength + TimerInfo.IdOfs]); }
public static TimerInfo GetTimerInfo(this NmsInformationReport informationReport) { Contract.Requires(informationReport.Id == (byte)GameReports.Timer); return(new TimerInfo((byte[])informationReport.Value)); }
/// <summary> /// Передать информационное сообщение. /// </summary> /// <param name="informationReport">Информационное сообщение.</param> protected void FireInformationReport(NmsInformationReport informationReport) { NmsProtocol.OutgoingMessages.Post(informationReport); }
public static ProviderInfo GetProviderInfo(this NmsInformationReport report) { Contract.Requires(report.Id == (byte)GameReports.ChangeSport); return(new ProviderInfo((byte)report.Value)); }