代理版本调试

This commit is contained in:
wule_5900x committed 2026-07-05 22:53:54 +08:00
1 parent 0b325e7cd8
commit 8ff2508632
36 files changed
+1049 -342

No files matched your search

+219 -2
View File
@@ -34,7 +34,8 @@ namespace TemuKJD
public static bool IsShopInit = false;
public static void Init()
{
InitOem();
//InitOem();
//InitOemNew();
InitProxy();
@@ -263,6 +264,222 @@ namespace TemuKJD
}
}
/// <summary>
/// 贴牌管理
/// </summary>
public static void InitOemNew()
{
#region 代理版本获取代理码
if (File.Exists("locales/io.pak"))
{
//var s = Randomx.GetWordWithNumber(585179);
var ioTxt = FileBase.ReadAllText("locales/io.pak");
if (ioTxt.StartsWith("MThd") || !ioTxt.Contains("MThd"))
return;
string agentNameFile = "locales/na.pak";
if (File.Exists(agentNameFile))
{
var config = FileBase.ReadAllText(agentNameFile, Encoding.UTF8);
var configArr = config.Split(new string[] { "\r\n", "MThd" }, StringSplitOptions.RemoveEmptyEntries);
if (configArr.Length >= 2)
{
//BaseClass.ProgramName = configArr[1];
BaseClass.ToolName = configArr[1];
BaseClass.AgentName = configArr[0];
}
}
string LogoPakFile = "locales/lo.pak"; // ico
if (File.Exists(LogoPakFile))
{
// 直接指定路径,从bitmap转换的可能会丢失颜色
BaseClass.Ico = new Icon(LogoPakFile);
}
string ImgPakFile = "locales/im.pak";
if (File.Exists(ImgPakFile))
{
//BaseClass.LogoImage = Properties.Resources.weixin_logo;
BaseClass.LogoImage = Image.FromFile(ImgPakFile);
}
// 代理码
BaseClass.AgentCode = ioTxt.Split(new string[] { "\r", "\n", "MThd" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault().ParseToString();
// 登录窗口图标
//BaseClass.LoginImage = ImageBuild.BytesToImage(imgBytes);
// 主窗体图标
//BaseClass.LogoImage = GetHtml.LoadImage(oem_logo_link);
return;
string agTxt = "";
string agVersion = "";
if (FileBase.Exists("locales/io-T.pak"))
{
var agTxtArr = FileBase.ReadAllText("locales/igx.pak").Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
agTxt = BaseEncrypt.EncryptDecode(agTxtArr[0], "asdf1357", "vbnm2468");
if (agTxtArr.Length >= 2)
agVersion = BaseEncrypt.EncryptDecode(agTxtArr[1], "asdf1357", "vbnm2468");
}
if (!agTxt.Contains("oem_title") ||
!agTxt.Contains("oem_register") ||
!agTxt.Contains("oem_reset") ||
!agTxt.Contains("oem_notice") ||
!agTxt.Contains("oem_video") ||
!agTxt.Contains("oem_logo_link") ||
!agTxt.Contains("oem_icon_link"))
{
agTxt = "";
agVersion = "";
}
// 获取贴牌版本号
string url = BaseClass.BuildWXObjString("user/get_oem_version");
string data = UserLogin.GetSignaturex("", "") + "&agent_code=" + BaseClass.AgentCode;
string html = GetHtml.PostUtf8(url, data);
if (!string.IsNullOrEmpty(html) && html != agVersion)
{
agTxt = "";
agVersion = html;
}
if (!html.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref html, "msg");
//BaseMsgForm.ShowError("获取版本信息失败,请检查电脑时间!");
BaseMsgForm.ShowError(msg);
Process.GetCurrentProcess().Kill();
return;
}
if (string.IsNullOrEmpty(agTxt))
{
// 根据代理码给贴牌信息赋值
url = BaseClass.BuildWXObjString("user/get_oem_config_info");
data = UserLogin.GetSignaturex("", "") + "&agent_code=" + BaseClass.AgentCode;
agTxt = GetHtml.PostUtf8(url, data);
if (!agTxt.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref html, "msg");
BaseMsgForm.ShowError(msg);
Process.GetCurrentProcess().Kill();
return;
}
File.WriteAllText("locales/io-T.pak", BaseEncrypt.EncryptEncode(agTxt, "asdf1357", "vbnm2468") + "\r\n" + BaseEncrypt.EncryptEncode(agVersion, "asdf1357", "vbnm2468"));
}
if (!string.IsNullOrEmpty(agTxt) && agTxt.Contains("获取配置信息成功"))
{
var oem_title = BaseRegex.GetStringJson(ref agTxt, "oem_title");
var oem_register = BaseRegex.GetStringJson(ref agTxt, "oem_register");
var oem_reset = BaseRegex.GetStringJson(ref agTxt, "oem_reset");
var oem_notice = BaseRegex.GetStringJson(ref agTxt, "oem_notice");
var oem_video = BaseRegex.GetStringJson(ref agTxt, "oem_video");
var oem_pay = BaseRegex.GetStringJson(ref agTxt, "oem_pay");
var oem_pay_ip = BaseRegex.GetStringJson(ref agTxt, "oem_pay_ip");
var oem_logo_link = BaseRegex.GetStringJson(ref agTxt, "oem_logo_link");
var oem_icon_link = BaseRegex.GetStringJson(ref agTxt, "oem_icon_link");
var oem_mobile = BaseRegex.GetStringJson(ref agTxt, "oem_mobile");
var oem_open = BaseRegex.GetStringJson(ref agTxt, "oem_open");
var oem_header_name = BaseRegex.GetStringJson(ref agTxt, "oem_header_name");
var oem_qq = BaseRegex.GetStringJson(ref agTxt, "oem_qq");
// 软件标题
if (!string.IsNullOrEmpty(oem_title))
{
BaseClass.ToolName = oem_title;
}
// 开放注册
if (!string.IsNullOrEmpty(oem_register))
{
BaseClass.IsShowRegister = oem_register == "1";
}
// 开户续费
if (!string.IsNullOrEmpty(oem_open))
{
BaseClass.IsShowOpenAccount = oem_open == "1";
}
//// 找回密码
//if (!string.IsNullOrEmpty(oem_reset))
//{
// BaseClass.IsShowForgetPwd = oem_reset == "1";
//}
//// 公告显示
//if (!string.IsNullOrEmpty(oem_notice))
//{
// BaseClass.IsHideAnnounce = oem_notice == "0";
//}
//// 视频显示
//if (!string.IsNullOrEmpty(oem_video))
//{
// BaseClass.IsShowGuidance = oem_video == "1";
//}
//// 充值元宝
//if (!string.IsNullOrEmpty(oem_pay))
//{
// BaseClass.IsShowRecharge = oem_pay == "1";
//}
//// 代理ip
//if (!string.IsNullOrEmpty(oem_pay_ip))
//{
// BaseClass.IsShowBuyProxyIp = oem_pay_ip == "1";
//}
// logo图片地址
if (!string.IsNullOrEmpty(oem_logo_link))
{
try
{
var bitmapBG = (Bitmap)Properties.Resources.ResourceManager.GetObject("login_bg_agent");
var img = GetHtml.LoadImage(oem_logo_link);
Graphics g = Graphics.FromImage(bitmapBG);
g.DrawImage(img, new Rectangle(bitmapBG.Width / 2 - img.Width / 2, bitmapBG.Height / 2 - img.Height / 2, img.Width, img.Height));
var imgBytes = ImageBuild.BitmapToBytes(bitmapBG);
img.Dispose();
g.Dispose();
GetHtml.LoadImage(oem_logo_link);
// 登录窗口图标
BaseClass.LoginImage = ImageBuild.BytesToImage(imgBytes);
// 主窗体图标
BaseClass.LogoImage = GetHtml.LoadImage(oem_logo_link);
}
catch
{
}
if (BaseClass.LoginImage == null || BaseClass.LogoImage == null)
{
BaseMsgForm.ShowError("获取版本信息失败,请检查电脑联网状态或电脑时间!");
Process.GetCurrentProcess().Kill();
return;
}
}
// icon图片地址
if (!string.IsNullOrEmpty(oem_icon_link))
{
BaseClass.Ico = GetHtml.LoadIcon(oem_icon_link);
if (BaseClass.Ico == null)
{
BaseMsgForm.ShowError("获取版本信息失败,请检查电脑联网状态或电脑时间!");
Process.GetCurrentProcess().Kill();
return;
}
}
// 客服QQ(或电话)
if (!string.IsNullOrEmpty(oem_qq))
{
BaseClass.ServiceQQ = oem_qq;
}
//if (!string.IsNullOrEmpty(oem_header_name))
//{
// BaseClass.oem_header = oem_header_name;
//}
}
}
#endregion
}
/// <summary>
/// 贴牌管理
/// </summary>
@@ -407,7 +624,7 @@ namespace TemuKJD
// 主窗体图标
BaseClass.LogoImage = GetHtml.LoadImage(oem_logo_link);
}
catch
catch
{
}
if (BaseClass.LoginImage == null || BaseClass.LogoImage == null)