public void VerifyStructure(TS_UD_CS_MONITOR monitor) { uint nTotalWidth = 0; uint nTotalHeight = 0; for (int i = 0; i < monitor.monitorCount; i++) { nTotalWidth += (monitor.monitorDefArray[i].right - monitor.monitorDefArray[i].left + 1); nTotalHeight += (monitor.monitorDefArray[i].bottom - monitor.monitorDefArray[i].top + 1); Site.CaptureRequirementIfIsTrue((monitor.monitorDefArray[i].right - monitor.monitorDefArray[i].left + 1) >= 200 && (monitor.monitorDefArray[i].bottom-monitor.monitorDefArray[i].top+1)>=200, 268, "The minimum permitted size of the virtual desktop is 200 x 200 pixels."); } Site.CaptureRequirementIfIsTrue(nTotalWidth<=32766, 266, "The maximum width of the virtual desktop resulting from the union of the monitors contained in the monitorDefArray" + @" field MUST NOT exceed 32766 pixels."); Site.CaptureRequirementIfIsTrue(nTotalHeight <= 32766, 267, "Similarly, the maximum height of the virtual desktop resulting from the union of the monitors contained in the " + @"monitorDefArray field MUST NOT exceed 32766 pixels."); Site.CaptureRequirementIfIsTrue(monitor.header.type == TS_UD_HEADER_type_Values.CS_MONITOR, 271, "[In Client Monitor Data (TS_UD_CS_MONITOR)]header (4 bytes):The User Data Header type field MUST be set to " + @"CS_MONITOR (0xC005)."); Site.CaptureRequirementIfIsTrue(monitor.monitorCount<=15, 275, "[In Client Monitor Data (TS_UD_CS_MONITOR)]monitorCount (4 bytes): The number of display monitor definitions " + @"in the monitorDefArray field (the maximum allowed is 16)."); Site.CaptureRequirementIfIsTrue(monitor.monitorCount == monitor.monitorDefArray.Count, 277, "[In Client Monitor Data (TS_UD_CS_MONITOR)]monitorDefArray (variable): The number of TS_MONITOR_DEF structures" + @" is given by the monitorCount field."); }
/// <summary> /// Parse TS_UD_CS_MONITOR /// (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</returns> private TS_UD_CS_MONITOR ParseTsUdCsMon(byte[] data, ref int currentIndex) { TS_UD_CS_MONITOR monData = new TS_UD_CS_MONITOR(); monData.header.type = (TS_UD_HEADER_type_Values)ParseUInt16(data, ref currentIndex, false); monData.header.length = ParseUInt16(data, ref currentIndex, false); monData.Flags = ParseUInt32(data, ref currentIndex, false); monData.monitorCount = ParseUInt32(data, ref currentIndex, false); monData.monitorDefArray = new Collection<TS_MONITOR_DEF>(); for (int i = 0; i < monData.monitorCount; ++i) { TS_MONITOR_DEF monDef; monDef.left = ParseUInt32(data, ref currentIndex, false); monDef.top = ParseUInt32(data, ref currentIndex, false); monDef.right = ParseUInt32(data, ref currentIndex, false); monDef.bottom = ParseUInt32(data, ref currentIndex, false); monDef.flags = (Flags_TS_MONITOR_DEF)(ParseUInt32(data, ref currentIndex, false)); monData.monitorDefArray.Add(monDef); } return monData; }