本文整理汇总了C#中WebDownload类的典型用法代码示例。如果您正苦于以下问题:C# WebDownload类的具体用法?C# WebDownload怎么用?C# WebDownload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebDownload类属于命名空间,在下文中一共展示了WebDownload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotifyDecideDestinationWithSuggestedFilename
internal void NotifyDecideDestinationWithSuggestedFilename(WebDownload download, string fileName)
{
if (FilePath.Length != 0)
download.setDestination(FilePath, 1);
else
download.setDestination(fileName, 1);
}
示例2: Setup
public void Setup()
{
MockBuild buildEngine = new MockBuild();
testDirectory = TaskUtility.makeTestDirectory(buildEngine);
task = new WebDownload();
task.BuildEngine = new MockBuild();
}
示例3: PackageDownload
public PackageDownload(string urlRoot, string displayName, Hash hash, SpringPaths paths)
{
this.paths = paths;
this.urlRoot = urlRoot;
pool = new Pool(paths);
PackageHash = hash;
Name = displayName;
fileListWebGet = new WebDownload();
}
示例4: WebDownloadExecute
public void WebDownloadExecute()
{
WebDownload task = new WebDownload();
task.BuildEngine = new MockBuild();
task.FileUri = "http://www.microsoft.com/default.aspx";
string downloadFile = Path.Combine(testDirectory, "microsoft.html");
task.FileName = downloadFile;
Assert.IsTrue(task.Execute(), "Execute Failed");
Assert.IsTrue(File.Exists(downloadFile), "No download file");
}
示例5: PassArguments
public void PassArguments(string filename, Int64 filesize, WebDownload d)
{
this.Size = filesize;
this.File = filename;
this.download = d;
this.FileForDownloading = filename + ".download";
label5.Text = "Size: " + Size.ToString();
label2.Text = Path.GetFileName(File);
progressBar1.Maximum = Convert.ToInt32(filesize);
progressBar1.Minimum = 0;
UpdateProgress.Enabled = true;
}
示例6: gv_RowCommand
protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
{
Int32 index = 0;
if (!Int32.TryParse("" + e.CommandArgument, out index)) index = -1;
Int32 id = index >= 0 ? (Int32)gv.DataKeys[index][0] : 0;
DataModel md = DataModel.FindByID(id);
if (md != null)
{
if (e.CommandName == "ExportXml")
{
String xml = md.ExportXml();
if (!String.IsNullOrEmpty(xml))
{
//MemoryStream ms = new MemoryStream();
//EntityAccessorFactory.Create(EntityAccessorTypes.Xml)
// .SetConfig(EntityAccessorOptions.Stream, ms)
// .Write(md, null);
//ms.Position = 0;
WebDownload wd = new WebDownload();
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
wd.Stream = ms;
wd.FileName = md.Name + ".xml";
wd.Mode = WebDownload.DispositionMode.Attachment;
wd.Render();
Response.End();
}
}
else if (e.CommandName == "ExportZip")
{
MemoryStream ms = new MemoryStream();
md.ExportZip(ms);
WebDownload wd = new WebDownload();
wd.Stream = ms;
wd.FileName = md.Name + ".zip";
wd.Mode = WebDownload.DispositionMode.Attachment;
wd.Render();
Response.End();
}
}
}
示例7: downloadDelegate_DecideDestinationWithSuggestedFilename
private void downloadDelegate_DecideDestinationWithSuggestedFilename(WebDownload download, string fileName)
{
download.setDeletesFileUponFailure(1);
if (string.IsNullOrEmpty(fileName) == false)
{
string url = download.request().url();
if (GlobalPreferences.WillHandleDownloadsManually)
{
FileDownloadBeginEventArgs args = new FileDownloadBeginEventArgs(download.request().url(), fileName, download);
DownloadBegin(this, args);
}
else
{
if (!(canornot == download))
{
canornot = download;
candownload = "yes";
}
else { canornot = null; }
if (!url.StartsWith("file://"))
foreach (Form hello in Application.OpenForms)
{
if (hello.Name == "MainDownloadForm")
{
candownload = "no";
}
}
if (candownload == "yes")
{
MyDownloader.App.UI.MainDownloadForm newd = new MyDownloader.App.UI.MainDownloadForm();
newd.Show();
newd.downloadList1.NewFileDownload(url, fileName, true, false);
}
else
{
((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).Show();
((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).downloadList1.NewFileDownload(url, fileName, true, false);
}
download.cancelForResume();
}
}
}
示例8: downloadDelegate_DidReceiveResponse
private void downloadDelegate_DidReceiveResponse(WebDownload download, WebURLResponse response)
{
downloads[download].NotifyDidReceiveResponse(download, response);
}
示例9: downloadDelegate_DecideDestinationWithSuggestedFilename
private void downloadDelegate_DecideDestinationWithSuggestedFilename(WebDownload download, string fileName)
{
downloads[download].NotifyDecideDestinationWithSuggestedFilename(download, fileName);
}
示例10: downloadDelegate_DidFinish
private void downloadDelegate_DidFinish(WebDownload download)
{
downloads[download].NotifyDidFinish(download);
// remove from list
downloads.Remove(download);
}
示例11: willSendRequest
public void willSendRequest(WebDownload download, WebMutableURLRequest request, WebURLResponse redirectResponse, out WebMutableURLRequest finalRequest)
{
finalRequest = request;
}
示例12: willResumeWithResponse
public void willResumeWithResponse(WebDownload download, WebURLResponse response, long fromByte)
{
WillResumeWithResponse(download, response, fromByte);
}
示例13: shouldDecodeSourceDataOfMIMEType
public int shouldDecodeSourceDataOfMIMEType(WebDownload download, string encodingType)
{
// TODO
return 0;
}
示例14: didReceiveResponse
public void didReceiveResponse(WebDownload download, WebURLResponse response)
{
DidReceiveResponse(download, response);
}
示例15: didReceiveDataOfLength
public void didReceiveDataOfLength(WebDownload download, uint length)
{
DidReceiveDataOfLength(download, length);
}