コード例 #1
0
 public static void ListDisks()
 {
     Console.Error.WriteLine("Logical Disks:\n==============\n");
     foreach (var disk in DiskLoader.LoadLogicalVolumes())
     {
         var fs = ((IFileSystemStore)disk).FS;
         Console.WriteLine(disk + ": " + (fs == null ? "None" : fs.FileSystemType));
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: mrkaban/OpenRecoverFiles
 private void LoadLogicalDisks()
 {
     foreach (Disk disk in DiskLoader.LoadLogicalVolumes())
     {
         TreeNode node = new TreeNode(disk.ToString());
         Console.WriteLine("Added disk: " + disk.ToString());
         node.Tag      = disk;
         node.ImageKey = "HDD";
         if (((IFileSystemStore)disk).FS == null)
         {
             node.ForeColor = Color.Gray;
         }
         diskTree.Nodes.Add(node);
     }
 }
コード例 #3
0
        public static void DumpFile(string dev, string filename)
        {
            var volumes = DiskLoader.LoadLogicalVolumes();
            var volume  = volumes.FirstOrDefault(x => x.ToString().Contains(dev));

            if (volume == null)
            {
                Console.Error.WriteLine("Disk not found: " + dev);
                return;
            }
            dev = volume.ToString();

            var fs = ((IFileSystemStore)volume).FS;

            if (fs == null)
            {
                Console.Error.WriteLine("Disk " + dev + " contains no readable FS.");
                return;
            }

            var scan_state = new Scanner(dev, fs);

            scan_state.ScanFinished += new EventHandler(ScanFinished);
            scan_state.StartScan();
            while (!scan_finished)
            {
                Thread.Sleep(100);
            }

            var files = scan_state.GetDeletedFiles();
            var file  = files.FirstOrDefault(x => x.Name == filename);

            if (file == null)
            {
                Console.Error.WriteLine("File " + filename + " not found on device " + dev);
                return;
            }

            var node = file.GetFileSystemNode();
            var data = node.GetBytes(0, node.StreamLength);

            var output = Console.OpenStandardOutput();

            output.Write(data, 0, data.Length);
        }
コード例 #4
0
        public static void ListFiles(string dev)
        {
            var volumes = DiskLoader.LoadLogicalVolumes();
            var volume  = volumes.FirstOrDefault(x => x.ToString().Contains(dev));

            if (volume == null)
            {
                Console.Error.WriteLine("Disk not found: " + dev);
                return;
            }
            dev = volume.ToString();

            var fs = ((IFileSystemStore)volume).FS;

            if (fs == null)
            {
                Console.Error.WriteLine("Disk " + dev + " contains no readable FS.");
                return;
            }

            Console.Error.WriteLine("Deleted files on " + dev);
            Console.Error.WriteLine("=================" + new String('=', dev.Length));
            var scanner = new Scanner(dev, fs);

            scanner.ScanFinished += new EventHandler(ScanFinished);
            scanner.StartScan();
            while (!scan_finished)
            {
                Thread.Sleep(100);
            }
            var files = scanner.GetDeletedFiles();

            foreach (var file in files)
            {
                Console.WriteLine(file.Name);
            }
        }