/// <summary> /// 添加资源到迅雷 /// </summary> /// <param name="src"></param> public static void AddTaskToThunder(MovieInfo info) { AgentClass agent = new AgentClass(); agent.AddTask(info.Link, info.Title); agent.CommitTasks(); }
public void Fire() { AgentClass agent; try { agent = new AgentClass(); } catch (Exception e) { ErrorDialog.Report(Strings.Call_Thunder_Error_Agent + "\n" + e.Message + "\n" + e.StackTrace); return; } try { Type type = typeof(AgentClass); var method = type.GetMethod("AddTask12"); //only on x86 method.Invoke(agent, new object[] { Url, FileName, "", PostData.ToString(), Refer, "", -1, 0, -1, Cookie, "", "", 0u, "rightup" }); } catch (Exception) { try { agent.AddTask5(bstrUrl: Url, bstrFileName: FileName, bstrCookie: Cookie, bstrReferUrl: Refer, bstrComments: PostData.ToString(), eCallType: _tag_Enum_CallType.ECT_Agent5); } catch (Exception) { try { agent.AddTask(bstrUrl: Url, bstrFileName: FileName, bstrReferUrl: Refer, bstrComments: PostData.ToString()); } catch (Exception e) { ErrorDialog.Report(Strings.Call_Thunder_Error_Agent + "\n" + e.Message + "\n" + e.StackTrace); return; } } } try { agent.CommitTasks4(1, 1); } catch (Exception e) { ErrorDialog.Report(Strings.Call_Thunder_Error_Agent + (Environment.Is64BitProcess?Strings.Recommand_32bit:"") + e.Message + "\n" + e.StackTrace); return; } }
public void Fire() { AgentClass agent; try { agent = new AgentClass(); } catch (Exception e) { MessageBox.Show(Strings.Call_Thunder_Error_Agent + "\n" + e.Message + "\n" + e.StackTrace); return; } try { agent.AddTask3(bstrUrl: Url, bstrFileName: FileName); } catch (Exception) { try { agent.AddTask(bstrUrl: Url, bstrFileName: FileName); } catch (Exception e) { MessageBox.Show(Strings.Call_Thunder_Error_Agent + "\n" + e.Message + "\n" + e.StackTrace); return; } } try { agent.CommitTasks4(1, 0); } catch (Exception) { try { agent.CommitTasks(); } catch (Exception e) { MessageBox.Show(Strings.Call_Thunder_Error_Agent + "\n" + e.Message + "\n" + e.StackTrace); return; } } }
private void btnDownload_Click(object sender, EventArgs e) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_url); HttpWebResponse response = null; Stream receiveStream = null; try { #if DEBUG FileStream fs = new FileStream(@"./test.xml", FileMode.Open); receiveStream = fs; #else request.MaximumAutomaticRedirections = 4; request.MaximumResponseHeadersLength = 4; request.Credentials = CredentialCache.DefaultCredentials; response = (HttpWebResponse)request.GetResponse(); receiveStream = response.GetResponseStream(); #endif XmlDocument xml = new XmlDocument(); XmlNodeList xmllist = null; xml.Load(receiveStream); xmllist = xml.SelectNodes("//channel/item"); AgentClass ac = new AgentClass(); foreach (XmlNode node in xmllist) { string url = node.SelectSingleNode("link").InnerText; string[] temp = url.Split('/'); string fileName = temp[temp.Length - 1].Replace("m4v", "mp4"); if (File.Exists(_savePath + fileName)) continue; ac.AddTask(url, fileName, @"F:\ENGLISH\StudentNews\", string.Empty, string.Empty, 0, 0, 0); } ac.CommitTasks(); } finally { if (response != null) response.Close(); if (receiveStream != null) receiveStream.Close(); } }