Пример #1
0
        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");
                }
            }
        }
Пример #2
0
 public static TennisStat GetTennisStat(this NmsInformationReport report)
 {
     Contract.Requires(report.Id == TennisProtocol.TennisStats);
     return(new TennisStat((byte[])report.Value));
 }
Пример #3
0
 public static PenaltyStat GetPenaltyStat(this NmsInformationReport report)
 {
     Contract.Requires(report.Id == PenaltyStat.PenaltyStatId);
     return(new PenaltyStat((byte[])report.Value));
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NmsInformationReportEventArgs"/> class.
 /// </summary>
 /// <param name="report">Информационное сообщение.</param>
 public NmsInformationReportEventArgs(NmsInformationReport report)
 {
     InformationReport = report;
 }
Пример #5
0
 /// <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()));
 }
Пример #6
0
 public static PlayerStat GetPlayerStat(this NmsInformationReport report)
 {
     Contract.Requires(report.Id == (byte)GameReports.PlayerStat);
     return(new PlayerStat((byte[])report.Value));
 }
Пример #7
0
 public static bool IsTimerReport(this NmsInformationReport informationReport)
 {
     return(informationReport.Id == (byte)GameReports.Timer);
 }
Пример #8
0
 public static int GetTimerId(this NmsInformationReport informationReport)
 {
     Contract.Requires(informationReport.Id == (byte)GameReports.Timer);
     return(informationReport.Datagram.Data[NmsMessage.NmsHeaderLength + TimerInfo.IdOfs]);
 }
Пример #9
0
 public static TimerInfo GetTimerInfo(this NmsInformationReport informationReport)
 {
     Contract.Requires(informationReport.Id == (byte)GameReports.Timer);
     return(new TimerInfo((byte[])informationReport.Value));
 }
Пример #10
0
 /// <summary>
 /// Передать информационное сообщение.
 /// </summary>
 /// <param name="informationReport">Информационное сообщение.</param>
 protected void FireInformationReport(NmsInformationReport informationReport)
 {
     NmsProtocol.OutgoingMessages.Post(informationReport);
 }
Пример #11
0
 public static ProviderInfo GetProviderInfo(this NmsInformationReport report)
 {
     Contract.Requires(report.Id == (byte)GameReports.ChangeSport);
     return(new ProviderInfo((byte)report.Value));
 }