예제 #1
0
        public void Perform()
        {
            switch (Agent)
            {
            case DLAgent.Thunder:
            {
                DMThunder dm = new DMThunder
                {
                    Url      = Request.Url,
                    FileName = Request.Filename,
                    Cookie   = Request.Cookie
                };
                dm.Fire();
            }
            break;

            case DLAgent.EagleGet:
            {
                DMEagleGet dm = new DMEagleGet
                {
                    Url      = Request.Url,
                    FileName = Request.Filename,
                    Cookie   = Request.Cookie
                };
                dm.Fire();
            }
            break;
            }
        }
예제 #2
0
		static void Main(string[] args)
		{
			Application.EnableVisualStyles();
			if (args.Length > 0)
			{
				switch(args[0].ToLower())
				{
					case "breaked":
						{
							NamedPipeClientStream aPipeClient = new NamedPipeClientStream(args[1]);
							BinaryReader br = new BinaryReader(aPipeClient);
							aPipeClient.Connect(5000);
							string sTask = br.ReadString();
							aPipeClient.Close();
							DLTask dt = JsonConvert.DeserializeObject<DLTask>(sTask);
							dt.Perform();
							break;
						}
					case "fix":
						{
							string thunderexe = args[1];
							string thunderagentdll = args[2];
							string thunderagent64bit = thunderagentdll.ToLower().Replace("thunderagent.dll", "thunderagent64.dll");
							Stack<string> tpaths = new Stack<string>(thunderexe.Split('\\'));
							tpaths.Pop();
							if (tpaths.Peek().ToLower() == "program")
								tpaths.Pop();
							string thunderroot = string.Join("\\", tpaths.Reverse())+"\\";
							string version = FileVersionInfo.GetVersionInfo(thunderexe).FileVersion.Replace(',','.');
							if (Environment.Is64BitOperatingSystem && Environment.Is64BitProcess)
							{
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd", "dir", thunderroot, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd", "Path", thunderexe, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd", "instdir", thunderroot, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd", "Version", version, RegistryValueKind.String);
							}
							else
							{
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Thunder Network\ThunderOem\thunder_backwnd", "dir", thunderroot, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Thunder Network\ThunderOem\thunder_backwnd", "Path", thunderexe, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Thunder Network\ThunderOem\thunder_backwnd", "instdir", thunderroot, RegistryValueKind.String);
								Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Thunder Network\ThunderOem\thunder_backwnd", "Version", version, RegistryValueKind.String);
							}
							Process.Start("regsvr32", "/s \"" + thunderagentdll + "\"");
							if (Environment.Is64BitOperatingSystem && File.Exists(thunderagent64bit))
							{
								Process.Start("regsvr32", "/s \"" + thunderagent64bit + "\"");
							}
							else
							{
								MessageBox.Show((IWin32Window)null,Strings.This_copy_of_Thunder_supports_32_bit_only);
							}
							break;
						}
					default:
						{
							Web_ext_Message msg = GetMsg();
							DLRequest req = msg.Dispatch();
							DLReply reply = req.Process();
							SendMsg(reply);
							break;
						}
				}
			}
			else
			{
				DMThunder dM = new DMThunder
				{
					Url = "http://baidu.com/index.html",
					PostData = new PostInfo()
				};
				dM.Fire();
				WelcomeDialog dialog = new WelcomeDialog();
				dialog.ShowDialog();
			}
		}