WindowsApi/Win32/Kernel32/Kernel32Extension.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Utils.WindowsApi
{
public class Kernel32Extension:Kernel32Base
{
#region 公共方法
/// <summary>
/// 写INI文件
/// </summary>
/// <param name="FilePath">INI文件地址</param>
/// <param name="Section">节名称</param>
/// <param name="Key">键值</param>
/// <param name="Value">值</param>
public static void WriteINIValue(string FilePath, string Section, string Key, string Value)
{
if (!Directory.Exists(FilePath))
{
Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
}
int n = WritePrivateProfileString(Section, Key, Value, FilePath);
}
/// <summary>
/// 读INI文件
/// </summary>
/// <param name="FilePath">INI文件地址</param>
/// <param name="Section">节名称</param>
/// <param name="Key">键值</param>
/// <returns></returns>
public static string ReadINIValue(string FilePath, string Section, string Key)
{
StringBuilder temp = new StringBuilder(4096);
GetPrivateProfileString(Section, Key, "", temp, 4096, FilePath);
return temp.ToString();
}
/// <summary>
/// 获取本地时区
/// </summary>
/// <returns></returns>
public static string GetLocalTimeZone()
{
// 检测当前系统是否为旧系统
if (Common.IsOldOsVersion())
{
TimeZoneInformation tzi = new TimeZoneInformation();
GetTimeZoneInformation(ref tzi);
return TimeZoneInfo2CustomString(tzi);
}
DynamicTimeZoneInformation dtzi = new DynamicTimeZoneInformation();
GetDynamicTimeZoneInformation(ref dtzi);
return DynamicTimeZoneInfo2CustomString(dtzi);
}
后面还有 176 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。