public DLReply Ask() { Filename = System.Net.WebUtility.UrlDecode(Filename); TryPatchBaiduFileName(); ContentType = ContentType.Split(';')[0]; AskDL askDL = new AskDL(this); askDL.ShowDialog(); if (askDL.DialogResult == DialogResult.OK) { switch (askDL.RetAgent) { case DLAgent.Default: break; case DLAgent.Thunder: case DLAgent.EagleGet: case DLAgent.Idm: case DLAgent.Customized: { ChainStart(askDL.RetAgent); } break; default: break; } } DLReply reply = new DLReply(askDL.RetAgent, askDL.SaveDownload, askDL.SavedHost); return(reply); }
public DLReply Ask() { Filename = System.Net.WebUtility.UrlDecode(Filename); AskDL askDL = new AskDL(this); askDL.ShowDialog(); if (askDL.DialogResult == DialogResult.OK) { switch (askDL.RetAgent) { case DLAgent.Default: break; case DLAgent.Thunder: case DLAgent.EagleGet: { string pipeName = Guid.NewGuid().ToString().Replace("-", string.Empty); PipeSecurity ps = new PipeSecurity(); ps.AddAccessRule(new PipeAccessRule("Users", PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow)); aPipeServer = new NamedPipeServerStream(pipeName, PipeDirection.InOut, 10, PipeTransmissionMode.Message, PipeOptions.WriteThrough, 1024, 1024, ps); string command = "\"" + Application.ExecutablePath + "\"" + ' ' + "breaked" + ' ' + pipeName; ProcessUtility.CreateProcessBreakFromJob(command); DLTask task = new DLTask { Request = this, Agent = askDL.RetAgent }; string sTask = JsonConvert.SerializeObject(task); aPipeServer.WaitForConnection(); BinaryWriter bw = new BinaryWriter(aPipeServer); bw.Write(sTask); } break; default: break; } } if (aPipeServer != null) { aPipeServer.WaitForPipeDrain(); } return(new DLReply(askDL.RetAgent)); }