⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 action.cs

📁 XP界面优化精灵, XP界面优化精灵
💻 CS
📖 第 1 页 / 共 5 页
字号:
		/// <summary>
		/// 密码加密
		/// </summary>
		/// <param name="pass">密码</param>
		/// <returns>返回加密后的密码</returns>
		public static string Encryption(string pass)
		{
			pass=pass.ToUpper ();
			byte [] code= System.Text.UnicodeEncoding.ASCII.GetBytes (pass);
			string temp="";
			foreach (byte codepart in code)
			{
				char c=(char)(byte)(codepart+10);
				temp+=System.Uri.HexEscape(c).Remove(0,1);
			}
			return temp;
		}
		#endregion]

		#region 右键菜单
		/// <summary>
		/// 添加指定的右键菜单
		/// </summary>
		/// <param name="type">类型选择,文件、文件夹、驱动器选一个</param>
		/// <param name="filetype">文件类型选择,如果类型选择文件则对应的文件扩展名</param>
		/// <param name="MenuName">菜单名称</param>
		/// <param name="RunCommand">菜单对应的执行命令</param>
		public static void setRightKeyMenu(string type,string filetype,string MenuName,string RunCommand)
		{
			try
			{
				if(type=="File")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey (filetype+"\\shell\\",true);
					rk.CreateSubKey (MenuName+"\\command");
					RegistryKey rk2=Registry.ClassesRoot.OpenSubKey (filetype+"\\shell\\"+MenuName+"\\",true);
					rk2.SetValue ("",MenuName);
					RegistryKey rk3=Registry.ClassesRoot.OpenSubKey (filetype+"\\shell\\"+MenuName+"\\command",true);
					rk3.SetValue ("",RunCommand);
					rk3.Close ();
					rk2.Close ();
					rk.Close ();
				}
				else if(type=="Directory")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Directory\\shell\\",true);
					rk.CreateSubKey (MenuName+"\\command");
					RegistryKey rk2=Registry.ClassesRoot.OpenSubKey ("Directory\\shell\\"+MenuName+"\\",true);
					rk2.SetValue ("",MenuName);
					RegistryKey rk3=Registry.ClassesRoot.OpenSubKey ("Directory\\shell\\"+MenuName+"\\command",true);
					rk3.SetValue ("",RunCommand);
					rk3.Close ();
					rk2.Close ();
					rk.Close ();
				}
				else if(type=="Drive")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Drive\\shell\\",true);
					rk.CreateSubKey (MenuName+"\\command");
					RegistryKey rk2=Registry.ClassesRoot.OpenSubKey ("Drive\\shell\\"+MenuName+"\\",true);
					rk2.SetValue ("",MenuName);
					RegistryKey rk3=Registry.ClassesRoot.OpenSubKey ("Drive\\shell\\"+MenuName+"\\command",true);
					rk3.SetValue ("",RunCommand);
					rk3.Close ();
					rk2.Close ();
					rk.Close ();
				}
				else if(type=="Folder")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Folder\\shell\\",true);
					rk.CreateSubKey (MenuName+"\\command");
					RegistryKey rk2=Registry.ClassesRoot.OpenSubKey ("Folder\\shell\\"+MenuName+"\\",true);
					rk2.SetValue ("",MenuName);
					RegistryKey rk3=Registry.ClassesRoot.OpenSubKey ("Folder\\shell\\"+MenuName+"\\command",true);
					rk3.SetValue ("",RunCommand);
					rk3.Close ();
					rk2.Close ();
					rk.Close ();
				}
			}
			catch(Exception ee)
			{
				throw ee;
			}
		}
		/// <summary>
		/// 删除指定的右键菜单
		/// </summary>
		/// <param name="type">类型选择,文件、文件夹、驱动器选一个</param>
		/// <param name="filetype">文件类型选择,如果类型选择文件则对应的文件扩展名</param>
		/// <param name="MenuName">菜单名称</param>
		public static void removeRightKeyMenu(string type,string filetype,string MenuName)
		{
			try
			{
				if(type=="File")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey (filetype+"\\shell\\",true);
					rk.DeleteSubKeyTree(MenuName);
					rk.Close ();
				}
				else if(type=="Directory")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Directory\\shell\\",true);
					rk.DeleteSubKeyTree(MenuName);
					rk.Close ();
				}
				else if(type=="Drive")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Drive\\shell\\",true);
					rk.DeleteSubKeyTree(MenuName);
					rk.Close ();
				}
				else if(type=="Folder")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Folder\\shell\\",true);
					rk.DeleteSubKeyTree(MenuName);
					rk.Close ();
				}
			}
			catch
			{
			}
		}

		public static bool getRightKeyMenu(string type,string filetype,string MenuName)
		{
			try
			{
				bool isChecked=false;
				if(type=="File")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey (filetype+"\\shell\\",true);
					string [] temp=rk.GetSubKeyNames();
					
					foreach(string tt in temp)
					{
						if(tt==MenuName)
						{
							isChecked=true;
							break;
						}
					}
					rk.Close ();
				}
				else if(type=="Directory")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Directory\\shell\\",true);
					string [] temp=rk.GetSubKeyNames();
					foreach(string tt in temp)
					{
						if(tt==MenuName)
						{
							isChecked=true;
							break;
						}
					}
					rk.Close ();
				}
				else if(type=="Drive")
				{
					RegistryKey rk=Registry.ClassesRoot.OpenSubKey ("Drive\\shell\\",true);
					string [] temp=rk.GetSubKeyNames();
					foreach(string tt in temp)
					{
						if(tt==MenuName)
						{
							isChecked=true;
							break;
						}
					}
					rk.Close ();
				}
				return isChecked;
			}
			catch(Exception ee)
			{
				throw ee;
			}
		}
		/// <summary>
		/// 得到注册过的文件类型列表
		/// </summary>
		/// <returns>返回列表</returns>
		public static System.Windows.Forms.ComboBox getFileTypeList()
		{
			System.Windows.Forms.ComboBox cb=new System.Windows.Forms.ComboBox ();
			string [] rk=Registry.ClassesRoot.GetSubKeyNames();
			foreach(string temp in rk)
			{
				if(temp.StartsWith ("."))
				{
					cb.Items.Add ((object)temp);
				}
			}
			return cb;
		}
		/// <summary>
		/// 保存文件右键菜单列表
		/// </summary>
		/// <param name="lv"></param>
		/// <param name="path">保存文件路径</param>
		public static void WriteFileRKMenuList( System.Windows.Forms.ListView lv,string path)
		{
			StreamWriter sw=new StreamWriter(path+"\\FileRKMenuList.dat",false);
			for(int i=0;i<=lv.Items.Count-1;i++)
			{
				sw.WriteLine (lv.Items[i].Text+"|=|"+lv.Items [i].SubItems[1].Text +"|=|"+lv.Items [i].SubItems[2].Text);
			}
			sw.Close ();
		}
		/// <summary>
		/// 读取文件右键菜单列表
		/// </summary>
		/// <param name="lv"></param>
		/// <param name="path">读取文件路径</param>
		public static void ReadFileRKMenuList(ref System.Windows.Forms.ListView lv,string path)
		{
			try
			{
				StreamReader sw=new StreamReader(path+"\\FileRKMenuList.dat");
				while(sw.Peek ()>0)
				{
					string temp=sw.ReadLine ();
					string type="",name="",command="";
					if(temp.Length>9)
					{
						type=temp.Substring (0,temp.IndexOf("|=|"));
						temp=temp.Remove (0,3+type.Length);
						name=temp.Substring (0,temp.IndexOf("|=|"));
						temp=temp.Remove (0,3+name.Length);
						command=temp;
						System.Windows.Forms.ListViewItem lvi=new System.Windows.Forms.ListViewItem (type);
						lvi.SubItems .Add (name);
						lvi.SubItems.Add (command);
						lv.Items .Add (lvi);
					}
				}
			}
			catch
			{
			}
			
		}
		/// <summary>
		/// 保存驱动器及文件夹右键菜单列表
		/// </summary>
		/// <param name="lv"></param>
		/// <param name="path">保存文件路径</param>
		public static void WriteDDRKMenuList( System.Windows.Forms.ListView lv,string path)
		{
			StreamWriter sw=new StreamWriter(path+"\\DDRKMenuList.dat",false);
			for(int i=0;i<=lv.Items.Count-1;i++)
			{
				sw.WriteLine (lv.Items[i].Text+"|=|"+lv.Items [i].SubItems[1].Text);
			}
			sw.Close ();
		}
		/// <summary>
		/// 读取驱动器及文件夹右键菜单列表
		/// </summary>
		/// <param name="lv"></param>
		/// <param name="path">读取文件路径</param>
		public static void ReadDDRKMenuList(ref System.Windows.Forms.ListView lv,string path)
		{
			try
			{
				StreamReader sw=new StreamReader(path+"\\DDRKMenuList.dat");
				while(sw.Peek ()>0)
				{
					string temp=sw.ReadLine ();
					string name="",command="";
					if(temp.Length>9)
					{
						name=temp.Substring (0,temp.IndexOf("|=|"));
						temp=temp.Remove (0,3+name.Length);
						command=temp;
						System.Windows.Forms.ListViewItem lvi=new System.Windows.Forms.ListViewItem (name);
						lvi.SubItems.Add (command);
						lv.Items .Add (lvi);
					}
				}
			}
			catch
			{
			}
			
		}
		#endregion

		#region 优化设置
		//[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
		//"AlwaysUnloadDLL"=dword:00000001
		public static void setcb_1()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\",true);
				rk.SetValue ("AlwaysUnloadDLL",1);
				rk.Close ();
			}
			catch
			{
			}
		}
		public static void Delcb_1()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\",true);
				rk.SetValue ("AlwaysUnloadDLL",0);
				rk.Close ();
			}
			catch
			{
			}
		}
		//[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
		//"SFCDisable"=dword:ffffff9d
		public static void setcb_2()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\",true);
				rk.SetValue ("SFCDisable",(object)int.Parse ("ffffff9d",System.Globalization.NumberStyles.AllowHexSpecifier));
				rk.Close ();
			}
			catch
			{
			}
		}
		public static void Delcb_2()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\",true);
				rk.DeleteValue ("SFCDisable",true);
				rk.Close ();
			}
			catch
			{
			}
		}
		//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
		//"ConfigFileAllocSize"=dword:000001f4
		public static void setcb_3()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SYSTEM\CurrentControlSet\Control\FileSystem\",true);
				rk.SetValue ("ConfigFileAllocSize",(object)int.Parse ("000001f4",System.Globalization.NumberStyles.AllowHexSpecifier));
				rk.Close ();
			}
			catch
			{
			}
		}
		public static void Delcb_3()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SYSTEM\CurrentControlSet\Control\FileSystem\",true);
				rk.DeleteValue  ("ConfigFileAllocSize",true);
				rk.Close ();
			}
			catch
			{
			}
		}
		//[HKEY_CURRENT_USER\Control Panel\Desktop]
		//"MenuShowDelay"="0"
		public static void setcb_4()
		{
			try
			{
				RegistryKey rk=Registry.CurrentUser.OpenSubKey (@"Control Panel\Desktop\",true);
				rk.SetValue ("MenuShowDelay","0");
				rk.Close ();
			}
			catch
			{
			}
		}
		public static void Delcb_4()
		{
			try
			{
				RegistryKey rk=Registry.CurrentUser.OpenSubKey (@"Control Panel\Desktop\",true);
				rk.SetValue ("MenuShowDelay","1");
				rk.Close ();
			}
			catch
			{
			}
		}
		//[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace]
		//[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{2227A280-3AEA-1069-A2DE-08002B30309D}]
		//@="Printers"
		public static void setcb_5()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\",true);
				rk.CreateSubKey ("{2227A280-3AEA-1069-A2DE-08002B30309D}");
				RegistryKey rk2=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{2227A280-3AEA-1069-A2DE-08002B30309D}\",true);
				rk2.SetValue ("","Printers");
				rk2.Close ();
				rk.Close ();
			}
			catch
			{
			}
		}
		public static void Delcb_5()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\",true);
				rk.DeleteSubKeyTree("{2227A280-3AEA-1069-A2DE-08002B30309D}");
				rk.Close ();
			}
			catch
			{
			}
		}
		//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
		//"IPEnableRouter"=dword:00000001
		//"EnableSecurityFilters"=dword:00000001
		public static void setcb_6()
		{
			try
			{
				RegistryKey rk=Registry.LocalMachine.OpenSubKey (@"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\",true);
				rk.SetValue ("IPEnableRouter",1);
				rk.SetValue ("EnableSecurityFilters",1);
				rk.Close ();
			}
			catch

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -