Beispiel #1
0
        /// <summary>
        /// Loads the file.
        /// </summary>
        /// <param name="info">The info.</param>
        /// <param name="outputStream">The output stream.</param>
        public void LoadFile(FileHistoryInfo info, Stream outputStream)
        {
            using (Mediachase.IBN.Database.DbTransaction tran = Mediachase.IBN.Database.DbTransaction.Begin())
            {
                DBFile.FileBinaryModifyCounter(info.FileBinaryId);

                byte[] tmpBuffer = new byte[BufferSize];

                using (Stream inputStream = FileOpenRead(info))
                {
                    int count;
                    do
                    {
                        count = inputStream.Read(tmpBuffer, 0, tmpBuffer.Length);
                        outputStream.Write(tmpBuffer, 0, count);
                    }
                    while (count > 0);

                    outputStream.Flush();
                }
                tran.Commit();
            }
        }
Beispiel #2
0
            public DummyFileInfoWrapper(Mediachase.IBN.Business.ControlSystem.FileInfo fileInfo, FileHistoryInfo historyInfo)
            {
                _contentType = fileInfo.FileBinaryContentType;
                _name = fileInfo.Name;
                _fileBinaryId = fileInfo.FileBinaryId;
                _legth = fileInfo.Length;
                _created = fileInfo.Created;
                _modified = fileInfo.Modified;
                _containerKey = fileInfo.ContainerKey;
                _parentDirectoryId = fileInfo.ParentDirectoryId;

                if (historyInfo != null)
                {
                    _contentType = historyInfo.FileBinaryContentType;
                    _name = historyInfo.Name;
                    _fileBinaryId = historyInfo.FileBinaryId;
                    _legth = historyInfo.Length;
                    _modified = historyInfo.Modified;
                }
            }
Beispiel #3
0
 /// <summary>
 /// Files the open read.
 /// </summary>
 /// <param name="info">The info.</param>
 /// <returns></returns>
 public Stream FileOpenRead(FileHistoryInfo info)
 {
     return DBFile.OpenRead(info.FileBinaryId);
 }