Exemplo n.º 1
0
 protected void CloseChannel()
 {
     if (downloadChannel.State != CommunicationState.Closed)
     {
         downloadChannel.Close();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Upload a file to Tridion from a Tridion multimedia component or binary TBB
        /// </summary>
        /// <param name="item"><see cref="T:EGIT.CCIT.Tridion.CoreService.TcmUri"/> of the binary Tridion item.</param>
        /// <returns><see cref="T:System.IO.Stream" /> containing the binary data from Tridion</returns>
        public Stream DownloadFile(TcmUri item)
        {
            StreamDownloadClient client = null;

            try
            {
                client = DownloadClient;
                return(client.DownloadBinaryContent(item));
            }
            finally
            {
                if (client != null)
                {
                    if (client.State == CommunicationState.Faulted)
                    {
                        client.Abort();
                    }
                    else
                    {
                        client.Close();
                    }
                }
            }
        }