You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.IO;
|
|
|
|
namespace AutoUpdater
|
|
{
|
|
public class DownloadURL
|
|
{
|
|
private string url = string.Empty;
|
|
|
|
private string dest = string.Empty;
|
|
|
|
public long Size { get; set; }
|
|
|
|
|
|
public DownloadURL(string url)
|
|
{
|
|
this.url = url;
|
|
}
|
|
public DownloadURL(string url, string dest)
|
|
{
|
|
this.url = url;
|
|
this.dest = dest;
|
|
}
|
|
public DownloadURL()
|
|
{
|
|
|
|
}
|
|
|
|
public string URL
|
|
{
|
|
get
|
|
{
|
|
return Uri.UnescapeDataString(url);
|
|
|
|
//return System.Net.WebUtility.UrlDecode(url, System.Text.Encoding.GetEncoding("GB2312"));
|
|
}
|
|
}
|
|
|
|
public string Destination
|
|
{
|
|
get
|
|
{
|
|
if (Path.GetFileName(dest) == string.Empty || Directory.Exists(dest))
|
|
{
|
|
Uri uri = new Uri(url);
|
|
dest = Path.Combine(dest, uri.Segments[uri.Segments.Length - 1].ToString());
|
|
}
|
|
return dest;
|
|
}
|
|
set
|
|
{
|
|
dest = value;
|
|
}
|
|
}
|
|
}
|
|
}
|