Exemplo n.º 1
0
        //long PreviouslyReadOffset = -1;

        public FATXFileStream(string[] InPaths, FATX.File file)
        {
            if (file.Size == 0)
            {
                Close();
                throw new Exception("Null files not supported");
            }
            xFile = file;
            m     = new Misc();
            // Set our position to the beginning of the file
            long off = m.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying          = new IOStream(InPaths, FileMode.Open);
            Underlying.Position = off;
        }
Exemplo n.º 2
0
        public FATXFileStream(string Path, System.IO.FileMode fmode, FATX.File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                Close();
                throw new Exception("Null files not supported");
            }
            xFile = file;
            m     = new Misc();
            // Set our position
            long off = m.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying          = new FileStream(Path, fmode);
            Underlying.Position = off;
        }
Exemplo n.º 3
0
        public FATXFileStream(SafeFileHandle handle, System.IO.FileAccess fa, FATX.File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                Close();
                throw new Exception("Null files not supported");
            }
            xFile = file;
            m     = new Misc();
            // Set our position to the beginning of the file
            long off = m.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying          = new FileStream(handle, fa);
            Underlying.Position = off;
        }
Exemplo n.º 4
0
        private void TransferFile(string drive, string path, FATX.File file)
        {
            _currentFile      = file;
            _currentFileDrive = drive;

            // Dispatch the OnNextFile event
            object[] args = new object[3];
            args[0] = drive;
            args[1] = file.Name;
            args[2] = (int)file.Size;
            _timer.Dispatcher.BeginInvoke(new Action <string, string, int>(OnNextFile), args);

            // Start the timer and overwrite the file
            _timer.Start();
            file.OverWrite(path, ref _overwriteProgress, ref _overwriteTotal, ref _overwriteCancel);
            _timer.Stop();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Queues a file to be transferred.
        /// </summary>
        /// <param name="drive">The name of the drive which the file will be sent to (used for display purposes).</param>
        /// <param name="path">The path to the file to transfer.</param>
        /// <param name="file">The File to overwrite.</param>
        public void QueueFile(string path, FATX.File file)
        {
            string drive = FormatDeviceName(file.Drive);
            KeyValuePair <string, FATX.File>         pair = new KeyValuePair <string, FATX.File>(path, file);
            List <KeyValuePair <string, FATX.File> > driveFiles;

            if (_files.TryGetValue(drive, out driveFiles))
            {
                driveFiles.Add(pair);
            }
            else
            {
                driveFiles = new List <KeyValuePair <string, FATX.File> >();
                driveFiles.Add(pair);
                _files.Add(drive, driveFiles);
            }
        }