public void Format_LargeDisk() { long size = 1024L * 1024 * 1024L * 1024; // 1 TB SparseMemoryStream partStream = new SparseMemoryStream(); NtfsFileSystem.Format(partStream, "New Partition", Geometry.FromCapacity(size), 0, size / 512); NtfsFileSystem ntfs = new NtfsFileSystem(partStream); ntfs.Dump(TextWriter.Null, ""); }
public void Format_SmallDisk() { long size = 8 * 1024 * 1024; SparseMemoryStream partStream = new SparseMemoryStream(); //VirtualDisk disk = Vhd.Disk.InitializeDynamic(partStream, Ownership.Dispose, size); NtfsFileSystem.Format(partStream, "New Partition", Geometry.FromCapacity(size), 0, size / 512); NtfsFileSystem ntfs = new NtfsFileSystem(partStream); ntfs.Dump(TextWriter.Null, ""); }
protected override void DoRun() { VolumeManager volMgr = new VolumeManager(); foreach (string disk in _diskFiles.Values) { volMgr.AddDisk(VirtualDisk.OpenDisk(disk, FileAccess.Read, UserName, Password)); } Stream partitionStream = null; if (!string.IsNullOrEmpty(VolumeId)) { partitionStream = volMgr.GetVolume(VolumeId).Open(); } else if (Partition >= 0) { partitionStream = volMgr.GetPhysicalVolumes()[Partition].Open(); } else { partitionStream = volMgr.GetLogicalVolumes()[0].Open(); } SparseStream cacheStream = SparseStream.FromStream(partitionStream, Ownership.None); cacheStream = new BlockCacheStream(cacheStream, Ownership.None); NtfsFileSystem fs = new NtfsFileSystem(cacheStream); fs.NtfsOptions.HideHiddenFiles = !_showHidden.IsPresent; fs.NtfsOptions.HideSystemFiles = !_showSystem.IsPresent; fs.NtfsOptions.HideMetafiles = !_showMeta.IsPresent; fs.Dump(Console.Out, ""); }