Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
支持付费 Mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
lslqtz authored Apr 15, 2018
1 parent 4d732e4 commit d30e278
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions osu-download/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Win32;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -56,8 +56,17 @@ static void Main(string[] args)
{
string Author = "asd";
string ProgramTitle = "osu! 镜像下载客户端";
string CurDLClientVer = "b20180326.1";
string CurDLClientVer = "b20180415.1";
string InstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "osu!");
string[] License = null;
if (File.Exists("License"))
{
License = File.ReadAllText("License").Split(':');
if (License.Length != 2)
{
License = null;
}
}
Console.Title = ProgramTitle;
Console.WriteLine(string.Format("欢迎使用由 {0} 提供的 {1}!", Author, ProgramTitle));
Console.WriteLine("[广告/反馈] QQ群:132783429");
Expand Down Expand Up @@ -110,7 +119,7 @@ static void Main(string[] args)
try
{
Console.WriteLine("正在获取 Mirror...");
HttpWebRequest MirrorRequest = WebRequest.Create("https://www.userpage.me/osu-update.php?om=1&v=" + CurDLClientVer) as HttpWebRequest;
HttpWebRequest MirrorRequest = WebRequest.Create("https://www.userpage.me/osu-update.php?" + string.Format("om=1&v={0}", CurDLClientVer) + ((License != null) ? "&p=1" : "")) as HttpWebRequest;
MirrorRequest.Method = "GET";
MirrorRequest.Timeout = 10000;
HttpWebResponse MirrorWebResponse = MirrorRequest.GetResponse() as HttpWebResponse;
Expand Down Expand Up @@ -224,7 +233,7 @@ static void Main(string[] args)
}
Console.WriteLine(string.Format("正在" + isUpdate + ":{0}...", filearr[1]));
WebClient wc = new WebClient();
wc.DownloadFile(CurMirror + uri, filepath);
wc.DownloadFile(CurMirror + uri + ((License != null) ? string.Format("?u={0}&h={1}",License[0],License[1]) : ""), filepath);
if (filearr[0].ToLower() != GetFileHash(filepath))
{
File.Delete(filepath);
Expand Down

0 comments on commit d30e278

Please sign in to comment.