Exemplo n.º 1
0
        /// <summary>
        /// Opens the write.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag;
            try
            {
                AutoCommitedTransactedStream tranStream = new AutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), contentLength);
                tranStream.InnerStream = fileInfo.OpenWrite();
                tranStream.SetLength(0);

                return(tranStream);
            }
            catch (Exception)
            {
                throw new HttpException(404, "Not Found");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens the write.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
        {
            if (element == null || element is CollectionInfo)
                return null;

            Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag;
            try
            {
                AutoCommitedTransactedStream tranStream = new AutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), contentLength);
                tranStream.InnerStream = fileInfo.OpenWrite();
                tranStream.SetLength(0);

                return tranStream;
            }
            catch (Exception)
            {
                throw new HttpException(404, "Not Found");
            }
        }