public void Dispose() { //if (_end) //{ _writer.WriteObject(_buffer, true); // } }
public override void SendStream(Stream stream, int length) { var marker = stream.ReadByte() | 0xF0; var echoTime = marker == (Target == null ? 0xFE : 0xFD); stream.ReadUShort(); if (echoTime) { stream.ReadUShort(); } var type = stream.ReadByte(); if (type == 0x10) { var sizePos = stream.Position; var size = stream.ReadUShort(); var flags = stream.ReadByte(); var idFlow = stream.Read7BitLongValue(); var stage = stream.Read7BitLongValue(); if (idFlow == 2 && stage == 1) { var deltaNAck = stream.Read7BitLongValue(); var len = (ushort)stream.ReadByte(); stream.Position += len; stream.ReadByte(); stream.ReadByte(); //type stream.ReadUInt(); //timestamp var amfReader = new AMF0Reader(stream); var str = amfReader.ReadShortString(true); var num = amfReader.ReadAMFDouble(true); var pos = stream.Position; var connectionInfo = amfReader.ReadVariant(); connectionInfo["tcUrl"] = MiddleSession.QueryUrl; connectionInfo["app"] = MiddleSession.QueryUrl.Split('/').Last(); stream.Position = pos; var amfWriter = new AMF0Writer(stream); amfWriter.WriteObject(connectionInfo, true); length = (int)stream.Position; len = (ushort)(stream.Position - sizePos - 2); stream.Position = sizePos; stream.Write(len); } } stream.Position = 6; base.SendStream(stream, length); }
public override void SendStream(Stream stream,int length) { var marker = stream.ReadByte() | 0xF0; var echoTime = marker == (Target == null ? 0xFE : 0xFD); stream.ReadUShort(); if (echoTime) stream.ReadUShort(); var type = stream.ReadByte(); if (type == 0x10) { var sizePos = stream.Position; var size = stream.ReadUShort(); var flags = stream.ReadByte(); var idFlow = stream.Read7BitLongValue(); var stage = stream.Read7BitLongValue(); if (idFlow == 2 && stage == 1) { var deltaNAck = stream.Read7BitLongValue(); var len = (ushort) stream.ReadByte(); stream.Position += len; stream.ReadByte(); stream.ReadByte();//type stream.ReadUInt();//timestamp var amfReader = new AMF0Reader(stream); var str = amfReader.ReadShortString(true); var num = amfReader.ReadAMFDouble(true); var pos = stream.Position; var connectionInfo = amfReader.ReadVariant(); connectionInfo["tcUrl"] = MiddleSession.QueryUrl; connectionInfo["app"] = MiddleSession.QueryUrl.Split('/').Last(); stream.Position = pos; var amfWriter = new AMF0Writer(stream); amfWriter.WriteObject(connectionInfo, true); length = (int) stream.Position; len = (ushort) (stream.Position - sizePos-2); stream.Position = sizePos; stream.Write(len); } } stream.Position = 6; base.SendStream(stream,length); }