public IAgencyDataParser GetAgencyOrDefaultDataParser(string agencyTag) { IAgencyDataParser dataParser = DataParsers .SingleOrDefault(p => p.AgencyTag.Equals(agencyTag, StringComparison.OrdinalIgnoreCase)); if (dataParser == null) { DefaultDataParser.AgencyTag = agencyTag; dataParser = DefaultDataParser; } return(dataParser); }
public override object Read(uint type, NativeBufferStream buffer, int offset, int cnt) { Google.Protobuf.MessageParser parser; DataParsers.TryGetValue(type, out parser); if (parser != null) { try { buffer.Seek(offset, SeekOrigin.Begin); buffer.SetLength(offset + cnt); var rv = parser.ParseFrom(buffer); return(rv); } catch (Exception e) { PlatDependant.LogError(e); } } return(null); }