https://github.com/bitbeans/diskdetector-net
Extended drive information on windows (SSD and HDD detection)
https://github.com/bitbeans/diskdetector-net
detection hdd ssd
Last synced: 11 months ago
JSON representation
Extended drive information on windows (SSD and HDD detection)
- Host: GitHub
- URL: https://github.com/bitbeans/diskdetector-net
- Owner: bitbeans
- License: mit
- Created: 2015-08-23T16:55:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-29T15:39:29.000Z (about 6 years ago)
- Last Synced: 2025-04-19T04:14:26.190Z (11 months ago)
- Topics: detection, hdd, ssd
- Language: C#
- Size: 24.4 KB
- Stars: 17
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# diskdetector-net [](https://www.nuget.org/packages/diskdetector-net/) [](https://github.com/bitbeans/diskdetector-net/blob/master/LICENSE.md)
Class to detect the hardware type (SSD or HDD) of a hard disk on windows based systems.
This implementation is based on [emoacht.wordpress.com](https://emoacht.wordpress.com/2012/11/06/csharp-ssd/).
## Installation
There is a [NuGet package](https://www.nuget.org/packages/diskdetector-net/) available.
## Example
```csharp
public void DetectFixedDrivesTest()
{
var detectedDrives = Detector.DetectFixedDrives(QueryType.SeekPenalty);
if (detectedDrives.Count != 0)
{
foreach (var detectedDrive in detectedDrives)
{
Console.WriteLine("Drive {0}", detectedDrive.Name);
Console.WriteLine(" File type: {0}", detectedDrive.DriveType);
Console.WriteLine(" Volume label: {0}", detectedDrive.VolumeLabel);
Console.WriteLine(" File system: {0}", detectedDrive.DriveFormat);
Console.WriteLine(" Letter: {0}", detectedDrive.DriveLetter);
Console.WriteLine(" HardwareType: {0}", detectedDrive.HardwareType);
Console.WriteLine(" Id: {0}", detectedDrive.Id);
Console.WriteLine(
" Available space to current user:{0, 15} bytes",
detectedDrive.AvailableFreeSpace);
Console.WriteLine(
" Total available space: {0, 15} bytes",
detectedDrive.TotalFreeSpace);
Console.WriteLine(
" Total size of drive: {0, 15} bytes ",
detectedDrive.TotalSize);
}
}
/*
Drive C:\
File type: Fixed
Volume label: Windows
File system: NTFS
Letter: C
HardwareType: Ssd
Id: 0
Available space to current user: 23861460992 bytes
Total available space: 23861460992 bytes
Total size of drive: 255505461248 bytes
Drive F:\
File type: Fixed
Volume label: Data
File system: NTFS
Letter: F
HardwareType: Hdd
Id: 1
Available space to current user: 1250781491200 bytes
Total available space: 1250781491200 bytes
Total size of drive: 2000397791232 bytes
*/
```
## License
[MIT](https://en.wikipedia.org/wiki/MIT_License)