/// <summary>
 /// Decode this PDU from the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override bool Decode(PduMarshaler marshaler)
 {
     try
     {
         this.Header.cbSize      = marshaler.ReadUInt32();
         this.Header.PacketType  = (PacketTypeValues)marshaler.ReadUInt32();
         this.PresentatioinId    = marshaler.ReadByte();
         this.Version            = (RdpevorVersionValues)marshaler.ReadByte();
         this.Command            = (CommandValues)marshaler.ReadByte();
         this.FrameRate          = marshaler.ReadByte();
         this.AverageBitrateKbps = marshaler.ReadUInt16();
         this.Reserved           = marshaler.ReadUInt16();
         this.SourceWidth        = marshaler.ReadUInt32();
         this.SourceHeight       = marshaler.ReadUInt32();
         this.ScaledWidth        = marshaler.ReadUInt32();
         this.ScaledHeight       = marshaler.ReadUInt32();
         this.hnsTimestampOffset = marshaler.ReadUInt64();
         this.GeometryMappingId  = marshaler.ReadUInt64();
         this.VideoSubtypeId     = marshaler.ReadBytes(16);
         this.cbExtra            = marshaler.ReadUInt32();
         this.pExtraData         = marshaler.ReadBytes((int)this.cbExtra);
         this.Reserved2          = marshaler.ReadByte();
         return(true);
     }
     catch
     {
         marshaler.Reset();
         throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
     }
 }
Ejemplo n.º 2
0
 /**
  * Adds a command to the batch. Batch sub-commands will be processed
  * in the same order they are added and their responses can be
  * accessed from the Response object passed to a response handler
  * of the batch command itself.
  */
 public void AddCommand(IRSCommand command)
 {
     CommandValues.Add(new Hashtable()
     {
         { "name", command.Name() },
         { "params", command.Parameters() }
     });
     Commands.Add(command);
 }
