public TS_RFX_CLNT_CAPS_CONTAINER Decode_TS_RFX_CLNT_CAPS_CONTAINER(byte[] data)
        {
            int curIdx = 0;
            TS_RFX_CLNT_CAPS_CONTAINER clientRFXCaps = new TS_RFX_CLNT_CAPS_CONTAINER();

            clientRFXCaps.length       = ParseUInt32(data, ref curIdx, false);
            clientRFXCaps.captureFlags = ParseUInt32(data, ref curIdx, false);
            clientRFXCaps.capsLength   = ParseUInt32(data, ref curIdx, false);

            byte[]      capsData = GetBytes(data, ref curIdx, (int)clientRFXCaps.capsLength);
            TS_RFX_CAPS caps     = new TS_RFX_CAPS();

            curIdx          = 0;
            caps.blockType  = (blockType_Value)ParseUInt16(capsData, ref curIdx, false);
            caps.blockLen   = ParseUInt32(capsData, ref curIdx, false);
            caps.numCapsets = ParseUInt16(capsData, ref curIdx, false);

            List <TS_RFX_CAPSET> capSetList = new List <TS_RFX_CAPSET>();

            for (int i = 0; i < caps.numCapsets; i++)
            {
                TS_RFX_CAPSET capSet = new TS_RFX_CAPSET();
                capSet.blockType  = (blockType_Value)(blockType_Value)ParseUInt16(capsData, ref curIdx, false);
                capSet.blockLen   = ParseUInt32(capsData, ref curIdx, false);
                capSet.codecId    = ParseByte(capsData, ref curIdx);
                capSet.capsetType = ParseUInt16(capsData, ref curIdx, false);
                capSet.numIcaps   = ParseUInt16(capsData, ref curIdx, false);
                capSet.icapLen    = ParseUInt16(capsData, ref curIdx, false);

                List <TS_RFX_ICAP> icapList = new List <TS_RFX_ICAP>();
                for (int j = 0; j < capSet.numIcaps; j++)
                {
                    TS_RFX_ICAP icap = new TS_RFX_ICAP();
                    icap.version       = (version_Value)ParseUInt16(capsData, ref curIdx, false);
                    icap.tileSize      = (short)ParseUInt16(capsData, ref curIdx, false);
                    icap.flags         = ParseByte(capsData, ref curIdx);
                    icap.colConvBits   = ParseByte(capsData, ref curIdx);
                    icap.transformBits = ParseByte(capsData, ref curIdx);
                    icap.entropyBits   = (entropyBits_Value)ParseByte(capsData, ref curIdx);
                    icapList.Add(icap);
                }
                capSet.icapsData = icapList.ToArray();
                capSetList.Add(capSet);
            }
            caps.capsetsData       = capSetList.ToArray();
            clientRFXCaps.capsData = caps;
            return(clientRFXCaps);
        }
        public TS_RFX_CLNT_CAPS_CONTAINER Decode_TS_RFX_CLNT_CAPS_CONTAINER(byte[] data)
        {
            int curIdx = 0;
            TS_RFX_CLNT_CAPS_CONTAINER clientRFXCaps = new TS_RFX_CLNT_CAPS_CONTAINER();
            clientRFXCaps.length = ParseUInt32(data, ref curIdx, false);
            clientRFXCaps.captureFlags = ParseUInt32(data, ref curIdx, false);
            clientRFXCaps.capsLength = ParseUInt32(data, ref curIdx, false);

            byte[] capsData = GetBytes(data,ref curIdx,(int)clientRFXCaps.capsLength);
            TS_RFX_CAPS caps = new TS_RFX_CAPS();
            curIdx = 0;
            caps.blockType = (blockType_Value)ParseUInt16(capsData, ref curIdx, false);
            caps.blockLen = ParseUInt32(capsData, ref curIdx, false);
            caps.numCapsets = ParseUInt16(capsData, ref curIdx, false);

            List<TS_RFX_CAPSET> capSetList = new List<TS_RFX_CAPSET>();
            for (int i = 0; i < caps.numCapsets; i++)
            {
                TS_RFX_CAPSET capSet = new TS_RFX_CAPSET();
                capSet.blockType = (blockType_Value)(blockType_Value)ParseUInt16(capsData, ref curIdx, false);
                capSet.blockLen = ParseUInt32(capsData, ref curIdx, false);
                capSet.codecId = ParseByte(capsData, ref curIdx);
                capSet.capsetType = ParseUInt16(capsData, ref curIdx, false);
                capSet.numIcaps = ParseUInt16(capsData, ref curIdx, false);
                capSet.icapLen = ParseUInt16(capsData, ref curIdx, false);

                List<TS_RFX_ICAP> icapList = new List<TS_RFX_ICAP>();
                for (int j = 0; j < capSet.numIcaps; j++)
                {
                    TS_RFX_ICAP icap = new TS_RFX_ICAP();
                    icap.version = (version_Value)ParseUInt16(capsData, ref curIdx, false);
                    icap.tileSize = (short)ParseUInt16(capsData, ref curIdx, false);
                    icap.flags = ParseByte(capsData, ref curIdx);
                    icap.colConvBits = ParseByte(capsData, ref curIdx);
                    icap.transformBits = ParseByte(capsData, ref curIdx);
                    icap.entropyBits = (entropyBits_Value)ParseByte(capsData, ref curIdx);
                    icapList.Add(icap);
                }
                capSet.icapsData = icapList.ToArray();
                capSetList.Add(capSet);
            }
            caps.capsetsData = capSetList.ToArray();
            clientRFXCaps.capsData = caps;
            return clientRFXCaps;
        }