The Complete program with an additional textbox to show the processed data is:
namespace WinFormsApp1 { using System.Management; using System.Windows.Forms;
public partial class Form1 : Form { public struct SMARTAttribute { public int status; public int value; public int rawvalue; public SMARTAttribute() { status = 0; value = 0; rawvalue = 0; } } public struct SMART { public SMARTAttribute RawReadErrorRate; public SMARTAttribute ReallocatedSectorCount; public SMARTAttribute ReallocationEventCount; public SMARTAttribute CurrentPendingSectorCount; public SMARTAttribute OfflineScanUncorrectableSectorCount; } public Form1() { InitializeComponent(); richTextBox2.Text = "Unknw\tUnknw\tAttribute \tStatus\tUnknw\tValue\tWorst\t Raw\t\tUnknw\n"; }
private void button1_Click(object sender, EventArgs e) { ManagementObjectSearcher WMISearch = new ManagementObjectSearcher( "Select * from Win32_DiskDrive"); ManagementObjectCollection Drives = WMISearch.Get(); richTextBox1.Text = "Drive\t\t\tStatus\n"; foreach (ManagementObject Drive in Drives) { richTextBox1.Text = richTextBox1.Text + Drive.Properties["DeviceId"]. Value.ToString() + "\t"; richTextBox1.Text = richTextBox1.Text + Drive.Properties["Status"].Value. ToString() + "\n"; } WMISearch.Scope = new ManagementScope( @"\root\wmi"); WMISearch.Query = new ObjectQuery( "Select * from MSStorageDriver_FailurePredictData"); ManagementObjectCollection FailDataSet = WMISearch.Get(); foreach (ManagementObject FailData in FailDataSet) { Byte[] data = (Byte[])FailData. Properties["VendorSpecific"].Value; for (int i = 0; i < data[0] - 1; i++) { for (int j = 0; j < 12; j++) { richTextBox2.Text = richTextBox2. Text + data[i * 12 + j] + "\t"; } richTextBox2.Text = richTextBox2. Text + "\n"; } }
SMART smartdata =new SMART(); foreach (ManagementObject FailData2 in FailDataSet) {
Sotheby's Digital Art Day Action, now underway, features a large-scale portrait of Alan Turing created by Ai-Da, the humanoid robot artist whose work, including this canvas, was exhibited at the [ ... ]
The clamour for safe programming languages seems to be growing and becoming official. We have known for a while that C and C++ are dangerous languages so why has it become such an issue now and is it [ ... ]