📄 envhelper.cs
字号:
namespace Imps.Client.Utils
{
using Imps.Utils;
using Microsoft.Win32;
using System;
using System.IO;
public static class EnvHelper
{
private static bool _dynamicGifCtl;
private const string ClsId_DynamicGifCtl = "2CCFBF0B-B27F-4146-9310-43E130954BC8";
private const string FileName_DynamicGifCtl = "DynamicGifCtl.dll";
public static bool CheckAndRegDynamicGifCtl()
{
string filepath = Path.Combine(FilePathHelper.AppBaseDir, "DynamicGifCtl.dll");
if (!IsOleRegisteredByClsId("2CCFBF0B-B27F-4146-9310-43E130954BC8", filepath))
{
return RegisterOle(filepath);
}
return true;
}
public static bool CheckEnvironment()
{
OperatingSystem oSVersion = Environment.OSVersion;
if (oSVersion.Platform != PlatformID.Win32NT)
{
return false;
}
if (oSVersion.Version.Major < 5)
{
return false;
}
return true;
}
public static string GetOsString()
{
string text;
OperatingSystem oSVersion = Environment.OSVersion;
switch (oSVersion.Platform)
{
case PlatformID.WinCE:
text = "M";
break;
case ((PlatformID) 4):
text = "U";
break;
default:
text = "W";
break;
}
return string.Format("{0}{1}.{2}", text, oSVersion.Version.Major, oSVersion.Version.Minor);
}
public static bool IsOleRegisteredByClsId(string clsId, string filepath)
{
string name = @"CLSID\{" + clsId + @"}\InprocServer32";
RegistryKey key = Registry.ClassesRoot.OpenSubKey(name);
if (key == null)
{
return false;
}
string text2 = key.GetValue(null) as string;
if (string.IsNullOrEmpty(filepath))
{
return !string.IsNullOrEmpty(text2);
}
return string.Equals(filepath, text2, 1);
}
public static bool RegisterOle(string filepath)
{
return (0 == regsvr32.do_command(filepath, "/s"));
}
public static void StressMemory()
{
}
public static bool DynamicGifCtlRegistered
{
get
{
if (!_dynamicGifCtl)
{
_dynamicGifCtl = CheckAndRegDynamicGifCtl();
}
return _dynamicGifCtl;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -