public virtual void Decode(N2HBinaryReader reader) { var type = FarId == 0 ? AESEngine.AESType.SYMMETRIC : AESEngine.AESType.DEFAULT; RtmfpUtils.Decode(AesDecrypt.Next(type), reader); PrevAesType = type; }
public void Flush(byte marker, bool echoTime, AESEngine.AESType aesType) { _lastFlowWriter = null; if (IsEnqueueForDelete) { return; } var outputBuffer = Writer.BaseStream; if (outputBuffer.Length >= Defines.RTMFP_MIN_PACKET_SIZE) { //Debug.WriteLine(outputBuffer.Length); if (RecTimestamp.Elapsed > TimeSpan.FromSeconds(30)) { echoTime = false; } var offset = 0; if (echoTime) { marker += 4; } else { offset = 2; } var timeStamp = RtmfpUtils.TimeNow(); //_outputBuffer.Ignore(offset); outputBuffer.Position = 6 + offset; outputBuffer.WriteByte(marker); Writer.Write(timeStamp); if (echoTime) { Writer.Write((ushort)(TimeSent + RtmfpUtils.Time(RecTimestamp.Elapsed))); } RtmfpUtils.EncodeAndPack(AesEncrypt.Next(aesType), Writer, FarId, offset); EnqueueForOutbound(outputBuffer as MemoryStream, offset); Writer.Clear(11); } }