Little Registry Cleaner/Common Tools/LittleSoftwareStats/Hardware/UnixHardware.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace LittleSoftwareStats.Hardware
{
    internal class UnixHardware : Hardware
    {
        public UnixHardware()
        {
        }

        public override string CPUName
        {
            get
            {
                try
                {
                    string output = Utils.GetCommandExecutionOutput("cat", "/proc/cpuinfo");
                    Regex regex = new Regex(@"(?:model name\s+:\s*)(?<ModelName>[\w \(\)@\.]*)");
                    MatchCollection matches = regex.Matches(output);
                    return matches[0].Groups["ModelName"].Value;
                }
                catch { }

                return "Unknown";
            }
        }

        public override string CPUBrand
        {
            get
            {
                try
                {
                    string output = Utils.GetCommandExecutionOutput("cat", "/proc/cpuinfo");
                    Regex regex = new Regex(@"(?:vendor_id\s+:\s*)(?<vendor>\w*)");
                    MatchCollection matches = regex.Matches(output);
                    return matches[0].Groups[1].Value;
                }
                catch { }

                return "Unknown";
            }
        }

        public override double CPUFrequency
        {
            get
            {
                try
                {
                    string output = Utils.GetCommandExecutionOutput("cat", "/proc/cpuinfo");
                    Regex regex = new Regex(@"(?:bogomips\s+:\s*)(?<bogomips>\w*)");
                    MatchCollection matches = regex.Matches(output);
                    int bogomips = int.Parse(matches[0].Groups[1].Value);
后面还有 145 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。