Skip to content

Commit

Permalink
Get drive info
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdtrekkie committed Jul 9, 2024
1 parent b8e43f2 commit 27b3253
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.Json;
using Microsoft.VisualBasic.Devices;
using Microsoft.Win32;
Expand Down Expand Up @@ -111,7 +112,19 @@ public static string GetSystemDetails()

string machineName = Environment.MachineName.ToString();
int uptimeMilliseconds = Environment.TickCount;
string logicalDrives = String.Join(", ", Environment.GetLogicalDrives()).TrimEnd(',', ' ');

DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
if (d.IsReady == true)
{
modLogging.LogEvent(d.Name + " Label: " + d.VolumeLabel + " Type: " + d.DriveType + " Free: " + d.TotalFreeSpace + " Total: " + d.TotalSize, EventLogEntryType.Information, 9999);
} else
{
modLogging.LogEvent(d.Name + " Type: " + d.DriveType, EventLogEntryType.Information, 9999);
}

}

return "System details in event log";
}
Expand Down

0 comments on commit 27b3253

Please sign in to comment.