📄 registry.cs
字号:
using System;
using System.Text;
namespace LicenseManage.BaseClasses
{
using System.IO;
using Microsoft.VisualBasic;
class Registry
{
private const string regfilepath = @"C:\Registry.reg";
public static void regs_imports(string section)
{
var test123 = IniFile.IniReadValue(section, "regs", IniInfo.filePath);
if (test123.Length <= 0)
return;
int regsNo = Convert.ToInt32(test123);
var sb = new StringBuilder();
for (int x = 0; x < regsNo; x++) //switch all sections
{
sb.AppendLine("Windows Registry Editor Version 5.00");
sb.AppendLine();
string valTbl1 = "reg_" + x +"_path";
sb.AppendLine(IniFile.IniReadValue(section, valTbl1, IniInfo.filePath));
string valTbl2 = "reg_" + x + "_key";
string keyReturn = IniFile.IniReadValue(section, valTbl2, IniInfo.filePath);
if (keyReturn.ToLower().Trim() == "@")
{
//sb.Append('"' + "@" + '"' + '=');
sb.Append("@" + '=');
}
else if(keyReturn.Length>0 && keyReturn.ToLower().Trim() != "@")
sb.Append('"' + IniFile.IniReadValue(section, valTbl2, IniInfo.filePath) + '"' + '=');
//sb.Append('"' + "@" + '"' + '=');
//string valTbl3 = "reg_" + x + "_type";
//sb.AppendLine(IniFile.IniReadValue(section, valTbl3, IniInfo.filePath));
string valTbl4 = "reg_" + x + "_value";
string test_0 = IniFile.IniReadValue(section, valTbl4, IniInfo.filePath);
int test1 = test_0.IndexOf("table");
int test2 = test_0.IndexOf("field");
string test_result = "";
if (test2 >= 0 && test1 >= 0)
{
foreach (string tbl_response in Program.Ini_value_Response)
{
if (tbl_response.Contains(test_0))
{
int GG = tbl_response.IndexOf("::");
test_result = tbl_response.Substring(GG + 2);
}
}
}
sb.Append('"' + test_result + '"');
sb.AppendLine();
}
var sfb = new StreamWriter(regfilepath);
sfb.Write(sb);
sfb.Flush();
sfb.Dispose();
Interaction.Shell("cmd /C REGEDIT /S " + regfilepath, AppWinStyle.Hide, true, -1);
File.Delete(regfilepath);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -