예제 #1
0
        public static Area operator /(Volume ls, Length rs)
        {
            VolumeSystem s = ls.System;

            if (s == VolumeSystem.MetricSolid || s == VolumeSystem.ImperialSolid)
            {
                Area res;
                switch (s)
                {
                case VolumeSystem.MetricSolid:
                    res = new Area(ls.As(VolumeUnit.CubicMeter) / rs.As(LengthUnit.Meter), AreaUnit.SqrMeter);
                    break;

                case VolumeSystem.ImperialSolid:
                    res = new Area(ls.As(VolumeUnit.CubicFoot) / rs.As(LengthUnit.Foot), AreaUnit.SqrFoot);
                    break;

                default:
                    throw new NotImplementedException();
                }
                return(res);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
예제 #2
0
        public void OpenVolumeSystemAndCountFiles()
        {
            using (VolumeSystem volumeSystem = this.diskImage.OpenVolumeSystem())
            {
                Assert.AreEqual(3, volumeSystem.PartitionCount);
                Assert.AreEqual(1, volumeSystem.AllocatedPartitionCount);
                Assert.AreEqual(3, volumeSystem.Volumes.Count());

                int count = 0;
                foreach (Volume volume in volumeSystem.Volumes)
                {
                    if (volume.Description == "Primary Table (#0)" ||
                        volume.Description == "Unallocated")
                    {
                        continue;
                    }

                    using (FileSystem fileSystem = volume.OpenFileSystem())
                    {
                        //count += CountFiles(fileSystem.OpenRootDirectory());
                        fileSystem.WalkDirectories(
                            FileCount_DirectoryWalkCallback,
                            DirWalkFlags.Recurse | DirWalkFlags.Unallocated);
                    }
                }

                Assert.AreEqual(30, jpgFileCount);
                //I think it should be 63 //Bala- Autopsy shows me that there are only 30 files
                Assert.AreEqual(37, allFileCount);
            }
        }
예제 #3
0
        public void OpenVolumeSystemAndFindFiles()
        {
            int volumeAdress = 2;

            using (VolumeSystem volumeSystem = this.diskImage.OpenVolumeSystem())
            {
                Volume volume = volumeSystem.Volumes.SingleOrDefault(v => v.Address == volumeAdress);

                Assert.NotNull(volume);

                using (FileSystem fileSystem = volume.OpenFileSystem())
                {
                    //count += CountFiles(fileSystem.OpenRootDirectory());
                    fileSystem.WalkDirectories(
                        FindFiles_DirectoryWalkCallback,
                        DirWalkFlags.Recurse | DirWalkFlags.Unallocated);
                }

                Assert.AreEqual(37, FilePaths.Count()); //I think it should be 63 || Bala: Autopsy shows me that there are only 30 files
            }
        }
예제 #4
0
        public void OpenSingleFileAddressFromVolume()
        {
            int  volumeAddress = 2;
            long fileAddress   = 518;

            using (VolumeSystem volumeSystem = this.diskImage.OpenVolumeSystem())
            {
                Volume volume = volumeSystem.Volumes.SingleOrDefault(v => v.Address == volumeAddress);

                Assert.NotNull(volume);

                using (FileSystem fileSystem = volume.OpenFileSystem())
                {
                    using (File file = fileSystem.OpenFile(fileAddress))
                    {
                        Assert.NotNull(file);
                        Assert.AreEqual(38947, file.Size);
                    }
                }
            }
        }
예제 #5
0
        public void OpenSingleFileFromVolume()
        {
            int    volumeAddress = 2;
            String filepath      = @"A folder/370076.jpg";

            using (VolumeSystem volumeSystem = this.diskImage.OpenVolumeSystem())
            {
                Volume volume = volumeSystem.Volumes.SingleOrDefault(v => v.Address == volumeAddress);

                Assert.NotNull(volume);

                using (FileSystem fileSystem = volume.OpenFileSystem())
                {
                    using (File file = fileSystem.OpenFile(filepath))
                    {
                        Assert.NotNull(file);
                        Assert.AreEqual(32061, file.Size);
                        Assert.AreEqual(FilesystemNameType.Regular, file.FileStruct.Name.Value.Type);
                    }
                }
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            var file         = new FileInfo("..//..//resources/USB-disk-image-FAT.E01");
            var diskImage    = new DiskImage(file);
            int volumeAdress = 2;

            using (VolumeSystem volumeSystem = diskImage.OpenVolumeSystem())
            {
                Volume volume = volumeSystem.Volumes.SingleOrDefault(v => v.Address == volumeAdress);

                //Assert.NotNull(volume);

                using (FileSystem fileSystem = volume.OpenFileSystem())
                {
                    //count += CountFiles(fileSystem.OpenRootDirectory());
                    fileSystem.WalkDirectories(
                        FindFiles_DirectoryWalkCallback,
                        DirWalkFlags.Recurse | DirWalkFlags.Unallocated);
                }
                Console.ReadKey();
                //Assert.AreEqual(37, FilePaths.Count()); //I think it should be 63 || Bala: Autopsy shows me that there are only 30 files
            }
        }