Little Registry Cleaner/Common Tools/LittleSoftwareStats/Utils.cs

(开头部分) 8KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Diagnostics;
using System.Collections;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using System.IO;
using Microsoft.Win32;

namespace LittleSoftwareStats
{
    internal class Utils
    {
        public static string GetCommandExecutionOutput(string command, string arguments)
        {
            var proc = new Process();

            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.FileName = command;
            proc.StartInfo.Arguments = arguments;
            proc.Start();

            string output = proc.StandardOutput.ReadToEnd();

            if (String.IsNullOrEmpty(output))
                output = proc.StandardError.ReadToEnd();

            return output;
        }

        public static int GetUnixTime()
        {
            return (int)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
        }

        public static object GetRegistryValue(RegistryKey regRoot, string regPath, string valueName, object defaultValue = null)
        {
            object value = defaultValue;

            using (RegistryKey regKey = regRoot.OpenSubKey(regPath))
            {
                if (regKey != null)
                {
                    if (defaultValue != null)
                        value = regKey.GetValue(valueName, defaultValue);
                    else
                        value = regKey.GetValue(valueName);
                }
            }

            return value;
        }

        public static string SerializeAsXML(Events events)
后面还有 206 行代码,购买后查看完整代码

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

AI 解读 AI

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

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