It gets all NTFS drives in your system and fills the combobox. New NtfsReader(driveToAnalyze, RetrieveMode.All) Īttributes.Temporary | Attributes.Device |Īttributes.Directory | Attributes.Offline |Īttributes.ReparsePoint | Attributes.SparseFile)) = 0) Var driveToAnalyze = (DriveInfo) DrvCombo.SelectedItem Private void DrvCombo_SelectionChanged(object sender, ![]() To fill this data, you will have to add this code in : public MainWindow()ĭrvCombo.SelectionChanged += DrvCombo_SelectionChanged The listbox has an ItemTemplate that will show the name, size and date of last change of each file. We will have a combobox with all drives in the first row and a listbox with the files. Then, add the NtfsReader project to the solution and add a reference to it in the WPF project. Where(d => d.DriveFormat = "NTFS").ToList() This is done with this code: var ntfsDrives = DriveInfo.GetDrives() The next step is to detect the NTFS disks in your system. Then, you must change the requestedExecutionLevel tag of the file to: Choose Application Manifest File, you will have an app.manifest file added to your project. Then create a new WPF project and add a new item. Open Visual Studio with administrative rights (this is very important, or you won’t be able to debug your program). You will be able to select any of the NTFS disks in your machine. It will enumerate all files and show them in the list, so you can see what’s taking space in your disk. We will create a WPF program that will show the disk usage. If you include the library source code in your code, it will be “derived work” and you must distribute all code as LGPL. You can use the library in your compiled work as a library, with no restriction. This is a lot of work and hours of trial and error.įortunately, there are some libraries that do that in C#, and I’ve used this one, which is licensed as LGPL. You will have to decipher the structure (there is a lot of material here) and access the data using raw disk data read (that’s why you need elevated privileges). There is no formal API to access the MFT structure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |