public void Encode(List <byte> output) { if (type == AMFDataType.AMF_INVALID) { return; } switch (type) { case AMFDataType.AMF_NUMBER: if (string.IsNullOrEmpty(stringName)) { RTMPHelper.EncodeNumber(output, NumberValue); } else { RTMPHelper.EncodeNumber(output, stringName, NumberValue); } break; case AMFDataType.AMF_BOOLEAN: if (string.IsNullOrEmpty(stringName)) { RTMPHelper.EncodeBoolean(output, BooleanValue); } else { RTMPHelper.EncodeBoolean(output, stringName, BooleanValue); } break; case AMFDataType.AMF_STRING: if (string.IsNullOrEmpty(stringName)) { RTMPHelper.EncodeString(output, StringValue); } else { RTMPHelper.EncodeString(output, stringName, StringValue); } break; case AMFDataType.AMF_NULL: output.Add(0x05); break; case AMFDataType.AMF_OBJECT: if (!string.IsNullOrEmpty(stringName)) { short length = System.Net.IPAddress.HostToNetworkOrder((short)stringName.Length); output.AddRange(BitConverter.GetBytes(length)); output.AddRange(Encoding.ASCII.GetBytes(stringName)); } objVal.Encode(output); break; default: LibRTMPLogger.Log(LibRTMPLogLevel.Trace, string.Format("AMFObjectProperty.Encode invalid type: {0}", type)); break; } //switch }