Draw GDI+ Cache Capability Set ([MS-RDPEGDI] section 2.2.1.3)
        /// <summary>
        /// Create a TS_DRAWGRIDPLUS_CAPABILITYSET type Capability, 2.2.1.3 in MS-RDPEGDI
        /// Problem: field not implemented in SDK
        /// </summary>
        /// <param name="gdiSupport">0x00000000:GDI+ 1.1 is not supported 0x00000001: GDI+ 1.1 is supported</param>
        /// <param name="version ">A 32-bit, unsigned integer. The build number of the underlying GDI+ 1.1 subsystem. 
        /// Only the client-to-server instance of the GDI+ Capability Set MUST contain a valid value for this field.</param>
        /// <param name="crpSupport">A 32-bit, unsigned integer. The level of support for the caching of GDI+ 1.1 
        /// rendering primitives. </param>
        /// <param name="gdipGraphicsCacheEntries">Only the client-to-server instance of the GDI+ Capability Set MUST 
        /// contain a valid value for this field. A 16-bit, unsigned integer. The total number of entries allowed in the 
        /// GDI+ Graphics cache. The maximum allowed value is 10 entries.</param>
        /// <param name="gdipBrushCacheEntries">Only the client-to-server instance of the GDI+ Capability Set MUST 
        /// contain a valid value for this field. A 16-bit, unsigned integer. The total number of entries allowed 
        /// in the GDI+ Brush cache. The maximum allowed value is 5 entries.</param>
        /// <param name="gdipPenCacheEntries">Only the client-to-server instance of the GDI+ Capability Set MUST 
        /// contain a valid value for this field. A 16-bit, unsigned integer. The total number of entries allowed 
        /// in the GDI+ Pen cache. The maximum allowed value is 5 entries.</param>
        /// <param name="gdipImageCacheEntries">Only the client-to-server instance of the GDI+ Capability Set MUST 
        /// contain a valid value for this field. A 16-bit, unsigned integer. The total number of entries allowed in the 
        /// GDI+ Image cache. The maximum allowed value is 10 entries.</param>
        /// <param name="gdipImageAttributesCacheEntries">Only the client-to-server instance of the GDI+ Capability 
        /// Set MUST contain a valid value for this field. A 16-bit, unsigned integer. The total number of entries 
        /// allowed in the GDI+ Image Attributes cache. The maximum allowed value is 2 entries.</param>
        /// <param name="gdipGraphicsCacheChunkSize">Only the client-to-server instance of the GDI+ Capability Set 
        /// MUST contain a valid value for this field.A 16-bit, unsigned integer. The maximum size in bytes of a GDI+ 
        /// Graphics cache entry. The maximum allowed value is 512 bytes.</param>
        /// <param name="gdipObjectBrushCacheChunkSize">Only the client-to-server instance of the GDI+ Capability Set
        /// MUST contain a valid value for this field.A 16-bit, unsigned integer. The maximum size in bytes of a GDI+ 
        /// Brush cache entry. The maximum allowed value is 2,048 bytes.</param>
        /// <param name="gdipObjectPenCacheChunkSize">Only the client-to-server instance of the GDI+ Capability Set 
        /// MUST contain a valid value for this field. A 16-bit, unsigned integer. The maximum size in bytes of a GDI+ 
        /// Pen cache entry. The maximum allowed value is 1,024 bytes.</param>
        /// <param name="gdipObjectImageAttributesCacheChunkSize">Only the client-to-server instance of the GDI+ Capability 
        /// Set MUST contain a valid value for this field. ):  A 16-bit, unsigned integer. The maximum size in bytes of a 
        /// GDI+ Image Attributes cache entry. The maximum allowed value is 64 bytes.</param>
        /// <param name="gdipObjectImageCacheChunkSize">Only the client-to-server instance of the GDI+ Capability Set 
        /// MUST contain a valid value for this field.A 16-bit, unsigned integer. The maximum size in bytes of a chunk 
        /// in the GDI+ Image cache. The maximum allowed value is 4,096 bytes.</param>
        /// <param name="gdipObjectImageCacheTotalSize">Only the client-to-server instance of the GDI+ Capability Set 
        /// MUST contain a valid value for this field.A 16-bit, unsigned integer. The total number of chunks in the GDI+ 
        /// Image cache. The maximum allowed value is 256 chunks.</param>
        /// <param name="gdipObjectImageCacheMaxSize">Only the client-to-server instance of the GDI+ Capability Set MUST 
        /// contain a valid value for this field.A 16-bit, unsigned integer. The total number of chunks that can be used
        /// by an entry in the GDI+ Image cache. The maximum allowed value is 128 chunks.</param>
        /// <returns>TS_DRAWGRIDPLUS_CAPABILITYSET type Capability</returns>
        public static TS_DRAWGRIDPLUS_CAPABILITYSET CreateDrawGdiPlusCapSet(UInt32 gdiSupport, UInt32 version, UInt32 crpSupport,
            ushort gdipGraphicsCacheEntries, ushort gdipBrushCacheEntries, ushort gdipPenCacheEntries, ushort gdipImageCacheEntries, ushort gdipImageAttributesCacheEntries,
            ushort gdipGraphicsCacheChunkSize, ushort gdipObjectBrushCacheChunkSize, ushort gdipObjectPenCacheChunkSize, ushort gdipObjectImageAttributesCacheChunkSize,
            ushort gdipObjectImageCacheChunkSize, ushort gdipObjectImageCacheTotalSize, ushort gdipObjectImageCacheMaxSize)
        {
            TS_DRAWGRIDPLUS_CAPABILITYSET gridplusSet = new TS_DRAWGRIDPLUS_CAPABILITYSET();

            capabilitySetType_Values capabilitySetType = capabilitySetType_Values.CAPSTYPE_DRAWGDIPLUS;
            ushort lengthCapability = 40;

            List<byte> encodeBuffer = new List<byte>();
            EncodeStructure(encodeBuffer, (ushort)capabilitySetType);
            EncodeStructure(encodeBuffer, lengthCapability);
            EncodeStructure(encodeBuffer, gdiSupport);
            EncodeStructure(encodeBuffer, version);
            EncodeStructure(encodeBuffer, crpSupport);
            //GdipCacheEntries, Only set by Client
            EncodeStructure(encodeBuffer, gdipGraphicsCacheEntries);
            EncodeStructure(encodeBuffer, gdipBrushCacheEntries);
            EncodeStructure(encodeBuffer, gdipPenCacheEntries);
            EncodeStructure(encodeBuffer, gdipImageCacheEntries);
            EncodeStructure(encodeBuffer, gdipImageAttributesCacheEntries);
            //GdipCacheChunkSize, Only set by Client
            EncodeStructure(encodeBuffer, gdipGraphicsCacheChunkSize);
            EncodeStructure(encodeBuffer, gdipObjectBrushCacheChunkSize);
            EncodeStructure(encodeBuffer, gdipObjectPenCacheChunkSize);
            EncodeStructure(encodeBuffer, gdipObjectImageAttributesCacheChunkSize);
            //GdipImageCacheProperties, Only set by Client
            EncodeStructure(encodeBuffer, gdipObjectImageCacheChunkSize);
            EncodeStructure(encodeBuffer, gdipObjectImageCacheTotalSize);
            EncodeStructure(encodeBuffer, gdipObjectImageCacheMaxSize);

            gridplusSet.rawData = encodeBuffer.ToArray();
            return gridplusSet;
        }
        /// <summary>
        /// Parse TS_RAIL_CAPABILITYSET
        /// </summary>
        /// <param name="data">data to be parsed</param>
        /// <returns>TS_RAIL_CAPABILITYSET</returns>
        private TS_DRAWGRIDPLUS_CAPABILITYSET ParseCapsTypeDrawGdiPlus(byte[] data)
        {
            TS_DRAWGRIDPLUS_CAPABILITYSET set = new TS_DRAWGRIDPLUS_CAPABILITYSET();

            // TS_DRAWGRIDPLUS_CAPABILITYSET: rawData
            set.rawData = data;

            return set;
        }