private DumpSyncReport ( int frame, IEnumerable |
||
frame | int | |
orders | IEnumerable |
|
return | void |
void CheckSync(byte[] packet) { var frame = BitConverter.ToInt32(packet, 0); byte[] existingSync; if (syncForFrame.TryGetValue(frame, out existingSync)) { if (packet.Length != existingSync.Length) { syncReport.DumpSyncReport(frame); OutOfSync(frame); } else { for (int i = 0; i < packet.Length; i++) { if (packet[i] != existingSync[i]) { syncReport.DumpSyncReport(frame); if (i < SyncHeaderSize) { OutOfSync(frame, "Tick"); } else { OutOfSync(frame, (i - SyncHeaderSize) / 4); } } } } } else { syncForFrame.Add(frame, packet); } }
void OutOfSync(int frame) { syncReport.DumpSyncReport(frame, frameData.OrdersForFrame(World, frame)); throw new InvalidOperationException("Out of sync in frame {0}.\n Compare syncreport.log with other players.".F(frame)); }
void OutOfSync(int frame) { syncReport.DumpSyncReport(frame); throw new InvalidOperationException($"Out of sync in frame {frame}.\n Compare syncreport.log with other players."); }