防止内置的fiddler核心自己导致软件闪退。

This commit is contained in:
wule committed 2025-10-03 18:46:50 +08:00
1 parent e25cc1b51e
commit 61264a5a99
3 files changed
+38 -8

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary> /// <summary>
/// 版本ID /// 版本ID
/// </summary> /// </summary>
public static int VersionCount = 615; public static int VersionCount = 616;
//public static int VersionCount = 613; //public static int VersionCount = 613;
/// <summary> /// <summary>
+8 -1
View File
@@ -269,6 +269,12 @@ namespace TemuKJD
private void AutoGC() private void AutoGC()
{ {
if (PDDShopUpdateFddlCookieForm.instance == null || !PDDShopUpdateFddlCookieForm.instance.IsDisposed)
{
PDDShopUpdateFddlCookieForm.instance = new PDDShopUpdateFddlCookieForm(null);
PDDShopUpdateFddlCookieForm.instance.fddlHelper.StartupFiddlerCore();
PDDShopUpdateFddlCookieForm.instance.fddlHelper.UninstallFiddler();
}
DateTime lastClear = DateTime.Now; DateTime lastClear = DateTime.Now;
while (true) while (true)
{ {
@@ -316,7 +322,8 @@ namespace TemuKJD
//Gate 1 - Anti Proxy //Gate 1 - Anti Proxy
if (IsUseSystemProxy()) if (IsUseSystemProxy())
{ {
LockUserAndKillProcess(); if (PDDShopUpdateFddlCookieForm.instance == null || !PDDShopUpdateFddlCookieForm.instance.Created)
LockUserAndKillProcess();
} }
//Gate 2 - Anti Special Processes //Gate 2 - Anti Special Processes
@@ -27,9 +27,11 @@ namespace TemuKJD.PDDForms.ShopForms
ShopLoginInfo shop = null; ShopLoginInfo shop = null;
SetCookieFromEnum updateFrom; SetCookieFromEnum updateFrom;
public FddlHelper fddlHelper = new FddlHelper(); public FddlHelper fddlHelper = new FddlHelper();
public static PDDShopUpdateFddlCookieForm instance;
public PDDShopUpdateFddlCookieForm(ShopLoginInfo _shop, SetCookieFromEnum from = SetCookieFromEnum.normal_user) public PDDShopUpdateFddlCookieForm(ShopLoginInfo _shop, SetCookieFromEnum from = SetCookieFromEnum.normal_user)
{ {
instance = this;
InitializeComponent(); InitializeComponent();
shop = _shop; shop = _shop;
updateFrom = from; updateFrom = from;
@@ -101,7 +103,18 @@ namespace TemuKJD.PDDForms.ShopForms
return; return;
} }
FiddlerApplication.BeforeRequest -= FiddlerApplication_BeforeRequest;
if (this.Created && !this.Disposing && !this.IsDisposed)
{
// 窗口存在
}
else
{
// 窗口关闭
return;
}
FiddlerApplication.BeforeRequest -= FiddlerApplication_BeforeRequest;
string JSESSIONID = BaseRegex.GetStringCookie(ref headerCookie, "JSESSIONID").ParseToString().Trim('\'', '\n', '\r'); string JSESSIONID = BaseRegex.GetStringCookie(ref headerCookie, "JSESSIONID").ParseToString().Trim('\'', '\n', '\r');
string _nano_fp = BaseRegex.GetStringCookie(ref headerCookie, "_nano_fp").ParseToString().Trim('\'', '\n', '\r'); string _nano_fp = BaseRegex.GetStringCookie(ref headerCookie, "_nano_fp").ParseToString().Trim('\'', '\n', '\r');
@@ -170,6 +183,14 @@ namespace TemuKJD.PDDForms.ShopForms
var data = ""; var data = "";
data = PDDShopListForm.GetShopStatus(cookieShop); data = PDDShopListForm.GetShopStatus(cookieShop);
if (data.Contains("基础连接已关闭"))
{
data = PDDShopListForm.GetShopStatus(cookieShop);
}
if (data.Contains("基础连接已关闭"))
{
data = PDDShopListForm.GetShopStatus(cookieShop);
}
if (!data.Contains("\"success\":true") || data.Contains("会话已过期")) if (!data.Contains("\"success\":true") || data.Contains("会话已过期"))
{ {
Invoke(new Action(() => Invoke(new Action(() =>
@@ -252,16 +273,18 @@ namespace TemuKJD.PDDForms.ShopForms
PDDShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,不同账号下的同名店铺一起更新cookie PDDShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,不同账号下的同名店铺一起更新cookie
Invoke(new Action(() => if (this.Created && !this.Disposing && !this.IsDisposed)
{ Invoke(new Action(() =>
this.OnSaveComplete(shop); {
this.Close(); this.OnSaveComplete(shop);
})); this.Close();
}));
} }
} }
private void PDDShopUpdateFddlCookieForm_FormClosed(object sender, FormClosedEventArgs e) private void PDDShopUpdateFddlCookieForm_FormClosed(object sender, FormClosedEventArgs e)
{ {
fddlHelper.UninstallFiddler();
} }
private void PDDShopUpdateFddlCookieForm_FormClosing(object sender, FormClosingEventArgs e) private void PDDShopUpdateFddlCookieForm_FormClosing(object sender, FormClosingEventArgs e)