Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions WinRAR-Extractor/frmExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -43,23 +44,23 @@ private void btnRefresh_Click(object sender, EventArgs e)
string freeUrl_x64 = string.Empty;

Match white14Link = Regex.Match(html,
"(?<=<a href=\"https://www.win-rar.com/fileadmin/winrar-versions/winrar/)winrar-x(32|64)-[0-9]+sc.exe(?=\">WinRAR (.+?) Chinese Simplified (32|64) bit</a>)",
"(?<=<a href=\"https://www.win-rar.com/fileadmin/winrar-versions/)winrar-x(32|64)-[0-9]+tc.exe(?=\">WinRAR (.+?) Chinese Traditional (32|64) bit</a>)",
RegexOptions.Multiline | RegexOptions.Singleline);
//Console.WriteLine(white14Link.Groups.Count);

while (white14Link.Success)
{
//Console.WriteLine(white14Link.Value);
int result = 0, bit = 0;
Match versionLink = Regex.Match(white14Link.Value, "(?<=winrar-x(32|64)-).+?(?=sc.exe)");
Match versionLink = Regex.Match(white14Link.Value, "(?<=winrar-x(32|64)-).+?(?=tc.exe)");
//Console.WriteLine(versionLink.Value);

if (int.TryParse(versionLink.Value, out result))
{
if (version <= result)
{
version = result;
Match bitLink = Regex.Match(white14Link.Value, $"(?<=winrar-x).+?(?=-{version}sc.exe)");
Match bitLink = Regex.Match(white14Link.Value, $"(?<=winrar-x).+?(?=-{version}tc.exe)");
//Console.WriteLine(bitLink.Value);

string downloadLink = white14Link.Value;
Expand All @@ -78,20 +79,37 @@ private void btnRefresh_Click(object sender, EventArgs e)
white14Link = white14Link.NextMatch();
}

string lastSCname_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/winrar/{freeUrl_x86}";
string lastModified_x86 = HttpWebHelper.GetHttpWebData(lastSCname_x86, 3000, null, true);
string lastName_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/{freeUrl_x86}";
string lastModified_x86 = HttpWebHelper.GetHttpWebData(lastName_x86, 3000, null, true);
//Console.WriteLine(lastModified_x86);

string lastSCname_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/winrar/{freeUrl_x64}";
string lastModified_x64 = HttpWebHelper.GetHttpWebData(lastSCname_x64, 3000, null, true);
string lastName_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/{freeUrl_x64}";
string lastModified_x64 = HttpWebHelper.GetHttpWebData(lastName_x64, 3000, null, true);
//Console.WriteLine(lastModified_x64);

this.labVersion.Text = $"最新版本:[{version}],更新时间:[{lastModified_x86}]-[x86] / [{lastModified_x64}]-[x64] - [简体中文]";
freeUrl_x86 = freeUrl_x86.Replace("tc", "sc");
freeUrl_x64 = freeUrl_x64.Replace("tc", "sc");

string rrlb_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified_x86}/rrlb/{freeUrl_x86}";
string rrlb_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified_x64}/rrlb/{freeUrl_x64}";
string wrr_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified_x86}/wrr/{freeUrl_x86}";
string wrr_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified_x64}/wrr/{freeUrl_x64}";
string lastModified = string.Empty;

DateTime publishDate = DateTime.ParseExact(lastModified_x64, "yyyyMMdd", DateTimeFormatInfo.CurrentInfo);
for (int i = 0; i < 7; ++i)
{
lastModified = publishDate.AddDays(i).ToString("yyyyMMdd");
string wrr = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified}/wrr/{freeUrl_x64}";
if(HttpWebHelper.GetHttpWebData(wrr, 3000, null, true).Equals(lastModified))
{
break;
}
lastModified = string.Empty;
}

this.labVersion.Text = $"最新版本:[{version}],更新时间:[{lastModified}]-[x86] / [{lastModified}]-[x64] - [简体中文]";

string rrlb_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified}/rrlb/{freeUrl_x86}";
string rrlb_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified}/rrlb/{freeUrl_x64}";
string wrr_x86 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified}/wrr/{freeUrl_x86}";
string wrr_x64 = $"https://www.win-rar.com/fileadmin/winrar-versions/sc/sc{lastModified}/wrr/{freeUrl_x64}";

this.tbrrlbx86.Text = rrlb_x86;
this.tbrrlbx64.Text = rrlb_x64;
Expand Down