📄 regsvr32.cs
字号:
namespace Imps.Client.Utils
{
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
public class regsvr32
{
public static int do_command(string filepath)
{
string arguments = " \"";
arguments = arguments + filepath + "\"";
Process process = new Process();
process.StartInfo = new ProcessStartInfo(get_regsvr32_path(), arguments);
process.Start();
process.WaitForExit();
return process.ExitCode;
}
public static int do_command(string filepath, string cmd)
{
string arguments = cmd;
arguments = (arguments + " \"") + filepath + "\"";
Process process = new Process();
process.StartInfo = new ProcessStartInfo(get_regsvr32_path(), arguments);
process.Start();
process.WaitForExit();
return process.ExitCode;
}
protected static string get_regsvr32_path()
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "regsvr32.exe");
}
public static bool is_registered(string clsid, string path)
{
string name = @"CLSID\{" + clsid + @"}\InprocServer32";
string text2 = string.Empty;
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(name))
{
if (key == null)
{
return false;
}
text2 = key.GetValue(null) as string;
if (string.IsNullOrEmpty(text2))
{
key.Close();
return false;
}
if (string.IsNullOrEmpty(path))
{
key.Close();
return !string.IsNullOrEmpty(text2);
}
key.Close();
}
return string.Equals(path, text2, 1);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -