/// <summary> /// Deserializes the sync file (Representing a Client Opinion) with the given filename inside the given zip file /// and dumps its data in a human-readable format to the provided string builder /// </summary> /// <param name="builder">The builder to append the data to</param> /// <param name="zip">The zip file that contains the file with the provided name</param> /// <param name="filename">The name of the sync file to dump</param> /// <returns>The deserialized client opinion that was dumped</returns> private static ClientSyncOpinion DeserializeAndPrintSyncInfo(StringBuilder builder, ZipFile zip, string filename) { builder.AppendLine($"[{filename}]"); var sync = ClientSyncOpinion.Deserialize(new ByteReader(zip[filename].GetBytes())); builder.AppendLine($"Start: {sync.startTick}"); builder.AppendLine($"Was simulating: {sync.simulating}"); builder.AppendLine($"Map count: {sync.mapStates.Count}"); builder.AppendLine($"Last map state: {sync.mapStates.Select(m => $"{m.mapId}/{m.randomStates.LastOrDefault()}/{m.randomStates.Count}").ToStringSafeEnumerable()}"); builder.AppendLine($"Last world state: {sync.worldRandomStates.LastOrDefault()}/{sync.worldRandomStates.Count}"); builder.AppendLine($"Last cmd state: {sync.commandRandomStates.LastOrDefault()}/{sync.commandRandomStates.Count}"); builder.AppendLine($"Trace hashes: {sync.desyncStackTraceHashes.Count}"); return(sync); }
public void HandleDesyncCheck(ByteReader data) { Multiplayer.game?.sync.AddClientOpinionAndCheckDesync(ClientSyncOpinion.Deserialize(data)); }