public static BinaryBioStateEventMap Load(Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } using (var reader = new BioStateEventMapReader(stream)) { var map = new BinaryBioStateEventMap(); var eventsCount = reader.ReadInt32(); map.StateEvents = new Dictionary<int, BioStateEvent>(); for (var i = 0; i < eventsCount; i++) { var id = reader.ReadInt32(); var stateEvent = reader.ReadStateEvent(); if (!map.StateEvents.ContainsKey(id)) { map.StateEvents.Add(id, stateEvent); } else { map.StateEvents[id] = stateEvent; } } return map; } }
public static BinaryBioStateEventMap Load(Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } using (var reader = new BioStateEventMapReader(stream)) { var map = new BinaryBioStateEventMap(); var eventsCount = reader.ReadInt32(); map.StateEvents = new Dictionary <int, BioStateEvent>(); for (var i = 0; i < eventsCount; i++) { var id = reader.ReadInt32(); var stateEvent = reader.ReadStateEvent(); if (!map.StateEvents.ContainsKey(id)) { map.StateEvents.Add(id, stateEvent); } else { map.StateEvents[id] = stateEvent; } } return(map); } }