If you now run the program you will see the raw SMART data displayed as a table. Your next task is to process it and build it into a useful reporting tool that will warn you if anything is going wrong.

The raw SMART data

If you want to work with the data in a more object-oriented way then you probably need to create a SMART class but a SMART struct also works well. For example, a struct that holds values for the most important failure indicators would be:

public struct SMARTAttribute{ public int status; public int value; public int rawvalue;}public struct SMART{ public SMARTAttribute RawReadErrorRate; public SMARTAttribute ReallocatedSectorCount; public SMARTAttribute ReallocationEventCount; public SMARTAttribute CurrentPendingSectorCount; public SMARTAttribute OfflineScanUncorrectableSectorCount;}

Packing the data into the struct is just a matter of detecting which attribute the current 12 bytes of data represents and the best way to do this is with a switch: