using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace RDPAddins.Common { /// /// Represents RDS Channel /// public interface IChannel { /// /// Occurs when VirtualChannelInitEventProc(VirtualChannelInitEvent in RDS API) was called with ChannelEvents.Initialized(CHANNEL_EVENT_INITIALIZED in RDS API) /// event EventHandler Initialized; /// /// Occurs when VirtualChannelInitEventProc(VirtualChannelInitEvent in RDS API) was called with ChannelEvents.Connected(CHANNEL_EVENT_CONNECTED in RDS API) /// event EventHandler Connected; /// /// Occurs when VirtualChannelInitEventProc(VirtualChannelInitEvent in RDS API) was called with ChannelEvents.Disconnected(CHANNEL_EVENT_DISCONNECTED in RDS API) /// event EventHandler Disconnected; /// /// Occurs when VirtualChannelInitEventProc(VirtualChannelInitEvent in RDS API) was called with ChannelEvents.Terminated(CHANNEL_EVENT_TERMINATED in RDS API) /// event EventHandler Terminated; /// /// Occurs when VirtualChannelOpenEvent(VirtualChannelOpenEvent in RDS API) was called with ChannelEvents.DataRecived(CHANNEL_EVENT_DATA_RECEIVED in RDS API) /// event DataArrivedHandler DataArrived; /// /// Works similar to System.IO.Stream.Read /// /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the channel. /// The zero-based byte offset in buffer at which to begin storing the data read from the channel. /// The maximum number of bytes to be read from the channel. /// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available(including 0). int Read(byte[] buffer, int offset, int count); /// /// Works similar to System.IO.Stream.Write /// /// An array of bytes. This method sends bytes from buffer through channel. /// The zero-based byte offset in buffer at which to begin sending bytes through channel. /// The number of bytes to be sent through channel. void Write(byte[] data, int offset, int count); /// /// Creataes and returns stream. Stream is disposed when Disconnect event occurs. /// /// Retuns stream Stream GetStream(); /// /// Gets Addin metadata /// IAddinMetadata Metadata { get; } /// /// Get IUI interface /// IUI UI { get; } } /// /// Represents the method that will handle the DataArrived event of a IChannel. /// /// Specifies the size, in bytes, of the data. Use Read method of IChannel to read the data. /// Specifies the total size, in bytes, of the data written by a single write operation to the server end of the virtual channel. /// Provides information about the chunk of data being received. public delegate void DataArrivedHandler(uint dataLength, uint totalLength, DataParts dataFlags); /// /// Specifies constants that define which part of data chunk was sent. /// public enum DataParts { /// /// The chunk is the beginning of the data written by a single write operation. /// First = 0x01, /// /// The chunk is the end of the data written by a single write operation. /// Last = 0x02, /// /// The chunk is in the middle of a block of data written by a single write operation. /// Middle = 0, /// /// Combines the DataParts.First and DataParts.Last values. The chunk contains all the data from a single write operation. /// Only = First | Last, } }