C3032
2025-12-20 15492363f898704b51afce5f1c88fa3b754cbabc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace SmartScanner.ImageService
{
    class MemoryAlarmCheck
    {
        private (double usedPercentage, string driveName) GetDriveUsage()
        {
            // 获取系统盘
            DownloadData downloadData = new DownloadData();
            DriveInfo drive = new DriveInfo($"{downloadData.SetDataSavingRoad.Text}");
            double totalSpace = drive.TotalSize;
            double freeSpace = drive.AvailableFreeSpace;
            double usedPercentage = 100 - (freeSpace / totalSpace * 100);
 
            return (usedPercentage, drive.Name);
        }
    }
}