mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2025-05-24 22:46:06 +08:00
[+] 修改补丁获取方式,添加补丁版本信息
This commit is contained in:
parent
37bab09a7d
commit
c83e12f9f7
File diff suppressed because one or more lines are too long
|
@ -17,6 +17,7 @@ namespace RevokeMsgPatcher
|
||||||
{
|
{
|
||||||
Apps = AppConfig(),
|
Apps = AppConfig(),
|
||||||
LatestVersion = "1.2",
|
LatestVersion = "1.2",
|
||||||
|
PatchVersion = 20220325,
|
||||||
Notice = ""
|
Notice = ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,13 @@ namespace RevokeMsgPatcher
|
||||||
|
|
||||||
private readonly GAHelper ga = GAHelper.Instance; // Google Analytics 记录
|
private readonly GAHelper ga = GAHelper.Instance; // Google Analytics 记录
|
||||||
|
|
||||||
|
Bag bag = null;
|
||||||
|
|
||||||
public void InitModifier()
|
public void InitModifier()
|
||||||
{
|
{
|
||||||
// 从配置文件中读取配置
|
// 从配置文件中读取配置
|
||||||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
||||||
Bag bag = serializer.Deserialize<Bag>(Properties.Resources.PatchJson);
|
bag = serializer.Deserialize<Bag>(Properties.Resources.PatchJson);
|
||||||
|
|
||||||
// 初始化每个应用对应的修改者
|
// 初始化每个应用对应的修改者
|
||||||
wechatModifier = new WechatModifier(bag.Apps["Wechat"]);
|
wechatModifier = new WechatModifier(bag.Apps["Wechat"]);
|
||||||
|
@ -275,28 +277,36 @@ namespace RevokeMsgPatcher
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
||||||
Bag bag = serializer.Deserialize<Bag>(json);
|
Bag newBag = serializer.Deserialize<Bag>(json);
|
||||||
|
|
||||||
wechatModifier.Config = bag.Apps["Wechat"];
|
if (Convert.ToDecimal(newBag.LatestVersion) > Convert.ToDecimal(thisVersion))
|
||||||
qqModifier.Config = bag.Apps["QQ"];
|
|
||||||
timModifier.Config = bag.Apps["TIM"];
|
|
||||||
qqLiteModifier.Config = bag.Apps["QQLite"];
|
|
||||||
|
|
||||||
if (Convert.ToDecimal(bag.LatestVersion) > Convert.ToDecimal(thisVersion))
|
|
||||||
{
|
{
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
lblUpdatePachJson.Text = $"[ 存在最新版本 {bag.LatestVersion} ]";
|
lblUpdatePachJson.Text = $"[ 存在最新版本 {newBag.LatestVersion} ]";
|
||||||
lblUpdatePachJson.ForeColor = Color.Red;
|
lblUpdatePachJson.ForeColor = Color.Red;
|
||||||
}
|
}
|
||||||
else
|
else if(bag.PatchVersion == 0 || newBag.PatchVersion > bag.PatchVersion)
|
||||||
{
|
{
|
||||||
needUpdate = false;
|
needUpdate = false;
|
||||||
lblUpdatePachJson.Text = "[ 获取成功,点击查看更多信息 ]";
|
lblUpdatePachJson.Text = "[ 获取成功,点击查看更多信息 ]";
|
||||||
lblUpdatePachJson.ForeColor = Color.RoyalBlue;
|
lblUpdatePachJson.ForeColor = Color.RoyalBlue;
|
||||||
}
|
|
||||||
|
wechatModifier.Config = newBag.Apps["Wechat"];
|
||||||
|
qqModifier.Config = newBag.Apps["QQ"];
|
||||||
|
timModifier.Config = newBag.Apps["TIM"];
|
||||||
|
qqLiteModifier.Config = newBag.Apps["QQLite"];
|
||||||
|
|
||||||
getPatchJsonStatus = "SUCCESS";
|
getPatchJsonStatus = "SUCCESS";
|
||||||
InitControls();
|
InitControls();
|
||||||
}
|
}
|
||||||
|
else if (newBag.PatchVersion < bag.PatchVersion)
|
||||||
|
{
|
||||||
|
needUpdate = false;
|
||||||
|
lblUpdatePachJson.Text = "[ 软件内置补丁信息已经是最新 ]";
|
||||||
|
lblUpdatePachJson.ForeColor = Color.RoyalBlue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
Console.WriteLine(ex.Message);
|
||||||
|
|
|
@ -13,5 +13,7 @@ namespace RevokeMsgPatcher.Model
|
||||||
public string LatestVersion { get; set; }
|
public string LatestVersion { get; set; }
|
||||||
|
|
||||||
public string Notice { get; set; }
|
public string Notice { get; set; }
|
||||||
|
|
||||||
|
public int PatchVersion { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,33 +23,37 @@ namespace RevokeMsgPatcher.Utils
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly string[] urls = new string[]
|
private static readonly string[] urls = new string[]
|
||||||
{
|
{
|
||||||
|
"https://gitee.com/huiyadanli/RevokeMsgPatcher/raw/master/RevokeMsgPatcher.Assistant/Data/1.2/patch.json",
|
||||||
"https://huiyadanli.coding.net/p/RevokeMsgPatcher/d/RevokeMsgPatcher/git/raw/master/RevokeMsgPatcher.Assistant/Data/1.2/patch.json",
|
"https://huiyadanli.coding.net/p/RevokeMsgPatcher/d/RevokeMsgPatcher/git/raw/master/RevokeMsgPatcher.Assistant/Data/1.2/patch.json",
|
||||||
"https://raw.githubusercontent.com/huiyadanli/RevokeMsgPatcher/master/RevokeMsgPatcher.Assistant/Data/1.2/patch.json"
|
"https://raw.githubusercontent.com/huiyadanli/RevokeMsgPatcher/master/RevokeMsgPatcher.Assistant/Data/1.2/patch.json"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static int i = 0;
|
|
||||||
|
|
||||||
public static async Task<string> GetPatchJsonAsync()
|
public static async Task<string> GetPatchJsonAsync()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (i < urls.Length)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await Client.GetStringAsync(urls[i]);
|
string json = await Client.GetStringAsync(urls[i]);
|
||||||
|
if (!string.IsNullOrEmpty(json) && json.Contains("LatestVersion"))
|
||||||
|
{
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("第" + (i + 1) + "次请求获得的数据并非期望数据\nURL:" + urls[i]);
|
||||||
|
GAHelper.Instance.RequestPageView($"/main/json/request_ex/{i + 1}/not_my_json", "第" + (i + 1) + "次请求获得的数据并非期望数据");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("第" + (i + 1) + "次请求异常:[" + ex.Message + "]\nURL:" + urls[i]);
|
Console.WriteLine("第" + (i + 1) + "次请求异常:[" + ex.Message + "]\nURL:" + urls[i]);
|
||||||
GAHelper.Instance.RequestPageView($"/main/json/request_ex/{i + 1}/{ex.Message}", "第" + (i + 1) + "次请求异常:[" + ex.Message + "]");
|
GAHelper.Instance.RequestPageView($"/main/json/request_ex/{i + 1}/{ex.Message}", "第" + (i + 1) + "次请求异常:[" + ex.Message + "]");
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
if (i >= urls.Length)
|
}
|
||||||
{
|
|
||||||
i = 0;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return await GetPatchJsonAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user