The TS_MONITOR_ATTRIBUTES packet describes extended attributes of a client-side display monitor.
        /// <summary>
        /// Parse TS_UD_CS_MONITOR_EX
        /// (parser index is updated according to parsed length)
        /// </summary>
        /// <param name="data">data to be parsed</param>
        /// <param name="currentIndex">current parser index</param>
        /// <returns>TS_UD_CS_MONITOR_EX</returns>
        private TS_UD_CS_MONITOR_EX ParseTsUdCsMonitorEX(byte[] data, ref int currentIndex)
        {
            TS_UD_CS_MONITOR_EX monitorEx = new TS_UD_CS_MONITOR_EX();
            monitorEx.header.type = (TS_UD_HEADER_type_Values)ParseUInt16(data, ref currentIndex, false);
            monitorEx.header.length = ParseUInt16(data, ref currentIndex, false);
            monitorEx.flags = ParseUInt32(data, ref currentIndex, false);
            monitorEx.monitorAttributeSize = ParseUInt32(data, ref currentIndex, false);
            monitorEx.monitorCount = ParseUInt32(data, ref currentIndex, false);

            List<TS_MONITOR_ATTRIBUTES> attributeList = new List<TS_MONITOR_ATTRIBUTES>();
            while (attributeList.Count < monitorEx.monitorCount)
            {
                TS_MONITOR_ATTRIBUTES attribute = new TS_MONITOR_ATTRIBUTES();
                attribute.physicalWidth = ParseUInt32(data, ref currentIndex, false);
                attribute.physicalHeight = ParseUInt32(data, ref currentIndex, false);
                attribute.orientation = (TS_MONITOR_ATTRIBUTES_orientation_values)ParseUInt32(data, ref currentIndex, false);
                attribute.desktopScaleFactor = ParseUInt32(data, ref currentIndex, false);
                attribute.deviceScaleFactor = ParseUInt32(data, ref currentIndex, false);

                attributeList.Add(attribute);
            }
            monitorEx.monitorAttributesArray = attributeList.ToArray();

            return monitorEx;
        }
Esempio n. 2
0
        public TS_MONITOR_ATTRIBUTES Clone()
        {
            TS_MONITOR_ATTRIBUTES attribute = new TS_MONITOR_ATTRIBUTES();

            attribute.physicalWidth = physicalWidth;
            attribute.physicalHeight = physicalHeight;
            attribute.orientation = orientation;
            attribute.desktopScaleFactor = desktopScaleFactor;
            attribute.deviceScaleFactor = deviceScaleFactor;

            return attribute;
        }