예제 #1
0
 public SISession(string sid, System.IO.Stream stream, long size, bool receiving, Jid from, Jid to, IDataStream extension)
 {
     sid.ThrowIfNull <string>("sid");
     stream.ThrowIfNull <System.IO.Stream>("stream");
     size.ThrowIfOutOfRange(0L, 0x7fffffffffffffffL);
     from.ThrowIfNull <Jid>("from");
     to.ThrowIfNull <Jid>("to");
     extension.ThrowIfNull <IDataStream>("extension");
     if (!(!receiving || stream.CanWrite))
     {
         throw new ArgumentException("The specified stream cannot be written.");
     }
     if (!(receiving || stream.CanRead))
     {
         throw new ArgumentException("The specified stream cannot be read.");
     }
     this.Sid       = sid;
     this.Stream    = stream;
     this.Size      = size;
     this.Count     = 0L;
     this.Receiving = receiving;
     this.From      = from;
     this.To        = to;
     this.Extension = extension;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the SISession class.
 /// </summary>
 /// <param name="sid">The identifier of the session.</param>
 /// <param name="stream">The IO-stream from which data is read, or to
 /// which data is written.</param>
 /// <param name="size">The total number of bytes to read from, or to
 /// write to the stream.</param>
 /// <param name="receiving">true if data is being received over the session;
 /// Otherwise false.</param>
 /// <param name="from">The JID of the XMPP entity that wishes to send data.</param>
 /// <param name="to">The JID of the XMPP entity that wishes to receive
 /// data.</param>
 /// <param name="extension">The instance of the data-stream extension
 /// negotiated during session-initiation.</param>
 /// <exception cref="ArgumentNullException">The sid parameter or the stream
 /// parameter or the from parameter or the to parameter or the extension
 /// parameter is null.</exception>
 /// <exception cref="ArgumentException">The receiving parameter is true, but
 /// the specified stream cannot be written, or the receiving parameter is
 /// false, but the specified stream cannot be read.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The size parameter is
 /// negative.</exception>
 public SISession(string sid, Stream stream, long size, bool receiving,
                  Jid from, Jid to, IDataStream extension)
 {
     sid.ThrowIfNull("sid");
     stream.ThrowIfNull("stream");
     size.ThrowIfOutOfRange(0, Int64.MaxValue);
     from.ThrowIfNull("from");
     to.ThrowIfNull("to");
     extension.ThrowIfNull("extension");
     if (receiving && !stream.CanWrite)
     {
         throw new ArgumentException("The specified stream cannot be written.");
     }
     if (!receiving && !stream.CanRead)
     {
         throw new ArgumentException("The specified stream cannot be read.");
     }
     Sid       = sid;
     Stream    = stream;
     Size      = size;
     Count     = 0;
     Receiving = receiving;
     From      = from;
     To        = to;
     Extension = extension;
 }
예제 #3
0
		/// <summary>
		/// Initializes a new instance of the SISession class.
		/// </summary>
		/// <param name="sid">The identifier of the session.</param>
		/// <param name="stream">The IO-stream from which data is read, or to
		/// which data is written.</param>
		/// <param name="size">The total number of bytes to read from, or to
		/// write to the stream.</param>
		/// <param name="receiving">true if data is being received over the session;
		/// Otherwise false.</param>
		/// <param name="from">The JID of the XMPP entity that wishes to send data.</param>
		/// <param name="to">The JID of the XMPP entity that wishes to receive
		/// data.</param>
		/// <param name="extension">The instance of the data-stream extension
		/// negotiated during session-initiation.</param>
		/// <exception cref="ArgumentNullException">The sid parameter or the stream
		/// parameter or the from parameter or the to parameter or the extension
		/// parameter is null.</exception>
		/// <exception cref="ArgumentException">The receiving parameter is true, but
		/// the specified stream cannot be written, or the receiving parameter is
		/// false, but the specified stream cannot be read.</exception>
		/// <exception cref="ArgumentOutOfRangeException">The size parameter is
		/// negative.</exception>
		public SISession(string sid, Stream stream, long size, bool receiving,
			Jid from, Jid to, IDataStream extension) {
			sid.ThrowIfNull("sid");
			stream.ThrowIfNull("stream");
			size.ThrowIfOutOfRange(0, Int64.MaxValue);
			from.ThrowIfNull("from");
			to.ThrowIfNull("to");
			extension.ThrowIfNull("extension");
			if (receiving && !stream.CanWrite)
				throw new ArgumentException("The specified stream cannot be written.");
			if (!receiving && !stream.CanRead)
				throw new ArgumentException("The specified stream cannot be read.");
			Sid = sid;
			Stream = stream;
			Size = size;
			Count = 0;
			Receiving = receiving;
			From = from;
			To = to;
			Extension = extension;
		}