📄 action.cs
字号:
{
try
{
if(isSet ==true)
{
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",true);
rk.SetValue ("AutoAdminLogon",AutoAdminLogon);
rk.SetValue ("DefaultUserName",DefaultUserName);
rk.SetValue ("DefaultPassword",DefaultPassword);
rk.SetValue ("DefaultDomainName",DefaultDomainName);
rk.Close ();
}
else
{
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",true);
DefaultUserName=(string)rk.GetValue ("DefaultUserName");
DefaultPassword=(string)rk.GetValue ("DefaultPassword");
DefaultDomainName=(string)rk.GetValue ("DefaultDomainName");
rk.Close ();
}
}
catch
{
}
}
#endregion
#region 注册软件信息
public static void SetRegisterInfo(string UserName ,string UserID)
{
try
{
bool isSave=false;
RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"Software\",true);
string [] subkey=rk.GetSubKeyNames();
foreach(string skey in subkey)
{
if(skey=="SGsoft")
{
isSave=true;
break;
}
}
if(isSave==false)
{
rk.CreateSubKey ("SGsoft");
}
RegistryKey rk2=Registry.LocalMachine.OpenSubKey (@"Software\SGsoft\",true);
rk2.SetValue("User",UserName);
rk2.SetValue("UserID",UserID);
rk2.SetValue("RegisterTime",System.DateTime.Now.ToShortDateString());
rk2.Close ();
rk.Close ();
}
catch(Exception ee )
{
throw ee;
}
}
public static string GetRegisterInfo(ref string UserName ,ref string UserID)
{
try
{
string RegisterKey="";
RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"Software\",true);
string [] subkey=rk.GetSubKeyNames();
foreach(string skey in subkey)
{
if(skey=="SGsoft")
{
RegistryKey rk2=Registry.LocalMachine.OpenSubKey (@"Software\SGsoft\",true);
UserName=(string)rk2.GetValue ("User");
UserID=(string)rk2.GetValue ("UserID");
RegisterKey=(string)rk2.GetValue ("RegisterKey");
rk2.Close ();
break;
}
}
rk.Close ();
return RegisterKey;
}
catch(Exception ee )
{
throw ee;
}
}
public static string RegisteredProduct(string RegisterKey,bool rp)
{
try
{
if(rp)
{
RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"Software\SGsoft\",true);
rk.SetValue ("RegisterKey",RegisterKey);
rk.Close ();
StreamWriter sw=new StreamWriter (System.Windows.Forms.Application.StartupPath +@"\data\RegisterData.sgp");
sw.WriteLine (RegisterKey);
sw.Close ();
}
else
{
if(File.Exists (System.Windows.Forms.Application.StartupPath +@"\data\RegisterData.sgp"))
{
StreamReader sr=new StreamReader (System.Windows.Forms.Application.StartupPath +@"\data\RegisterData.sgp");
string temp =sr.ReadToEnd ();
sr.Close ();
return temp;
}
}
return "";
}
catch
{
return "";
}
}
#endregion
public static string getDeskTopIcon(string Name)
{
try
{
string temp="";
if(Name=="我的电脑")
{
//HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon
try
{
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
catch
{
}
}
else if(Name=="我的文档")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="网上邻居")
{
try
{
//HKEY_CLASSES_ROOT\CLSID\{208D2C60-3AEA-1069-A2D7-08002B30309D}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{208D2C60-3AEA-1069-A2D7-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
catch
{
return "";
}
}
else if(Name=="回收站(满)")
{
//HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon Full
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon",true);
temp=(string)rk.GetValue ("Full");
rk.Close ();
}
else if(Name=="回收站(空)")
{
//HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon Empty
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon",true);
temp=(string)rk.GetValue ("Empty");
rk.Close ();
}
else if(Name=="控制面板")
{
//HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{21EC2020-3AEA-1069-A2DD-08002B30309D}\DefaultIcon
action.CreateRegPath (@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\",@"{21EC2020-3AEA-1069-A2DD-08002B30309D}\DefaultIcon");
RegistryKey rk=Registry.CurrentUser .OpenSubKey (@"Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{21EC2020-3AEA-1069-A2DD-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("",System.Environment.SystemDirectory +"\\shell32.dll,21");
}
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="拔号网络")
{
//HKEY_CLASSES_ROOT\CLSID\{7007ACC7-3202-11D1-AAD2-00805FC1270E}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{7007ACC7-3202-11D1-AAD2-00805FC1270E}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="计划任务")
{
//HKEY_CLASSES_ROOT\CLSID\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="打印机")
{
//HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{2227A280-3AEA-1069-A2DE-08002B30309D}\DefaultIcon
action.CreateRegPath (@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\",@"{2227A280-3AEA-1069-A2DE-08002B30309D}\DefaultIcon");
RegistryKey rk=Registry.CurrentUser .OpenSubKey (@"Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{2227A280-3AEA-1069-A2DE-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
if(temp==null || (temp.Length <1) && !File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("",System.Environment.SystemDirectory +"\\shell32.dll,16");
}
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="Web文件夹")
{
//HKEY_CLASSES_ROOT\CLSID\{BDEADF00-C265-11d0-BCED-00A0C90AB50F}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{BDEADF00-C265-11d0-BCED-00A0C90AB50F}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="IE浏览器")
{
//HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\DefaultIcon
action.CreateRegPath (@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\",@"{871C5380-42A0-1069-A2EA-08002B30309D}\DefaultIcon");
RegistryKey rk=Registry.CurrentUser.OpenSubKey (@"Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
if(temp==null || (temp.Length <1) && !File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("",System.Environment.SystemDirectory+"\\mshtml.dll,0");
}
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="URL文件夹")
{
//HKEY_CLASSES_ROOT\CLSID\{FF393560-C2A7-11CF-BFF4-444553540000}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{FF393560-C2A7-11CF-BFF4-444553540000}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="预定文件夹")
{
//HKEY_CLASSES_ROOT\CLSID\{F5175861-2688-11d0-9C5E-00AA00A45957}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{F5175861-2688-11d0-9C5E-00AA00A45957}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="我的公文包")
{
//HKEY_CLASSES_ROOT\CLSID\{85BBD920-42A0-1069-A2E4-08002B30309D}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot.OpenSubKey (@"CLSID\{85BBD920-42A0-1069-A2E4-08002B30309D}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
return temp;
}
catch
{
return "";
}
}
public static string getSystemIcon(string Name)
{
try
{
string temp="";
if(Name=="文件夹(关闭)")
{
action.CreateRegPath (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\",@"Shell Icons");
//HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons 3
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("3");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("3",System.Environment.SystemDirectory +"\\shell32.dll,3");
}
temp=(string)rk.GetValue ("3");
rk.Close ();
}
else if(Name=="文件夹(打开)")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 4
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("4");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("4",System.Environment.SystemDirectory +"\\shell32.dll,4");
}
temp=(string)rk.GetValue ("4");
rk.Close ();
}
else if(Name=="3.5英寸软盘")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 6
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("6");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("6",System.Environment.SystemDirectory +"\\shell32.dll,6");
}
temp=(string)rk.GetValue ("6");
rk.Close ();
}
else if(Name=="5.5英寸软盘")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 5
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("5");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("5",System.Environment.SystemDirectory +"\\shell32.dll,5");
}
temp=(string)rk.GetValue ("5");
rk.Close ();
}
else if(Name=="可移动驱动器")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 7
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("7");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("7",System.Environment.SystemDirectory +"\\shell32.dll,7");
}
temp=(string)rk.GetValue ("7");
rk.Close ();
}
else if(Name=="硬盘")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 8
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("8");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("8",System.Environment.SystemDirectory +"\\shell32.dll,8");
}
temp=(string)rk.GetValue ("8");
rk.Close ();
}
else if(Name=="在线网络")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 9
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("9");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("9",System.Environment.SystemDirectory +"\\shell32.dll,9");
}
temp=(string)rk.GetValue ("9");
rk.Close ();
}
else if(Name=="离线网络")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 10
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("10");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("10",System.Environment.SystemDirectory +"\\shell32.dll,10");
}
temp=(string)rk.GetValue ("10");
rk.Close ();
}
else if(Name=="光盘驱动器")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 11
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("11");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("11",System.Environment.SystemDirectory +"\\shell32.dll,11");
}
temp=(string)rk.GetValue ("11");
rk.Close ();
}
else if(Name=="整个网络")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 13
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("13");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("13",System.Environment.SystemDirectory +"\\shell32.dll,13");
}
temp=(string)rk.GetValue ("13");
rk.Close ();
}
else if(Name=="快捷方式")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 29
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("29");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("29",System.Environment.SystemDirectory +"\\shell32.dll,29");
}
temp=(string)rk.GetValue ("29");
rk.Close ();
}
else if(Name=="共享资源")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 28
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("28");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("28",System.Environment.SystemDirectory +"\\shell32.dll,28");
}
temp=(string)rk.GetValue ("28");
rk.Close ();
}
else if(Name=="我的电脑")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 15
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("15");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("15",System.Environment.SystemDirectory +"\\shell32.dll,15");
}
temp=(string)rk.GetValue ("15");
rk.Close ();
}
else if(Name=="打印机")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon
RegistryKey rk=Registry.ClassesRoot .OpenSubKey (@"CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon",true);
temp=(string)rk.GetValue ("");
rk.Close ();
}
else if(Name=="网络工作组")
{
//HKEY_CLASSES_ROOT\CLSID\{ECF03A32-103D-11d2-854D-006008059367}\DefaultIcon 18
RegistryKey rk=Registry.LocalMachine .OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons",true);
temp=(string)rk.GetValue ("18");
if(temp==null || (temp.Length <1) && File.Exists (temp.Substring (0,temp.LastIndexOf (","))))
{
rk.SetValue ("18",System.Environment.SystemDirectory +"\\shell3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -