示例#1
0
 /// <summary>
 /// Encode a part.
 /// </summary>
 /// <param name="transmissionPart"></param>
 /// <returns></returns>
 public EncodingResult Encode(ITransmissionPart transmissionPart)
 {
     ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");
     return(Encode(new TransmissionPartCollection {
         transmissionPart
     }));
 }
 /// <summary>
 /// Gets the transmission part with the given key.
 /// </summary>
 /// <returns></returns>
 public ITransmissionPart this[string id] {
     get {
         ITransmissionPart retVal = null;
         transmissionParts.TryGetValue(id, out retVal);
         return(retVal);
     }
 }
        /// <summary>
        /// Add a new transmission part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        /// <exception cref="ArgumentException">If a transmission part with the same id already exists in the collection.</exception>
        public void Add(ITransmissionPart transmissionPart) {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            if (transmissionParts.ContainsKey(transmissionPart.Id)) {
                throw new ArgumentException(string.Format(Messages.TransmissionPartCollection_Add_TransmissionPartExists, transmissionPart.Id));
            }

            transmissionParts.Add(transmissionPart.Id, transmissionPart);
        }
        /// <summary>
        /// Add a new transmission part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        /// <exception cref="ArgumentException">If a transmission part with the same id already exists in the collection.</exception>
        public void Add(ITransmissionPart transmissionPart)
        {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            if (transmissionParts.ContainsKey(transmissionPart.Id))
            {
                throw new ArgumentException(string.Format(Messages.TransmissionPartCollection_Add_TransmissionPartExists, transmissionPart.Id));
            }

            transmissionParts.Add(transmissionPart.Id, transmissionPart);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="part">The original part.</param>
 /// <param name="stream">Stream to send.</param>
 /// <param name="destinationUrl">Fully-qualified destination URL.</param>
 /// <param name="mimeType">The mimeType</param>
 /// <param name="order">The order of this item for sending.</param>
 public FileTransmissionItem(ITransmissionPart part, Stream stream, Uri destinationUrl, string mimeType, int order) {
     this.part = part;
     if (stream.CanSeek) {
         stream.Seek(0, SeekOrigin.Begin);
     }
     this.stream = new TempFileStream();
     stream.CopyTo(this.stream);
     this.destinationUrl = destinationUrl;
     this.mimeType = mimeType;
     this.order = order;
 }
示例#6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="part">The original part.</param>
 /// <param name="stream">Stream to send.</param>
 /// <param name="destinationUrl">Fully-qualified destination URL.</param>
 /// <param name="mimeType">The mimeType</param>
 /// <param name="order">The order of this item for sending.</param>
 public FileTransmissionItem(ITransmissionPart part, Stream stream, Uri destinationUrl, string mimeType, int order)
 {
     this.part = part;
     if (stream.CanSeek)
     {
         stream.Seek(0, SeekOrigin.Begin);
     }
     this.stream = new TempFileStream();
     stream.CopyTo(this.stream);
     this.destinationUrl = destinationUrl;
     this.mimeType       = mimeType;
     this.order          = order;
 }
示例#7
0
 /// <summary>
 /// Encode a part.
 /// </summary>
 /// <param name="transmissionPart"></param>
 /// <returns></returns>
 public EncodingResult Encode(ITransmissionPart transmissionPart) {
     ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");
     return Encode(new TransmissionPartCollection { transmissionPart });
 }
        /// <summary>
        /// Encode a part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        /// <returns></returns>
        public EncodingResult Encode(ITransmissionPart transmissionPart) {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            return new EncodingResult(transmissionPart.CopyOfStream(), transmissionPart.MimeType);
        }
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </summary>
        /// <returns>
        /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </returns>
        /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
        public bool Remove(ITransmissionPart item)
        {
            ParameterCheck.ParameterRequired(item, "item");

            return(transmissionParts.Remove(item.Id));
        }
        /// <summary>
        /// Determines whether the collection contains an item with the same key
        /// as the given item.
        /// </summary>
        /// <returns>
        /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
        /// </returns>
        /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
        public bool Contains(ITransmissionPart item)
        {
            ParameterCheck.ParameterRequired(item, "item");

            return(ContainsId(item.Id));
        }
示例#11
0
 public EncodingResult Encode(ITransmissionPart transmissionPart)
 {
     throw new NotImplementedException();
 }
示例#12
0
        /// <summary>
        /// Add a related transmission part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        public void AddRelatedPart(ITransmissionPart transmissionPart) {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            additionalParts.Add(transmissionPart);
        }
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </summary>
        /// <returns>
        /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </returns>
        /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
        public bool Remove(ITransmissionPart item) {
            ParameterCheck.ParameterRequired(item, "item");

            return transmissionParts.Remove(item.Id);
        }
 /// <summary>
 /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
 /// </summary>
 public void CopyTo(ITransmissionPart[] array, int arrayIndex) {
     transmissionParts.Values.CopyTo(array, arrayIndex);
 }
        /// <summary>
        /// Determines whether the collection contains an item with the same key
        /// as the given item.
        /// </summary>
        /// <returns>
        /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
        /// </returns>
        /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
        public bool Contains(ITransmissionPart item) {
            ParameterCheck.ParameterRequired(item, "item");

            return ContainsId(item.Id);
        }
 public EncodingResult Encode(ITransmissionPart transmissionPart) {
     throw new NotImplementedException();
 }
示例#17
0
        /// <summary>
        /// Encode a part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        /// <returns></returns>
        public EncodingResult Encode(ITransmissionPart transmissionPart)
        {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            return(new EncodingResult(transmissionPart.CopyOfStream(), transmissionPart.MimeType));
        }
示例#18
0
        /// <summary>
        /// Add a related transmission part.
        /// </summary>
        /// <param name="transmissionPart"></param>
        public void AddRelatedPart(ITransmissionPart transmissionPart)
        {
            ParameterCheck.ParameterRequired(transmissionPart, "transmissionPart");

            additionalParts.Add(transmissionPart);
        }