Skip to content

Commit

Permalink
排除注释sign影响,修复链接解析
Browse files Browse the repository at this point in the history
  • Loading branch information
SDchao committed Apr 4, 2020
1 parent d17eaf5 commit a2e5511
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions AutoVsCEnv_WPF/Operators/LanzouLinkResolutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static string SolveDownloadUrl(string downloadPageUrl)
string data = "";

// 获取data值
Regex dataRegex = new Regex("[^/][^/]data : (.*?,'sign':(.*?),.*?})");
Regex dataRegex = new Regex("[^/]{2}data : (.*?,'sign':(.*?),.*?})");
Match dataMatch = dataRegex.Match(content);

if (dataMatch.Success)
Expand All @@ -41,13 +41,13 @@ private static string SolveDownloadUrl(string downloadPageUrl)
sign = dataMatch.Groups[2].Value;

//根据Sign获取Sign值
Regex signRegex = new Regex("var " + sign + " *?= *?'(.*?)';");
Regex signRegex = new Regex("[^/]{2}var " + sign + " *?= *?'(.*?)';");
Match signMatch = signRegex.Match(content);

if(signMatch.Success)
{
signValue = signMatch.Groups[1].Value;
data = data.Replace(sign, "'" + signValue + "'");
data = data.Replace("'sign':" + sign, "'sign':'" + signValue + "'");
}
else
{
Expand All @@ -60,10 +60,16 @@ private static string SolveDownloadUrl(string downloadPageUrl)
}

//转化data为键值对
data = Json2FormData(data);
try
{
data = Json2FormData(data);
}
catch (Exception)
{
throw new Exception("无法转化data为Json:\n" + data + "\n" + sign + ": " + signValue);
}

data = Encoding.UTF8.GetString(Encoding.Default.GetBytes(data));

string phpContent = PostAjax(data, downloadPageUrl);
string finalUrl = "";
Regex domRegex = new Regex("\"dom\":\"(.*)\",\"url\"");
Expand Down
2 changes: 1 addition & 1 deletion AutoVsCEnv_WPF/Operators/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AutoVsCEnv_WPF.Operators
{
internal class UpdateChecker
{
private const string version = "1.94";
private const string version = "1.95";
private const string checkPage = "https://gitee.com/SDchao/AutoVsCEnv_WPF/raw/master/AutoVsCEnv_WPF/Operators/UpdateChecker.cs";

public static bool HasUpdate()
Expand Down

0 comments on commit a2e5511

Please sign in to comment.