Ejemplo n.º 3
0
 public void Execute(CommandValues commandValues)
 {
     if (RegistryDictionary.ContainsKey(commandValues.CommandName))
     {
         RegistryDictionary[commandValues.CommandName].Execute(commandValues.CommandArgs);
     }
     else
     {
         throw new InvalidCommandException(commandValues.CommandName);
     }
 }
 private void OnAutomationCommandEvent(EventParameters <AutomationCommand> obj)
 {
     if (obj.Topic == EventTopicNames.SelectAutomationCommandValue)
     {
         CommandValues.Clear();
         SetSelectedAutomationCommand(obj.Value);
         CommandValues.AddRange(obj.Value.Values.Split('|'));
         if (CommandValues.Count == 1)
         {
             OnAutomationCommandValueSelected(CommandValues.ElementAt(0));
             return;
         }
         RaisePropertyChanged(() => ColumnCount);
     }
 }
        /// <summary>
        /// Method to send a TSMM_PRESENTATION_REQUEST to client.
        /// </summary>
        /// <param name="presentationId">A number that uniquely identifies the video stream on the server.</param>
        /// <param name="command">A number that identifies which operation the client is to perform. </param>
        /// <param name="srcWidth">This is the width of the video stream after scaling back to the original resolution.</param>
        /// <param name="srcHeight">This is the height of the video stream after scaling back to the original resolution.</param>
        /// <param name="scaledWidth">This is the width of the video stream.</param>
        /// <param name="scaledHeight">This is the height of the video stream.</param>
        /// <param name="geometryId">This field is used to correlate this video data with its geometry.</param>
        /// <param name="videoType">This field identifies the Media Foundation video subtype of the video stream.</param>
        public void SendPresentationRequest(byte presentationId, CommandValues command, uint srcWidth, uint srcHeight, uint scaledWidth, uint scaledHeight, ulong geometryId, VideoSubtype videoType, byte[] extraData)
        {
            TSMM_PRESENTATION_REQUEST request = rdpevorServer.CreatePresentationRequest(presentationId, command, srcWidth, srcHeight, scaledWidth, scaledHeight, geometryId, videoType, extraData);

            if (this.testType == RdpevorNegativeType.PresentationRequest_InvalidPacketLength)
            {
                //Set the packet length to an invalid value.
                request.Header.cbSize = (uint)(request.Header.cbSize - 1);
            }
            else if (this.testType == RdpevorNegativeType.PresentationRequest_InvalidVersion)
            {
                //Set version to an invalid value.
                request.Version = RdpevorVersionValues.InvalidValue;
            }

            rdpevorServer.SendRdpevorControlPdu(request);
        }
 /// <summary>
 /// Decode this PDU from the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override bool Decode(PduMarshaler marshaler)
 {
     try
     {
         this.Header.cbSize = marshaler.ReadUInt32();
         this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32();
         this.PresentatioinId = marshaler.ReadByte();
         this.Version = (RdpevorVersionValues)marshaler.ReadByte();
         this.Command = (CommandValues)marshaler.ReadByte();
         this.FrameRate = marshaler.ReadByte();
         this.AverageBitrateKbps = marshaler.ReadUInt16();
         this.Reserved = marshaler.ReadUInt16();
         this.SourceWidth = marshaler.ReadUInt32();
         this.SourceHeight = marshaler.ReadUInt32();
         this.ScaledWidth = marshaler.ReadUInt32();
         this.ScaledHeight = marshaler.ReadUInt32();
         this.hnsTimestampOffset = marshaler.ReadUInt64();
         this.GeometryMappingId = marshaler.ReadUInt64();
         this.VideoSubtypeId = marshaler.ReadBytes(16);
         this.cbExtra = marshaler.ReadUInt32();
         this.pExtraData = marshaler.ReadBytes((int)this.cbExtra);
         this.Reserved2 = marshaler.ReadByte();
         return true;
     }
     catch
     {
         marshaler.Reset();
         throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
     }
 }
        /// <summary>
        /// Method to send a TSMM_PRESENTATION_REQUEST to client.
        /// </summary>
        /// <param name="presentationId">A number that uniquely identifies the video stream on the server.</param>
        /// <param name="command">A number that identifies which operation the client is to perform. </param>
        /// <param name="srcWidth">This is the width of the video stream after scaling back to the original resolution.</param>
        /// <param name="srcHeight">This is the height of the video stream after scaling back to the original resolution.</param>
        /// <param name="scaledWidth">This is the width of the video stream.</param>
        /// <param name="scaledHeight">This is the height of the video stream.</param>
        /// <param name="geometryId">This field is used to correlate this video data with its geometry.</param>
        /// <param name="videoType">This field identifies the Media Foundation video subtype of the video stream.</param>
        public void SendPresentationRequest(byte presentationId, CommandValues command, uint srcWidth, uint srcHeight, uint scaledWidth, uint scaledHeight, ulong geometryId, VideoSubtype videoType, byte[] extraData)
        {
            TSMM_PRESENTATION_REQUEST request = rdpevorServer.CreatePresentationRequest(presentationId, command, srcWidth, srcHeight, scaledWidth, scaledHeight, geometryId, videoType, extraData);
            if (this.testType == RdpevorNegativeType.PresentationRequest_InvalidPacketLength)
            {
                //Set the packet length to an invalid value.
                request.Header.cbSize = (uint)(request.Header.cbSize - 1);
            }
            else if (this.testType == RdpevorNegativeType.PresentationRequest_InvalidVersion)
            {
                //Set version to an invalid value.
                request.Version = RdpevorVersionValues.InvalidValue;
            }

            rdpevorServer.SendRdpevorControlPdu(request);
        }
        /// <summary>
        /// Method to create a TSMM_PRESENTATION_REQUEST packet.
        /// </summary>
        /// <param name="presentationId">A number that uniquely identifies the video stream on the server.</param>
        /// <param name="command">A number that identifies which operation the client is to perform. </param>
        /// <param name="srcWidth">This is the width of the video stream after scaling back to the original resolution.</param>
        /// <param name="srcHeight">This is the height of the video stream after scaling back to the original resolution.</param>
        /// <param name="scaledWidth">This is the width of the video stream.</param>
        /// <param name="scaledHeight">This is the height of the video stream.</param>
        /// <param name="geometryId">This field is used to correlate this video data with its geometry.</param>
        /// <param name="videoSubTypeId">This field identifies the Media Foundation video subtype of the video stream.</param>
        public TSMM_PRESENTATION_REQUEST CreatePresentationRequest(
            byte presentationId,
            CommandValues command,
            uint srcWidth,
            uint srcHeight,
            uint scaledWidth,
            uint scaledHeight,
            UInt64 geometryId,
            VideoSubtype videoSubType,
            byte[] extraData)
        {
            TSMM_PRESENTATION_REQUEST request = new TSMM_PRESENTATION_REQUEST();

            request.Header.PacketType = PacketTypeValues.TSMM_PACKET_TYPE_PRESENTATION_REQUEST;
            request.PresentatioinId   = presentationId;
            request.Version           = RdpevorVersionValues.RDP8;
            request.Command           = command;

            //The InvalidCommand packet is just for negative test, all other fiels are set same as Start packet.
            if (command == CommandValues.Start || command == CommandValues.InvalidCommand)
            {
                request.FrameRate          = FrameRate;
                request.AverageBitrateKbps = AverageBitrateKbps;
                request.Reserved           = 0;
                request.SourceWidth        = srcWidth;
                request.SourceHeight       = srcHeight;
                request.ScaledWidth        = srcWidth;
                request.ScaledHeight       = srcHeight;
                request.hnsTimestampOffset = (ulong)DateTime.Now.ToFileTimeUtc();
                request.GeometryMappingId  = geometryId;
                request.VideoSubtypeId     = RdpevorTestData.GetH264VideoSubtypeId();
                if (videoSubType == VideoSubtype.MFVideoFormat_H264)
                {
                    request.VideoSubtypeId = RdpevorTestData.GetH264VideoSubtypeId();
                }
                request.pExtraData    = extraData;
                request.cbExtra       = (uint)extraData.Length;
                request.Reserved2     = 0;
                request.Header.cbSize = (uint)(sizeOfPresentationFixedFields + request.pExtraData.Length);
            }
            else if (command == CommandValues.Stop)
            {
                request.Header.cbSize = 0x45;

                //If the command is to stop the presentation, only the Header, PresentationId, Version, and Command fields are valid.
                //So set all other fields to 0.
                request.FrameRate          = 0;
                request.AverageBitrateKbps = 0;
                request.Reserved           = 0;
                request.SourceWidth        = 0;
                request.SourceHeight       = 0;
                request.ScaledWidth        = 0;
                request.ScaledHeight       = 0;
                request.hnsTimestampOffset = 0;
                request.GeometryMappingId  = 0;
                request.VideoSubtypeId     = new byte[16];
                request.cbExtra            = 0;
                request.pExtraData         = null;//TDI
                request.Reserved2          = 0;
            }
            return(request);
        }