添加项目文件。

This commit is contained in:
sunxiaolong
2024-07-22 00:43:14 +08:00
parent 420acddc53
commit f87e90f55a
218 changed files with 90102 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,543 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.AppleWebServace
{
public class ApplePrivacytWeb : AppleWebBase
{
private AppleAcount acount = new AppleAcount();
protected string Apple_Widget_Key = "04659e25236376d440c224638c1cdd6a001abdd7f186cdcfa120abf35417efab";
public string authUrl = "https://privacy.apple.com";
public string redirectURI = "https://idmsa.apple.com/";
private static string homeLanguage = "zh_CN";
public string appleId { get; set; }
private AuthsigninConfig authsigninConfig { get; set; }
public string XAppleIDAccountCountry { get; set; }
protected string iframeId { get; set; }
public ApplePrivacytWeb(bool _openVpn, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, ITaskRunState _taskState)
: base(_action, _applyAtion, _taskState)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
base.openVpn = _openVpn;
iframeId = APPLEHCHelp.getIframeId();
}
public bool applyQueryAuthBalance(AppleAcount _acount, string _noticeKey)
{
acount = _acount;
if (string.IsNullOrEmpty(base.ProxyIp))
{
base.ProxyIp = ProxyAccountCache.getProxyAccountIP(acount.appleId);
}
appleId = acount.appleId;
base.noticeKey = _noticeKey;
authsigninConfig = new AuthsigninConfig
{
Apple_Widget_Key = Apple_Widget_Key,
authUrl = authUrl,
homeLanguage = homeLanguage,
iframeId = iframeId,
redirectURI = redirectURI
};
try
{
HttpResult webContent = getWebContent("https://privacy.apple.com/account", "");
if (webContent.StatusCode != HttpStatusCode.OK)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "页面加载失败");
return false;
}
string value = new Regex(AppSysConfig.getConfig("Regex_apply_CsrfToken")).Match(webContent.Html).Groups[1].Value.Trim();
if (LoginWeb() && appleauthAuth(acount))
{
string value2 = "";
handelDic.TryGetValue("X-Apple-OAuth-Grant-Code", out value2);
string value3 = Tools.EncodeBase64(Encoding.UTF8.GetBytes(Apple_Widget_Key + ":" + value2));
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.Add("x-csrf-token", value);
webHeaderCollection.Add("x-apple-authentication", value3);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在获取余额");
HttpResult webJsonContent = getWebJsonContent("https://privacy.apple.com/session/create", "https://privacy.apple.com/", webHeaderCollection);
if (webJsonContent.StatusCode == HttpStatusCode.OK || webJsonContent.StatusCode == HttpStatusCode.Created)
{
WebHeaderCollection webHeaderCollection2 = new WebHeaderCollection();
webHeaderCollection2.Add("x-csrf-token", value);
HttpResult webJsonContent2 = getWebJsonContent("https://privacy.apple.com/section/delete-account", "https://privacy.apple.com/account", webHeaderCollection2);
if (webJsonContent2.Html.Contains("store_balance"))
{
string text = new Regex(AppSysConfig.getConfig("Regex_applyQueryAuthBalance")).Match(webJsonContent2.Html).Groups[1].Value.Trim().TrimEnd(',');
if (string.IsNullOrEmpty(text))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "余额解析失败");
return false;
}
Dictionary<string, object> dictionary = Tools.Todejosn<Dictionary<string, object>>("{" + text + "}");
decimal num = (dynamic)dictionary["balance"];
string text2 = (dynamic)dictionary["currency"];
action?.Invoke(base.noticeKey, DisplyType.balance, num + " " + text2);
}
else
{
action?.Invoke(base.noticeKey, DisplyType.balance, "0");
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在重新获取余额");
webJsonContent = getWebJsonContent("https://privacy.apple.com/session/create", "https://privacy.apple.com/", webHeaderCollection);
if (webJsonContent.StatusCode == HttpStatusCode.OK || webJsonContent.StatusCode == HttpStatusCode.Created)
{
WebHeaderCollection webHeaderCollection3 = new WebHeaderCollection();
webHeaderCollection3.Add("x-csrf-token", value);
HttpResult webJsonContent3 = getWebJsonContent("https://privacy.apple.com/section/delete-account", "https://privacy.apple.com/account", webHeaderCollection3);
if (webJsonContent3.Html.Contains("store_balance"))
{
string text3 = new Regex(AppSysConfig.getConfig("Regex_applyQueryAuthBalance")).Match(webJsonContent3.Html).Groups[1].Value.Trim().TrimEnd(',');
if (string.IsNullOrEmpty(text3))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "余额解析失败");
return false;
}
Dictionary<string, object> dictionary2 = Tools.Todejosn<Dictionary<string, object>>("{" + text3 + "}");
decimal num2 = (dynamic)dictionary2["balance"];
string text4 = (dynamic)dictionary2["currency"];
action?.Invoke(base.noticeKey, DisplyType.balance, num2 + " " + text4);
}
else
{
action?.Invoke(base.noticeKey, DisplyType.balance, "0");
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "余额获取失败");
}
}
catch (Exception ex)
{
APIUtlis.ApiSeriveError(ex);
action?.Invoke(base.noticeKey, DisplyType.xinxi, ex.Message);
}
return false;
}
public bool LoginWeb()
{
HttpResult result = null;
string errMsg = "未知错误";
if (authsignin(acount.appleId, acount.applePwd, authsigninConfig, ref errMsg, out result))
{
if (result != null)
{
if (result.StatusCode == HttpStatusCode.Conflict || result.StatusCode == HttpStatusCode.OK)
{
if (result.Html.Contains("hsa2"))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "双重验证账号暂不支持更改");
return false;
}
return true;
}
if (result.StatusCode == HttpStatusCode.PreconditionFailed)
{
string[] allKeys = result.Header.AllKeys;
foreach (string text in allKeys)
{
switch (text)
{
case "X-Apple-Auth-Attributes":
case "X-Apple-Repair-Session-Token":
case "X-Apple-ID-Session-Id":
case "scnt":
case "X-Apple-OAuth-Context":
handelDic.TryAddDic(text, result.Header[text]);
break;
}
if (text == "scnt")
{
handelDic.TryAddDic("scnt2", result.Header[text]);
}
}
return repair();
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "登录异常了");
}
}
return false;
}
private bool appleauthAuth(AppleAcount acount)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保问题");
new WebHeaderCollection();
string url = "https://idmsa.apple.com/appleauth/auth";
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Locale", homeLanguage);
webHeaderCollection.AddWebHander("X-Apple-Auth-Attributes", handelDic.getDicVal("X-Apple-Auth-Attributes", ""));
webHeaderCollection.AddWebHander("scnt", handelDic.getDicVal("scnt", ""));
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("X-Apple-ID-Session-Id", ""));
addOAuthHanede(webHeaderCollection, authsigninConfig);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
HttpResult webContent = getWebContent(url, authUrl, webHeaderCollection, "text/html", "application/json");
if (webContent.StatusCode == HttpStatusCode.OK)
{
AothQuestions questions = Tools.Todejosn<AothQuestions>(new Regex(AppSysConfig.getConfig("Regex_appleauthAuth")).Match(webContent.Html).Groups[1].Value.Trim() + "}");
return verifyAuthQuestions(questions, new string[3] { acount.appleQt1, acount.appleQt2, acount.appleQt3 });
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保获取失败");
return false;
}
private bool verifyAuthQuestions(AothQuestions questions, string[] question)
{
AothQuestions.Question[] questions2 = questions.questions;
int num = 0;
while (true)
{
if (num < questions2.Length)
{
AothQuestions.Question question2 = questions2[num];
int anwerId_Index = Tools.getAnwerId_Index(question2.id);
if (anwerId_Index == 0)
{
break;
}
question2.answer = question[anwerId_Index - 1];
num++;
continue;
}
string postData = Tools.Toenjson(questions);
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
webHeaderCollection.AddWebHander("X-Apple-App-Id", Apple_Widget_Key);
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Domain-Id", "1");
webHeaderCollection.AddWebHander("scnt", handelDic["scnt"]);
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic["X-Apple-ID-Session-Id"]);
webHeaderCollection.AddWebHander("X-Apple-Locale", homeLanguage);
webHeaderCollection.AddWebHander("X-Apple-Auth-Attributes", handelDic.getDicVal("X-Apple-Auth-Attributes", ""));
webHeaderCollection.Add("X-Apple-OAuth-Require-Grant-Code", "true");
addOAuthHanede(webHeaderCollection, authsigninConfig);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
string url = "https://idmsa.apple.com/appleauth/auth/verify/questions";
HttpResult httpResult = postWebContent(url, postData, authUrl, webHeaderCollection);
if (httpResult.StatusCode != HttpStatusCode.BadRequest && httpResult.StatusCode != HttpStatusCode.Unauthorized)
{
if (httpResult.StatusCode == HttpStatusCode.NoContent)
{
string[] allKeys = httpResult.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-OAuth-Grant-Code" || text == "scnt")
{
handelDic.TryAddDic(text, httpResult.Header[text]);
}
if (text == "scnt")
{
handelDic.TryAddDic("idmsa_scnt", httpResult.Header[text]);
}
}
if (httpResult.Header.AllKeys.Contains("X-Apple-ID-Account-Country"))
{
XAppleIDAccountCountry = AppleUtlis.GetAreaByCode(httpResult.Header["X-Apple-ID-Account-Country"].ToString());
action?.Invoke(base.noticeKey, DisplyType.area, XAppleIDAccountCountry);
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保验证成功");
return true;
}
if (httpResult.StatusCode == HttpStatusCode.PreconditionFailed)
{
string[] allKeys = httpResult.Header.AllKeys;
foreach (string text2 in allKeys)
{
switch (text2)
{
case "X-Apple-Repair-Session-Token":
case "X-Apple-ID-Session-Id":
case "scnt":
case "X-Apple-OAuth-Context":
handelDic.TryAddDic(text2, httpResult.Header[text2]);
break;
}
if (text2 == "scnt")
{
handelDic.TryAddDic("idmsa_scnt", httpResult.Header[text2]);
}
}
if (httpResult.Header.AllKeys.Contains("X-Apple-ID-Account-Country"))
{
XAppleIDAccountCountry = AppleUtlis.GetAreaByCode(httpResult.Header["X-Apple-ID-Account-Country"].ToString());
action?.Invoke(base.noticeKey, DisplyType.area, XAppleIDAccountCountry);
}
return repair();
}
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保错误");
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "非正常密保问题,无法识别");
return false;
}
private bool repair()
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "获取阅读协议");
string text = "zh_CN_CHN";
if (handelDic.ContainsKey("X-Apple-Locale"))
{
text = handelDic["X-Apple-Locale"];
}
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("Upgrade-Insecure-Requests", "1");
string apple_Widget_Key = Apple_Widget_Key;
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", apple_Widget_Key);
string uRL = "https://appleid.apple.com/widget/account/repair?trustedWidgetDomain=https%3A%2F%2Fidmsa.apple.com&widgetKey=" + apple_Widget_Key + "&rv=1&language=" + text;
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "get",
Timeout = 120000,
ReadWriteTimeout = 30000,
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "text/html;charset=UTF-8",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
Referer = "https://idmsa.apple.com/appleauth/auth/signin?widgetKey=" + apple_Widget_Key + "&language=zh_CN&rv=1",
ResultType = ResultType.String,
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode == HttpStatusCode.OK)
{
string value = new Regex(AppSysConfig.getConfig("Regex_repair_sessionId")).Match(httpReuslt.Html).Groups[1].Value.Trim().Replace("\n", "").Replace("\r", "")
.Replace("\"", "")
.TrimStart(':')
.Trim();
string key = "repairSessionId";
if (!handelDic.ContainsKey(key))
{
handelDic.TryAddDic(key, value);
}
else
{
handelDic[key] = value;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text2 in allKeys)
{
if (text2 == "X-Apple-Repair-Session-Token" || text2 == "scnt")
{
handelDic.TryAddDic(text2, httpReuslt.Header[text2]);
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取成功");
return options();
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取失败");
return false;
}
private bool options()
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("scnt", handelDic.getDicVal("scnt", ""));
webHeaderCollection.AddWebHander("X-Apple-Skip-Repair-Attributes", "[\"hsa2_enrollment\"]");
webHeaderCollection.AddWebHander("X-Apple-OAuth-Context", handelDic.getDicVal("X-Apple-OAuth-Context", ""));
string dicVal = handelDic.getDicVal("X-Apple-Session-Token", "");
if (string.IsNullOrEmpty(dicVal))
{
dicVal = handelDic.getDicVal("X-Apple-Repair-Session-Token", "");
}
webHeaderCollection.AddWebHander("X-Apple-Session-Token", dicVal);
webHeaderCollection.AddWebHander("X-Apple-I-TimeZone", "Asia/Shanghai");
webHeaderCollection.AddWebHander("X-Apple-Repair-App-Id", "1879");
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("repairSessionId", ""));
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
string uRL = "https://appleid.apple.com/account/manage/repair/options";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "get",
Timeout = 120000,
ReadWriteTimeout = 30000,
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://appleid.apple.com/",
ResultType = ResultType.String,
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode == HttpStatusCode.OK)
{
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-Session-Token" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
Dictionary<string, object> dictionary = Tools.Todejosn<Dictionary<string, object>>(httpReuslt.Html);
if (httpReuslt.Html.Contains("requiredSteps"))
{
foreach (object item in (dynamic)dictionary["requiredSteps"])
{
if ((string)(dynamic)item == "privacy_consent" && !accept())
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读失败#2");
return false;
}
}
}
return complete();
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取失败#2");
return false;
}
private bool accept()
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在同意协议");
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Repair-App-Id", "1879");
webHeaderCollection.AddWebHander("X-Apple-OAuth-Context", handelDic.getDicVal("X-Apple-OAuth-Context", ""));
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
webHeaderCollection.AddWebHander("scnt", handelDic["scnt"]);
webHeaderCollection.AddWebHander("X-Apple-Skip-Repair-Attributes", "[]");
webHeaderCollection.AddWebHander("X-Apple-Session-Token", handelDic["X-Apple-Session-Token"]);
webHeaderCollection.AddWebHander("X-Apple-I-TimeZone", "Asia/Shanghai");
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic["repairSessionId"]);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
string uRL = "https://appleid.apple.com/account/manage/privacy/accept";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "put",
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://appleid.apple.com/",
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode != HttpStatusCode.OK && httpReuslt.StatusCode != HttpStatusCode.MethodNotAllowed)
{
return false;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-Session-Token" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
return true;
}
private bool complete()
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Locale", homeLanguage);
webHeaderCollection.AddWebHander("scnt", handelDic.getDicVal("idmsa_scnt", ""));
if (handelDic.ContainsKey("X-Apple-ID-Session-Id"))
{
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("X-Apple-ID-Session-Id", ""));
}
else if (handelDic.ContainsKey("repairSessionId"))
{
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("repairSessionId", ""));
}
webHeaderCollection.AddWebHander("X-Apple-Domain-Id", "2");
webHeaderCollection.AddWebHander("X-Apple-Trusted-Domain", " https://idmsa.apple.com");
webHeaderCollection.AddWebHander("X-Apple-Repair-Session-Token", handelDic["X-Apple-Session-Token"]);
webHeaderCollection.AddWebHander("Origin", "https://idmsa.apple.com");
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
webHeaderCollection.AddWebHander("X-Apple-Auth-Attributes", handelDic.getDicVal("X-Apple-Auth-Attributes", ""));
webHeaderCollection.Add("X-Apple-OAuth-Require-Grant-Code", "true");
addOAuthHanede(webHeaderCollection, authsigninConfig);
string uRL = "https://idmsa.apple.com/appleauth/auth/repair/complete";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "post",
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://idmsa.apple.com/",
ResultType = ResultType.String,
Postdata = "",
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode != HttpStatusCode.OK && httpReuslt.StatusCode != HttpStatusCode.NoContent)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读失败");
return false;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-OAuth-Grant-Code" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
if (httpReuslt.Header.AllKeys.Contains("X-Apple-ID-Account-Country"))
{
action?.Invoke(base.noticeKey, DisplyType.area, AppleUtlis.GetAreaByCode(httpReuslt.Header["X-Apple-ID-Account-Country"].ToString()));
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读成功");
return true;
}
}
}

View File

@@ -0,0 +1,461 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.AppleWebServace
{
public class AppleReportaproblemWeb : AppleWebBase
{
private static string homeLanguage = "zh_CN";
public string Apple_Widget_Key = "6f59402f11d3e2234be5b88bf1c96e1e453a875aec205272add55157582a9f61";
public string authUrl = "https://idmsa.apple.com";
public string redirectURI = "https://idmsa.apple.com";
private string dataR = "";
protected string iframeId { get; set; }
private AuthsigninConfig authsigninConfig { get; set; }
public bool idIsNormal { get; set; }
public string appleId { get; set; }
public AppleReportaproblemWeb(bool _openVpn, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, ITaskRunState _taskState)
: base(_action, _applyAtion, _taskState)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
base.openVpn = _openVpn;
iframeId = APPLEHCHelp.getIframeId().Replace("auth-", "daw-");
}
public bool checkDisable(string _appleId, string applePwd, string _notityKey)
{
listCookie.Add(new CookieItem
{
Key = "geo",
Value = "CN"
});
homeLanguage = "CN-ZH";
authsigninConfig = new AuthsigninConfig
{
Apple_Widget_Key = Apple_Widget_Key,
authUrl = authUrl,
homeLanguage = homeLanguage,
iframeId = iframeId,
redirectURI = authUrl,
refererUrl = redirectURI
};
HttpResult result = null;
appleId = _appleId;
base.noticeKey = _notityKey;
new Dictionary<string, string>().Add("X-Apple-App-Id", "1879");
HttpResult webContent = getWebContent("https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=" + Apple_Widget_Key + "&language=" + homeLanguage, "");
if (webContent.StatusCode == HttpStatusCode.OK)
{
string text = new Regex("iframeId\":\"([\\s\\S]*?)\"").Match(webContent.Html).Groups[1].Value.Trim().TrimEnd(',');
if (!string.IsNullOrEmpty(text))
{
AuthsigninConfig obj = authsigninConfig;
string text3 = (iframeId = text);
obj.iframeId = text3;
}
if (webContent.Header.AllKeys.Contains("scnt"))
{
handelDic.Add("login_scnt", webContent.Header["scnt"]);
}
}
string errMsg = "未知错误";
if (authsignin(appleId, applePwd, authsigninConfig, ref errMsg, out result))
{
if (result != null)
{
if (result.StatusCode == HttpStatusCode.Unauthorized)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "ID 或密码不正确");
return true;
}
if (result.StatusCode == HttpStatusCode.Forbidden)
{
RespErrorJson respErrorJson = Tools.Todejosn<RespErrorJson>(result.Html);
if (respErrorJson != null && respErrorJson.serviceErrors != null && respErrorJson.serviceErrors.Length != 0)
{
string message = respErrorJson.serviceErrors[0].message;
action?.Invoke(base.noticeKey, DisplyType.xinxi, message);
return false;
}
return false;
}
if (result.StatusCode == HttpStatusCode.OK)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密码验证成功");
string[] allKeys = result.Header.AllKeys;
foreach (string text4 in allKeys)
{
switch (text4)
{
case "X-Apple-ID-Session-Id":
case "X-Apple-ID-Account-Country":
case "scnt":
case "X-Apple-OAuth-Context":
handelDic.TryAddDic(text4, result.Header[text4]);
if (text4 == "X-Apple-ID-Account-Country")
{
action?.Invoke(base.noticeKey, DisplyType.area, AppleUtlis.GetAreaByCode(result.Header["X-Apple-ID-Account-Country"].ToString()));
}
break;
}
}
return reportaproblem(appleId);
}
if (result.StatusCode == HttpStatusCode.PreconditionFailed)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "阅读协议");
string[] allKeys = result.Header.AllKeys;
foreach (string text5 in allKeys)
{
switch (text5)
{
case "X-Apple-Auth-Attributes":
case "X-Apple-Repair-Session-Token":
case "X-Apple-ID-Session-Id":
case "scnt":
case "X-Apple-OAuth-Context":
handelDic.TryAddDic(text5, result.Header[text5]);
if (text5 == "X-Apple-ID-Account-Country")
{
action?.Invoke(base.noticeKey, DisplyType.area, AppleUtlis.GetAreaByCode(result.Header["X-Apple-ID-Account-Country"].ToString()));
}
if (text5 == "scnt")
{
handelDic.TryAddDic("idmsa_scnt", result.Header[text5]);
}
break;
}
}
if (repair() && toDMSWebAuthSignin())
{
return reportaproblem(appleId);
}
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "登录异常了");
}
}
return false;
}
private bool toDMSWebAuthSignin()
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
string dicVal = handelDic.getDicVal("login_scnt", "");
string postData = "rememberMe=false&grantCode=&iframeId=" + iframeId + "&requestUri=%2Fsignin&appIdKey=" + Apple_Widget_Key + "&language=CN-ZH&scnt=" + dicVal;
HttpResult httpResult = postWebContent("https://idmsa.apple.com/IDMSWebAuth/signin", postData, "https://idmsa.apple.com/", webHeaderCollection, "text/html,application/xhtml+xml", "application/x-www-form-urlencoded");
if (httpResult.StatusCode != HttpStatusCode.OK && httpResult.StatusCode != HttpStatusCode.Found && httpResult.StatusCode != HttpStatusCode.SeeOther)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "登录失败:网页授权失败..");
return false;
}
return true;
}
private bool repair()
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "获取阅读协议");
string text = "zh_CN_CHN";
if (handelDic.ContainsKey("X-Apple-Locale"))
{
text = handelDic["X-Apple-Locale"];
}
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("Upgrade-Insecure-Requests", "1");
string apple_Widget_Key = Apple_Widget_Key;
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", apple_Widget_Key);
string uRL = "https://appleid.apple.com/widget/account/repair?trustedWidgetDomain=https%3A%2F%2Fidmsa.apple.com&widgetKey=" + apple_Widget_Key + "&rv=1&language=" + text;
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "get",
Timeout = 120000,
ReadWriteTimeout = 30000,
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "text/html;charset=UTF-8",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
Referer = "https://idmsa.apple.com/appleauth/auth/signin?widgetKey=" + apple_Widget_Key + "&language=zh_CN&rv=1",
ResultType = ResultType.String,
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode == HttpStatusCode.OK)
{
string value = new Regex(AppSysConfig.getConfig("Regex_repair_sessionId")).Match(httpReuslt.Html).Groups[1].Value.Trim().Replace("\n", "").Replace("\r", "")
.Replace("\"", "")
.TrimStart(':')
.Trim();
string key = "repairSessionId";
if (!handelDic.ContainsKey(key))
{
handelDic.TryAddDic(key, value);
}
else
{
handelDic[key] = value;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text2 in allKeys)
{
if (text2 == "X-Apple-Repair-Session-Token" || text2 == "scnt")
{
handelDic.TryAddDic(text2, httpReuslt.Header[text2]);
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取成功");
return options();
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取失败");
return false;
}
private bool options()
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("scnt", handelDic.getDicVal("scnt", ""));
webHeaderCollection.AddWebHander("X-Apple-Skip-Repair-Attributes", "[\"hsa2_enrollment\"]");
webHeaderCollection.AddWebHander("X-Apple-OAuth-Context", handelDic.getDicVal("X-Apple-OAuth-Context", ""));
string dicVal = handelDic.getDicVal("X-Apple-Session-Token", "");
if (string.IsNullOrEmpty(dicVal))
{
dicVal = handelDic.getDicVal("X-Apple-Repair-Session-Token", "");
}
webHeaderCollection.AddWebHander("X-Apple-Session-Token", dicVal);
webHeaderCollection.AddWebHander("X-Apple-I-TimeZone", "Asia/Shanghai");
webHeaderCollection.AddWebHander("X-Apple-Repair-App-Id", "1879");
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("repairSessionId", ""));
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
string uRL = "https://appleid.apple.com/account/manage/repair/options";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "get",
Timeout = 120000,
ReadWriteTimeout = 30000,
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://appleid.apple.com/",
ResultType = ResultType.String,
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode == HttpStatusCode.OK)
{
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-Session-Token" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
Dictionary<string, object> dictionary = Tools.Todejosn<Dictionary<string, object>>(httpReuslt.Html);
if (httpReuslt.Html.Contains("requiredSteps"))
{
foreach (object item in (dynamic)dictionary["requiredSteps"])
{
if ((string)(dynamic)item == "privacy_consent" && !accept())
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读失败#2");
return false;
}
}
}
return complete();
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议获取失败#2");
return false;
}
private bool accept()
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在同意协议");
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Repair-App-Id", "1879");
webHeaderCollection.AddWebHander("X-Apple-OAuth-Context", handelDic.getDicVal("X-Apple-OAuth-Context", ""));
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
webHeaderCollection.AddWebHander("scnt", handelDic["scnt"]);
webHeaderCollection.AddWebHander("X-Apple-Skip-Repair-Attributes", "[]");
webHeaderCollection.AddWebHander("X-Apple-Session-Token", handelDic["X-Apple-Session-Token"]);
webHeaderCollection.AddWebHander("X-Apple-I-TimeZone", "Asia/Shanghai");
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic["repairSessionId"]);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
string uRL = "https://appleid.apple.com/account/manage/privacy/accept";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "put",
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://appleid.apple.com/",
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode != HttpStatusCode.OK && httpReuslt.StatusCode != HttpStatusCode.MethodNotAllowed)
{
return false;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-Session-Token" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
return true;
}
private bool complete()
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.AddWebHander("X-Requested-With", "XMLHttpRequest");
webHeaderCollection.AddWebHander("X-Apple-Locale", homeLanguage);
webHeaderCollection.AddWebHander("scnt", handelDic.getDicVal("idmsa_scnt", ""));
if (handelDic.ContainsKey("X-Apple-ID-Session-Id"))
{
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("X-Apple-ID-Session-Id", ""));
}
else if (handelDic.ContainsKey("repairSessionId"))
{
webHeaderCollection.AddWebHander("X-Apple-ID-Session-Id", handelDic.getDicVal("repairSessionId", ""));
}
webHeaderCollection.AddWebHander("X-Apple-App-Id", "1879");
webHeaderCollection.AddWebHander("X-Apple-Trusted-Domain", " https://idmsa.apple.com");
webHeaderCollection.AddWebHander("X-Apple-Repair-Session-Token", handelDic["X-Apple-Session-Token"]);
webHeaderCollection.AddWebHander("Origin", "https://idmsa.apple.com");
webHeaderCollection.AddWebHander("X-Apple-Widget-Key", Apple_Widget_Key);
string appleIFDClientInfo = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.AddWebHander("X-Apple-I-FD-Client-Info", appleIFDClientInfo);
webHeaderCollection.AddWebHander("X-Apple-Auth-Attributes", handelDic.getDicVal("X-Apple-Auth-Attributes", ""));
addOAuthHanede(webHeaderCollection, authsigninConfig);
string uRL = "https://idmsa.apple.com/appleauth/auth/repair/complete";
HttpItem httpItem = new HttpItem
{
URL = uRL,
Method = "post",
UserAgent = base.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=utf-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = "https://idmsa.apple.com/",
ResultType = ResultType.String,
Postdata = "",
ProtocolVersion = HttpVersion.Version11,
WebProxy = WebRequest.DefaultWebProxy
};
httpItem.Header = webHeaderCollection;
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
if (httpReuslt.StatusCode != HttpStatusCode.OK && httpReuslt.StatusCode != HttpStatusCode.NoContent)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读失败");
return false;
}
string[] allKeys = httpReuslt.Header.AllKeys;
foreach (string text in allKeys)
{
if (text == "X-Apple-OAuth-Grant-Code" || text == "scnt")
{
handelDic.TryAddDic(text, httpReuslt.Header[text]);
}
}
if (httpReuslt.Header.AllKeys.Contains("X-Apple-ID-Account-Country"))
{
action?.Invoke(base.noticeKey, DisplyType.area, AppleUtlis.GetAreaByCode(httpReuslt.Header["X-Apple-ID-Account-Country"].ToString()));
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "协议阅读成功");
return true;
}
public bool reportaproblem(string appleId)
{
HttpResult webContent = getWebContent("https://reportaproblem.apple.com", "https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=6f59402f11d3e2234be5b88bf1c96e1e453a875aec205272add55157582a9f61&language=US-EN");
if (webContent.StatusCode == HttpStatusCode.OK)
{
HttpResult webJsonContent = getWebJsonContent("https://reportaproblem.apple.com/api/login", webContent.ResponseUri);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
applyAtion?.Invoke(base.noticeKey, DisplyType.normal, "正常");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
string.IsNullOrEmpty(base.ProxyIp);
idIsNormal = true;
dataR = new Regex(AppSysConfig.getConfig("Regex_reportaproblem")).Match(webContent.Html).Groups[1].Value;
return true;
}
string token = AppleNetworkBase.GetToken(webJsonContent.Html, "messageBodyLocKey\":\"", "\"");
if (!string.IsNullOrEmpty(token))
{
if (AppSysConfig.getConfig("MessageBodyLocKey").Split(',').Contains(token))
{
applyAtion?.Invoke(base.noticeKey, DisplyType.forbidden, "禁用");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,错误码:" + token);
return false;
}
applyAtion?.Invoke(base.noticeKey, DisplyType.normal, "正常");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
if (webContent.StatusCode != HttpStatusCode.Found && webContent.StatusCode != HttpStatusCode.MovedPermanently)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知异常,请重新检测");
return false;
}
if (webContent.RedirectUrl.ToLower().Contains("accountdisabled"))
{
applyAtion?.Invoke(base.noticeKey, DisplyType.forbidden, "禁用");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
if (webContent.RedirectUrl.ToLower().Contains("https://reportaproblem.apple.com"))
{
applyAtion?.Invoke(base.noticeKey, DisplyType.normal, "正常");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询完成");
return true;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知异常,请重新检测");
return false;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,793 @@
using System;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.AppleWebServace
{
public class AppleiForgotWeb : AppleWebBase
{
private class CaptchaModel
{
public class Payload
{
public string contentType { get; set; }
public string content { get; set; }
}
public Payload payload { get; set; }
public string token { get; set; }
public string type { get; set; }
public int id { get; set; }
public string reust { get; set; } = "";
}
private string language = "zh_CN";
private AppleAcount acount = new AppleAcount();
public string appleId { get; set; }
public bool CheckAppleId { get; set; }
public AppleiForgotWeb(bool _openVpn, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, ITaskRunState _taskState)
: base(_action, _applyAtion, _taskState)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
base.openVpn = _openVpn;
}
public bool RetrievePassword(AppleAcount _acount, string newPwd, string _noticeKey, bool isCloseAuthen = false, bool ckTailNumber = false)
{
acount = _acount;
if (string.IsNullOrEmpty(base.ProxyIp))
{
base.ProxyIp = ProxyAccountCache.getProxyAccountIP(acount.appleId);
}
appleId = acount.appleId;
base.noticeKey = _noticeKey;
string url = "https://iforgot.apple.com/password/verify/appleid?language=" + language;
string[] array = acount.birthday.Split('-');
if (array.Length != 3)
{
acount.birthday = acount.birthday.Replace('/', '-');
array = acount.birthday.Split('-');
}
if (!(array.Length == 3 || ckTailNumber) && !CheckAppleId)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "生日未导入或者格式错误");
}
else
{
HttpResult webContent = getWebContent(url, "");
if (webContent.StatusCode == HttpStatusCode.OK)
{
string text = new Regex(AppSysConfig.getConfig("Regex_RetrievePassword")).Match(AppleNetworkBase.GetToken(webContent.Html, "boot_args", "script")).Groups[1].Value.Replace("\"", "").Replace(":", "").Replace(" ", "")
.Trim();
if (!string.IsNullOrEmpty(text))
{
text = HttpUtility.UrlEncode(text);
bool num = verifyAppleid(text, acount, newPwd, isCloseAuthen, 0, ckTailNumber);
if (num)
{
ProxyAccountCache.addProxyIp(appleId, base.ProxyIp);
}
return num;
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知错误");
}
return false;
}
private bool verifyAppleid(string sstt, AppleAcount acount, string newPwd, bool isCloseAuthen, int RetryCount = 0, bool ckTailNumber = false)
{
if (RetryCount >= 5)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证码获取失败,#3");
return false;
}
int num = 0;
CaptchaModel captchaModel = null;
bool flag = false;
do
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "获取验证码.." + (num + 1));
captchaModel = getCaptcha(sstt);
if (captchaModel == null)
{
Thread.Sleep(500);
}
else if (!string.IsNullOrEmpty(captchaModel.payload.content))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "获取验证码..." + (num + 1));
HttpResult captcha = APIUtlis.getCaptcha(1, captchaModel.payload.content, flag);
if (captcha.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(captcha.Html);
if (val["Code"] == "0000")
{
string reust = val["Data"];
captchaModel.reust = reust;
break;
}
flag = !flag;
}
Thread.Sleep(500);
}
num++;
}
while (num <= 5);
if (captchaModel != null)
{
if (!string.IsNullOrEmpty(captchaModel.reust))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在验证账号");
string postData = "{\"id\":\"" + acount.appleId + "\",\"captcha\":{\"id\":" + captchaModel.id + ",\"answer\":\"" + captchaModel.reust + "\",\"token\":\"" + captchaModel.token + "\"}}";
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.Add("X-Apple-I-FD-Client-Info", FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent));
webHeaderCollection.Add("sstt", sstt);
HttpResult httpResult = postWebContent("https://iforgot.apple.com/password/verify/appleid", postData, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
APIUtlis.getCaptcha(3, captchaModel.payload.content);
ServiceErrorsModel serviceErrorsModel = Tools.Todejosn<ServiceErrorsModel>(httpResult.Html);
if (serviceErrorsModel != null)
{
if (serviceErrorsModel.validationErrors != null && serviceErrorsModel.validationErrors.Length != 0)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel.validationErrors[0].message);
return false;
}
if (serviceErrorsModel.service_errors != null && serviceErrorsModel.service_errors.Length != 0)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel.service_errors[0].message);
return false;
}
if (serviceErrorsModel.serviceErrors != null && serviceErrorsModel.serviceErrors.Length != 0)
{
string message = serviceErrorsModel.serviceErrors[0].message;
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel.serviceErrors[0].message);
if (CheckAppleId && !message.Contains("未知") && !message.Contains("错误"))
{
return true;
}
return false;
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "不是有效的AppleId");
}
AppSysConfig.proxyModels.Push(new ProxyModel2
{
prixyIp = base.ProxyIp,
applyDate = DateTime.Now
});
return false;
}
if (httpResult.StatusCode == HttpStatusCode.Found)
{
httpResult.Header.AllKeys.Contains("sstt");
APIUtlis.getCaptcha(3, captchaModel.payload.content);
string redirectUrl = httpResult.RedirectUrl;
webHeaderCollection["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
webHeaderCollection.Add("X-Requested-With", "XMLHttpRequest");
HttpResult webJsonContent = getWebJsonContent(redirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
if (isCloseAuthen)
{
if (redirectUrl.ToLower().StartsWith("https://iforgot.apple.com/password/verify/phone"))
{
if (ckTailNumber)
{
if (webJsonContent.Html.Contains("trustedPhones"))
{
IforgotVerifyPhoneModel iforgotVerifyPhoneModel = Tools.Todejosn<IforgotVerifyPhoneModel>(webJsonContent.Html);
if (iforgotVerifyPhoneModel != null)
{
string text = "";
IforgotVerifyPhoneModel.Trustedphone[] array = iforgotVerifyPhoneModel?.trustedPhones;
foreach (IforgotVerifyPhoneModel.Trustedphone trustedphone in array)
{
if (trustedphone != null)
{
text = text + "," + trustedphone.number;
}
}
text = ((!iforgotVerifyPhoneModel.recoverable) ? (text.TrimStart(',') + ", 无法关闭") : (text.TrimStart(',') + ", 可以关闭"));
APIUtlis.ApiApplyAct(44, "尾号查询");
action?.Invoke(base.noticeKey, DisplyType.xinxi, "查询到号码:" + text);
return false;
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "手机号码获取失败");
return false;
}
sstt = webJsonContent.Header["sstt"];
bool num2 = unenrollment(sstt, acount, newPwd);
if (num2)
{
AppSysConfig.proxyModels.Push(new ProxyModel2
{
prixyIp = base.ProxyIp,
applyDate = DateTime.Now
});
}
return num2;
}
acount.notAuthen = true;
action?.Invoke(base.noticeKey, DisplyType.xinxi, "没有双重认证");
AppSysConfig.proxyModels.Push(new ProxyModel2
{
prixyIp = base.ProxyIp,
applyDate = DateTime.Now
});
return false;
}
if (CheckAppleId)
{
string[] array2 = AppSysConfig.getConfig("CheckAppleIdReust").Split(',');
string text2 = "";
string[] array3 = array2;
for (int i = 0; i < array3.Length; i++)
{
string[] array4 = array3[i].Split('|');
if (webJsonContent.Html.Contains(array4[0]))
{
text2 = array4[1] + ",";
}
}
text2 = text2.TrimEnd(',');
if (string.IsNullOrEmpty(text2))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正常账号");
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, text2);
}
return true;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在获取重设方式");
if (webJsonContent.Html.Contains("reset_password") && webJsonContent.Header.AllKeys.Contains("sstt"))
{
sstt = webJsonContent.Header["sstt"];
webHeaderCollection["sstt"] = sstt;
webHeaderCollection["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
HttpResult httpResult2 = postWebContent("https://iforgot.apple.com/recovery/options", "{\"recoveryOption\":\"reset_password\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult2.StatusCode == HttpStatusCode.Found)
{
webJsonContent = getWebJsonContent(httpResult2.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (webJsonContent.StatusCode == HttpStatusCode.OK && !webJsonContent.Html.Contains("questions") && !webJsonContent.RedirectUrl.ToLower().StartsWith("https://iforgot.apple.com/password/verify/birthday"))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "没有重设密码的方式");
return false;
}
}
}
if (!webJsonContent.Html.Contains("questions") && !webJsonContent.RedirectUrl.ToLower().StartsWith("https://iforgot.apple.com/password/verify/birthday"))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "没有重设密码的方式");
return false;
}
sstt = webJsonContent.Header["sstt"];
webHeaderCollection["sstt"] = sstt;
webHeaderCollection["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
if (!webJsonContent.Html.Contains("questions"))
{
return VerifyBirthday(webJsonContent.RedirectUrl, acount, newPwd, webHeaderCollection);
}
string postData2 = "{\"type\":\"questions\"}";
HttpResult httpResult3 = postWebContent("https://iforgot.apple.com/password/authenticationmethod", postData2, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult3.StatusCode == HttpStatusCode.Found && httpResult3.RedirectUrl.Contains("https://iforgot.apple.com/error"))
{
int num3 = new Random(Guid.NewGuid().GetHashCode()).Next(1, 5);
Thread.Sleep(1000 * num3);
httpResult3 = postWebContent("https://iforgot.apple.com/password/authenticationmethod", postData2, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
}
if (httpResult3.StatusCode == HttpStatusCode.Found)
{
if (httpResult3.RedirectUrl.Contains("https://iforgot.apple.com/error"))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保选择加载失败.");
return false;
}
return VerifyBirthday(httpResult3.RedirectUrl, acount, newPwd, webHeaderCollection);
}
}
}
if (httpResult.StatusCode != HttpStatusCode.BadRequest && httpResult.StatusCode != HttpStatusCode.Unauthorized)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知错误#2");
return false;
}
if (httpResult.Html.Contains("captchaAnswer.Invalid"))
{
APIUtlis.getCaptcha(2, captchaModel.payload.content);
return verifyAppleid(sstt, acount, newPwd, isCloseAuthen, RetryCount + 1, ckTailNumber);
}
ServiceErrorsModel serviceErrorsModel2 = Tools.Todejosn<ServiceErrorsModel>(httpResult.Html);
if (serviceErrorsModel2 != null)
{
if (serviceErrorsModel2.validationErrors != null && serviceErrorsModel2.validationErrors.Length != 0)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel2.validationErrors[0].message);
return false;
}
if (serviceErrorsModel2.service_errors != null && serviceErrorsModel2.service_errors.Length != 0)
{
string message2 = serviceErrorsModel2.service_errors[0].message;
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel2.service_errors[0].message);
if (CheckAppleId && !message2.Contains("未知") && !message2.Contains("错误"))
{
return true;
}
return false;
}
if (serviceErrorsModel2.serviceErrors != null && serviceErrorsModel2.serviceErrors.Length != 0)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "失败,异常:" + serviceErrorsModel2.serviceErrors[0].message);
return false;
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "请求失败");
}
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证码获取失败#2");
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证码获取失败");
return false;
}
private bool VerifyBirthday(string RedirectUrl, AppleAcount acount, string newPwd, WebHeaderCollection webHeader)
{
string text = "";
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在验证生日");
HttpResult webJsonContent = getWebJsonContent(RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
text = webJsonContent.Header["sstt"];
webHeader["sstt"] = text;
string[] array = acount.birthday.Split('-');
string postData = "{\"monthOfYear\":\"" + array[1] + "\",\"dayOfMonth\":\"" + array[2] + "\",\"year\":\"" + array[0] + "\"}";
HttpResult httpResult = postWebContent("https://iforgot.apple.com/password/verify/birthday", postData, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult.StatusCode != HttpStatusCode.Found)
{
if (httpResult.StatusCode == HttpStatusCode.BadRequest)
{
ServiceErrorsModel serviceErrors = Tools.Todejosn<ServiceErrorsModel>(httpResult.Html);
string serviceError = getServiceError(serviceErrors);
if (!string.IsNullOrEmpty(serviceError))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "生日验证失败:" + serviceError);
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证生日出现未知错误");
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "网络异常...#Birthday," + (int)httpResult.StatusCode);
return false;
}
if (!httpResult.RedirectUrl.ToLower().StartsWith("https://iforgot.apple.com/password/authenticationmethod"))
{
return VerifyQuestions(httpResult.RedirectUrl, acount, newPwd, webHeader);
}
webHeader["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
HttpResult webJsonContent2 = getWebJsonContent(httpResult.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent2.StatusCode != HttpStatusCode.OK)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保获取失败2");
return false;
}
if (!webJsonContent2.Html.Contains("questions"))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "没有重设密码的方式#2");
return false;
}
text = webJsonContent2.Header["sstt"];
webHeader["sstt"] = text;
HttpResult httpResult2 = postWebContent("https://iforgot.apple.com/password/authenticationmethod", "{\"type\":\"questions\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult2.StatusCode == HttpStatusCode.Found)
{
return VerifyQuestions(httpResult2.RedirectUrl, acount, newPwd, webHeader);
}
}
return false;
}
public bool VerifyQuestions(string RedirectUrl, AppleAcount acount, string newPwd, WebHeaderCollection webHeader)
{
string text = "";
HttpResult webJsonContent = getWebJsonContent(RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
int num = 0;
HttpResult httpResult;
while (true)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在验证密保");
text = webJsonContent.Header["sstt"];
webHeader["sstt"] = text;
AothQuestions aothQuestions = Tools.Todejosn<AothQuestions>(webJsonContent.Html);
string[] array = new string[3] { acount.appleQt1, acount.appleQt2, acount.appleQt3 };
AothQuestions aothQuestions2 = new AothQuestions();
aothQuestions2.questions = new AothQuestions.Question[2];
int num2 = 0;
AothQuestions.Question[] questions = aothQuestions.questions;
foreach (AothQuestions.Question question in questions)
{
string answer = array[Tools.getAnwerId_Index(question.id) - 1];
aothQuestions2.questions[num2] = new AothQuestions.Question
{
id = question.id,
answer = answer,
number = question.number,
question = question.question
};
num2++;
}
string postData = Tools.Toenjson(aothQuestions2);
httpResult = postWebContent("https://iforgot.apple.com/password/verify/questions", postData, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult.StatusCode == HttpStatusCode.Found)
{
HttpResult webJsonContent2 = getWebJsonContent(httpResult.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent2.StatusCode == HttpStatusCode.Found)
{
text = httpResult.Header["sstt"];
webHeader["sstt"] = text;
return restPwd(webJsonContent2.RedirectUrl, newPwd, webHeader);
}
if (webJsonContent2.StatusCode == HttpStatusCode.OK && webJsonContent2.Html.Contains("unlock_account"))
{
text = webJsonContent2.Header["sstt"];
webHeader["sstt"] = text;
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在解锁密码");
HttpResult httpResult2 = postWebContent("https://iforgot.apple.com/password/reset/options", "{\"type\":\"unlock_account\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult2.StatusCode == HttpStatusCode.Found)
{
HttpResult webJsonContent3 = getWebJsonContent(httpResult2.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent3.StatusCode == HttpStatusCode.OK)
{
text = webJsonContent3.Header["sstt"];
webHeader["sstt"] = text;
HttpResult httpResult3 = postWebContent("https://iforgot.apple.com/password/unlock/forgot", "{}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult3.StatusCode == HttpStatusCode.Found)
{
return restPwd(httpResult3.RedirectUrl, newPwd, webHeader);
}
}
}
}
}
else
{
if (httpResult.StatusCode != HttpStatusCode.BadRequest)
{
break;
}
ServiceErrorsModel serviceErrors = Tools.Todejosn<ServiceErrorsModel>(httpResult.Html);
string serviceError = getServiceError(serviceErrors);
if (string.IsNullOrEmpty(serviceError))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保出现未知错误");
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保失败:" + serviceError);
if (!serviceError.Contains("发生未知错误") || num >= base.MaxRetryCount)
{
return false;
}
Thread.Sleep(3000);
if (num != 0)
{
base.ProxyIp = "";
}
num++;
}
if (num >= base.MaxRetryCount)
{
return false;
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, string.Concat("验证密保出现未知错误#1(", httpResult.StatusCode, ")"));
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保获取失败");
return false;
}
private bool restPwd(string RedirectUrl, string newPwd, WebHeaderCollection webHeader, int retry = 0)
{
HttpResult webJsonContent = getWebJsonContent(RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
string value = webJsonContent.Header["sstt"];
webHeader["sstt"] = value;
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在设置新密码");
HttpResult httpResult = postWebContent("https://iforgot.apple.com/password/reset", "{\"password\":\"" + newPwd + "\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult.StatusCode == HttpStatusCode.BadRequest || httpResult.StatusCode == HttpStatusCode.Unauthorized)
{
ServiceErrorsModel serviceErrorsModel = Tools.Todejosn<ServiceErrorsModel>(httpResult.Html);
if (serviceErrorsModel != null)
{
string serviceError = getServiceError(serviceErrorsModel);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "设置密码异常:" + serviceError);
if (serviceError.Contains("不能包含") || serviceError.Contains("未使用过的密码"))
{
acount.notRepeatPwd = true;
}
if (serviceError.Contains("发生未知错误") && retry < base.MaxRetryCount)
{
Thread.Sleep(3000);
if (retry != 0)
{
base.ProxyIp = "";
}
return restPwd(RedirectUrl, newPwd, webHeader, retry + 1);
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "请求失败");
}
return false;
}
if (httpResult.StatusCode == (HttpStatusCode)260)
{
action?.Invoke(base.noticeKey, DisplyType.mima, newPwd);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密码重置完成");
AppSysConfig.proxyModels.Push(new ProxyModel2
{
prixyIp = base.ProxyIp,
applyDate = DateTime.Now
});
return true;
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知错误");
return false;
}
public bool unenrollment(string sstt, AppleAcount acount, string newPwd)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在关闭双重认证");
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.Add("X-Apple-I-FD-Client-Info", FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent));
webHeaderCollection.Add("sstt", sstt);
webHeaderCollection.Add("X-Requested-With", "XMLHttpRequest");
HttpResult webContent = getWebContent("https://iforgot.apple.com/password/verify/phone", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (webContent.StatusCode == HttpStatusCode.OK)
{
sstt = new Regex(AppSysConfig.getConfig("Regex_unenrollment")).Match(AppleNetworkBase.GetToken(webContent.Html, "boot_args", "script")).Groups[1].Value.Replace("\"", "").Replace(":", "").Replace(" ", "")
.Trim();
webContent.Html.Contains("forgotPasswordFlow\":true}");
if (!string.IsNullOrEmpty(sstt))
{
sstt = HttpUtility.UrlEncode(sstt);
webHeaderCollection["sstt"] = sstt;
webHeaderCollection["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
HttpResult httpResult = postWebContent("https://iforgot.apple.com/password/verify/phone/unenrollment", "", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult.StatusCode == HttpStatusCode.NotFound)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "该账户双重无法关闭");
return false;
}
if (httpResult.StatusCode == HttpStatusCode.Found)
{
HttpResult webJsonContent = getWebJsonContent(httpResult.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
sstt = webJsonContent.Header["sstt"];
webHeaderCollection["sstt"] = sstt;
webHeaderCollection["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在验证生日信息");
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
sstt = webJsonContent.Header["sstt"];
webHeaderCollection["sstt"] = sstt;
string[] array = acount.birthday.Split('-');
string postData = "{\"monthOfYear\":\"" + array[1].PadLeft(2, '0') + "\",\"dayOfMonth\":\"" + array[2].PadLeft(2, '0') + "\",\"year\":\"" + array[0] + "\"}";
HttpResult httpResult2 = postWebContent("https://iforgot.apple.com/unenrollment/verify/birthday", postData, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult2.StatusCode == HttpStatusCode.Found)
{
HttpResult webJsonContent2 = getWebJsonContent(httpResult2.RedirectUrl, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (webJsonContent2.StatusCode == HttpStatusCode.OK)
{
int num = 0;
HttpResult httpResult3;
while (true)
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在验证密保");
sstt = webJsonContent2.Header["sstt"];
webHeaderCollection["sstt"] = sstt;
AothQuestions aothQuestions = Tools.Todejosn<AothQuestions>(webJsonContent2.Html);
string[] array2 = new string[3] { acount.appleQt1, acount.appleQt2, acount.appleQt3 };
AothQuestions aothQuestions2 = new AothQuestions();
aothQuestions2.questions = new AothQuestions.Question[2];
int num2 = 0;
AothQuestions.Question[] questions = aothQuestions.questions;
foreach (AothQuestions.Question question in questions)
{
string answer = array2[Tools.getAnwerId_Index(question.id) - 1];
aothQuestions2.questions[num2] = new AothQuestions.Question
{
id = question.id,
answer = answer,
number = question.number,
question = question.question
};
num2++;
}
string postData2 = Tools.Toenjson(aothQuestions2);
httpResult3 = postWebContent("https://iforgot.apple.com/unenrollment/verify/questions", postData2, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult3.StatusCode == HttpStatusCode.Found && httpResult3.RedirectUrl.Contains("/error"))
{
Thread.Sleep(2000);
httpResult3 = postWebContent("https://iforgot.apple.com/unenrollment/verify/questions", postData2, "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
}
if (httpResult3.StatusCode != HttpStatusCode.Found)
{
if (httpResult3.StatusCode != HttpStatusCode.BadRequest)
{
break;
}
ServiceErrorsModel serviceErrors = Tools.Todejosn<ServiceErrorsModel>(httpResult3.Html);
string serviceError = getServiceError(serviceErrors);
if (!string.IsNullOrEmpty(serviceError))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保失败:" + serviceError);
if (serviceError.Contains("发生未知错误") && num < base.MaxRetryCount)
{
Thread.Sleep(3000);
if (num != 0)
{
base.ProxyIp = "";
}
num++;
if (num >= base.MaxRetryCount)
{
return false;
}
continue;
}
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保出现未知错误");
return false;
}
if (httpResult3.RedirectUrl == "https://iforgot.apple.com/error")
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "密保验证返回错误。");
return false;
}
return unenrollmentRestPwd(httpResult3.RedirectUrl, newPwd, webHeaderCollection);
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, string.Concat("验证密保出现未知错误#1(", httpResult3.StatusCode, ")"));
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证密保获取失败");
return false;
}
if (httpResult2.StatusCode == HttpStatusCode.BadRequest)
{
ServiceErrorsModel serviceErrors2 = Tools.Todejosn<ServiceErrorsModel>(httpResult2.Html);
string serviceError2 = getServiceError(serviceErrors2);
if (!string.IsNullOrEmpty(serviceError2))
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "生日验证失败:" + serviceError2);
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "验证生日出现未知错误");
return false;
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "网络异常...2#Birthday," + (int)httpResult2.StatusCode);
return false;
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "网络异常");
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "网络异常");
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "双重手机号码认证失败");
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "双重手机号码获取失败");
}
return false;
}
private bool unenrollmentRestPwd(string RedirectUrl, string newPwd, WebHeaderCollection webHeader, int retry = 0)
{
HttpResult webJsonContent = getWebJsonContent(RedirectUrl, "https://iforgot.apple.com/unenrollment/verify/appleid?language=" + language, webHeader);
if (webJsonContent.StatusCode == HttpStatusCode.OK)
{
string value = webJsonContent.Header["sstt"];
webHeader["sstt"] = value;
webHeader["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
HttpResult httpResult = postWebContent("https://iforgot.apple.com/unenrollment", "", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader);
if (httpResult.StatusCode == HttpStatusCode.Found)
{
value = httpResult.Header["sstt"];
webHeader["sstt"] = value;
webHeader["X-Apple-I-FD-Client-Info"] = FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "正在设置新密码");
HttpResult httpResult2 = postWebContent("https://iforgot.apple.com/unenrollment/reset", "{\"password\":\"" + newPwd + "\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeader, "application/json, text/javascript, *; q=0.01");
if (httpResult2.StatusCode == HttpStatusCode.BadRequest || httpResult2.StatusCode == HttpStatusCode.Unauthorized)
{
ServiceErrorsModel serviceErrorsModel = Tools.Todejosn<ServiceErrorsModel>(httpResult2.Html);
if (serviceErrorsModel != null)
{
string serviceError = getServiceError(serviceErrorsModel);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "设置新密码异常:" + serviceError);
if (serviceError.Contains("不能包含") || serviceError.Contains("未使用过的密码"))
{
acount.notRepeatPwd = true;
}
if (serviceError.Contains("发生未知错误") && retry < base.MaxRetryCount)
{
Thread.Sleep(3000);
if (retry != 0)
{
base.ProxyIp = "";
}
return unenrollmentRestPwd(RedirectUrl, newPwd, webHeader, retry + 1);
}
}
else
{
action?.Invoke(base.noticeKey, DisplyType.xinxi, "请求失败");
}
return false;
}
if (httpResult2.StatusCode == (HttpStatusCode)260)
{
acount.applePwd = newPwd;
action?.Invoke(base.noticeKey, DisplyType.mima, newPwd);
action?.Invoke(base.noticeKey, DisplyType.xinxi, "双重关闭成功,密码重置完成");
return true;
}
}
}
action?.Invoke(base.noticeKey, DisplyType.xinxi, "未知错误");
return false;
}
private CaptchaModel getCaptcha(string sstt)
{
WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
webHeaderCollection.Add("X-Apple-I-FD-Client-Info", FDClientInfoHelp.getAppleIFDClientInfo(base.userAgent));
webHeaderCollection.Add("sstt", sstt);
HttpResult httpResult = postWebContent("https://iforgot.apple.com/captcha", "{\"type\":\"IMAGE\"}", "https://iforgot.apple.com/password/verify/appleid?language=" + language, webHeaderCollection);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
return Tools.Todejosn<CaptchaModel>(httpResult.Html);
}
return null;
}
}
}

View File

@@ -0,0 +1,26 @@
namespace AppleBatch_June.AppleWebServace
{
public class AuthsigninConfig
{
public string Apple_Widget_Key { get; set; } = "";
public string iframeId { get; set; } = "";
public string redirectURI { get; set; } = "";
public string homeLanguage { get; set; } = "";
public string authUrl { get; set; } = "";
public string refererUrl { get; set; } = "https://appleid.apple.com";
public string domainId { get; set; } = "";
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
namespace AppleBatch_June.Domain
{
public class FormGiftcardBalanceBackup
{
}
}

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
namespace AppleBatch_June.Domain
{
public class GiftcardBalanceManage
{
public static Dictionary<string, GiftcardBalanceStandby> nationGiftcardBalance = new Dictionary<string, GiftcardBalanceStandby>();
public static object loginLockObj = new object();
public static bool AddGifStandby(string _storeAppleHostLists, string appleId, string applePwd)
{
string text = _storeAppleHostLists;
if (string.IsNullOrEmpty(text))
{
text = "us";
}
string text2 = text + "_" + appleId;
lock (loginLockObj)
{
if (nationGiftcardBalance.ContainsKey(text2))
{
_ = nationGiftcardBalance[text2];
}
List<string> list = new List<string>();
foreach (KeyValuePair<string, GiftcardBalanceStandby> item in nationGiftcardBalance)
{
if (item.Key.StartsWith(text + "_") && item.Key != text2)
{
list.Add(item.Key);
}
}
foreach (string item2 in list)
{
nationGiftcardBalance.Remove(item2);
}
if (!nationGiftcardBalance.ContainsKey(text2))
{
nationGiftcardBalance.Add(text2, new GiftcardBalanceStandby(_storeAppleHostLists, appleId, applePwd));
}
return true;
}
}
public static GiftcardBalanceStandby GetStandby(string nation, string appleId)
{
if (string.IsNullOrEmpty(nation))
{
nation = "us";
}
string key = nation + "_" + appleId;
if (nationGiftcardBalance.ContainsKey(key))
{
GiftcardBalanceStandby giftcardBalanceStandby = nationGiftcardBalance[key];
giftcardBalanceStandby.upTime = DateTime.Now;
return giftcardBalanceStandby;
}
return null;
}
}
}

View File

@@ -0,0 +1,235 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.Domain
{
public class GiftcardBalanceStandby
{
public Dictionary<string, GiftcardBalanceWeb> GiftcardBalanceCookieItems = new Dictionary<string, GiftcardBalanceWeb>();
private DateTime loginTime = DateTime.Now.AddHours(-1.0);
public int itemsMaxCount = 50;
public Action<string, DisplyType, string> checkAction;
public readonly object removeLock = new object();
private int timeCheckCountMax = 5;
private readonly object lockRandomGiftcard = new object();
private string appleId { get; set; }
private string applePwd { get; set; }
private string storeAppleHostLists { get; set; } = "";
public bool startVpn { get; set; }
public DateTime upTime { get; set; } = DateTime.Now;
public int removeChekOverdueMinute { get; set; } = 120;
private int GetGiftCount { get; set; }
public DateTime addGiftcardLostTime { get; set; } = DateTime.Now;
public GiftcardBalanceStandby(string _storeAppleHostLists, string _appleId, string _applePwd)
{
appleId = _appleId;
applePwd = _applePwd;
storeAppleHostLists = _storeAppleHostLists;
if (_storeAppleHostLists.ToLower() == "us")
{
storeAppleHostLists = "";
}
string config = AppSysConfig.getConfig("BalanceStandbyCout");
removeChekOverdueMinute = Tools.ToInt(AppSysConfig.getConfig("removeChekOverdueMinute"), 120);
if (!string.IsNullOrEmpty(config) && config.Split(',').Length == 2)
{
if (int.TryParse(config.Split(',')[0], out var result))
{
itemsMaxCount = result;
}
if (int.TryParse(config.Split(',')[1], out var result2))
{
timeCheckCountMax = result2;
}
}
}
public void removeChek()
{
lock (removeLock)
{
List<string> list = new List<string>();
foreach (KeyValuePair<string, GiftcardBalanceWeb> giftcardBalanceCookieItem in GiftcardBalanceCookieItems)
{
string s = giftcardBalanceCookieItem.Key.Split(',')[0];
if (DateTime.Now.AddMinutes(-removeChekOverdueMinute) > DateTime.Parse(s))
{
list.Add(giftcardBalanceCookieItem.Key);
}
}
foreach (string item in list)
{
GiftcardBalanceCookieItems.Remove(item);
}
}
}
public void check(bool _startVpn, Action<string, DisplyType, string> _action)
{
checkAction = _action;
startVpn = _startVpn;
removeChek();
if (GiftcardBalanceCookieItems.Count <= itemsMaxCount && DateTime.Now.AddSeconds(-30.0) > loginTime)
{
loginTime = DateTime.Now;
int num = ((GiftcardBalanceCookieItems.Count >= 10) ? 1 : 2);
if (timeCheckCountMax > 5)
{
num = 1;
}
for (int i = 0; i < num; i++)
{
Task.Run(() => LoginTask(storeAppleHostLists, appleId, applePwd, startVpn));
}
}
checkAction?.Invoke("", DisplyType.mima, GiftcardBalanceCookieItems.Count.ToString());
}
public GiftcardBalanceWeb GetRandomGiftcard(bool _startVpn = false, bool isrunTask = true)
{
if (_startVpn)
{
startVpn = _startVpn;
}
removeChek();
lock (lockRandomGiftcard)
{
string nowTimeCheck = DateTime.Now.ToString("yyMMddHHmm");
List<KeyValuePair<string, GiftcardBalanceWeb>> list = GiftcardBalanceCookieItems.Where((KeyValuePair<string, GiftcardBalanceWeb> c) => ((c.Value.timeCheck == nowTimeCheck && c.Value.timeCheckCount < timeCheckCountMax) || c.Value.timeCheck != nowTimeCheck) && long.Parse(nowTimeCheck) >= long.Parse(c.Value.timeCheck)).ToList();
if (list != null && list.Count > 0)
{
if (GetGiftCount >= 10000)
{
GetGiftCount = 0;
}
int index = GetGiftCount % list.Count;
GetGiftCount++;
GiftcardBalanceWeb value = list[index].Value;
if (value.timeCheck == nowTimeCheck)
{
value.timeCheckCount++;
}
else
{
value.timeCheckCount = 1;
value.timeCheck = DateTime.Now.AddMinutes(0.8).ToString("yyMMddHHmm");
}
value.StdndbyKey = list[index].Key;
return value;
}
}
if (GiftcardBalanceCookieItems.Count == 0 && DateTime.Now.AddSeconds(-30.0) > loginTime && isrunTask)
{
loginTime = DateTime.Now;
Task.Run(() => LoginTask(storeAppleHostLists, appleId, applePwd, startVpn));
}
return null;
}
public void RunLoginTask(bool _startVpn)
{
startVpn = _startVpn;
if (GiftcardBalanceCookieItems.Count <= itemsMaxCount)
{
Task.Run(() => LoginTask(storeAppleHostLists, appleId, applePwd, startVpn));
}
removeChek();
}
public void AddGiftcardBalance(GiftcardBalanceWeb giftcard)
{
if (giftcard != null && giftcard.storeAppleHostLists == storeAppleHostLists)
{
addGiftcardLostTime = DateTime.Now;
GiftcardBalanceCookieItems.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "," + Guid.NewGuid().ToString("n"), giftcard);
checkAction?.Invoke("", DisplyType.mima, GiftcardBalanceCookieItems.Count.ToString());
}
}
public void Reset(string _storeAppleHostLists)
{
storeAppleHostLists = _storeAppleHostLists;
GiftcardBalanceCookieItems.Clear();
}
public GiftcardBalanceWeb LoginTask(string _storeAppleHostLists, string appleId, string applePwd, bool startVpn)
{
try
{
BaseFormTaskRunState baseFormTaskRunState = new BaseFormTaskRunState("GiftcardBalanceStandby");
baseFormTaskRunState.isRun = true;
GiftcardBalanceWeb giftcardBalanceWeb = new GiftcardBalanceWeb(_storeAppleHostLists, null, null, baseFormTaskRunState);
giftcardBalanceWeb.isUpProxyAccountCache = false;
if (giftcardBalanceWeb.shopSignIn(appleId.Trim(), applePwd, startVpn, out var _) && giftcardBalanceWeb.storeAppleHostLists == storeAppleHostLists)
{
addGiftcardLostTime = DateTime.Now;
GiftcardBalanceCookieItems.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "," + Guid.NewGuid().ToString("n"), giftcardBalanceWeb);
checkAction?.Invoke("", DisplyType.mima, GiftcardBalanceCookieItems.Count.ToString());
return giftcardBalanceWeb;
}
}
catch (Exception ex)
{
APIUtlis.ApiSeriveError(ex);
}
return null;
}
public void removeGiftcardBalance(string key)
{
lock (removeLock)
{
GiftcardBalanceCookieItems.Remove(key);
}
checkAction?.Invoke("", DisplyType.mima, GiftcardBalanceCookieItems.Count.ToString());
if (GiftcardBalanceCookieItems.Count <= itemsMaxCount)
{
loginTime = DateTime.Now;
Task.Run(() => LoginTask(storeAppleHostLists, appleId, applePwd, startVpn));
}
}
public GiftcardBalanceWeb getGiftcardBalanceCookie()
{
if (GiftcardBalanceCookieItems.Count >= 1)
{
KeyValuePair<string, GiftcardBalanceWeb> keyValuePair = GiftcardBalanceCookieItems.First();
if (keyValuePair.Value != null)
{
GiftcardBalanceCookieItems.Remove(keyValuePair.Key);
checkAction?.Invoke("", DisplyType.mima, GiftcardBalanceCookieItems.Count.ToString());
if (GiftcardBalanceCookieItems.Count <= itemsMaxCount)
{
loginTime = DateTime.Now;
Task.Run(() => LoginTask(storeAppleHostLists, appleId, applePwd, startVpn));
}
return keyValuePair.Value;
}
}
return null;
}
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
using DotNet.Utilities;
namespace AppleBatch_June.Domain
{
public class GiftcardBalanceStandbyItem
{
public List<CookieItem> listCookie = new List<CookieItem>();
public string storeAppleHost { get; set; }
public string xaosstk { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.Net;
using System.Web.Script.Serialization;
using AppleBatch_June.Model;
using DotNet.Utilities;
namespace AppleBatch_June.Domain
{
public class NationalData
{
private static string nationJson = string.Empty;
public List<NationalList> getMation()
{
if (nationJson == string.Empty)
{
HttpResult html = new HttpHelper().GetHtml(new HttpItem
{
URL = "https://teluns-api.oss-cn-shenzhen.aliyuncs.com/nation.json",
Timeout = 8000
});
if (html.StatusCode == HttpStatusCode.OK)
{
nationJson = html.Html;
}
}
if (nationJson != string.Empty)
{
return new JavaScriptSerializer().Deserialize<List<NationalList>>(nationJson);
}
return new List<NationalList>();
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Net;
using DotNet.Utilities;
namespace AppleBatch_June.Domain
{
public class SelectShippingOptionNullData
{
private static string SelectShippingOptionNullJson = string.Empty;
private static string SelectShippingOptionAdditionaFieldsJson = string.Empty;
public string getSelectShippingOption()
{
if (SelectShippingOptionNullJson == string.Empty)
{
HttpResult html = new HttpHelper().GetHtml(new HttpItem
{
URL = ApiNetReq.host + "/js/selectShippingOptionNull.Json",
Timeout = 8000
});
if (html.StatusCode == HttpStatusCode.OK)
{
SelectShippingOptionNullJson = html.Html;
getSelectShippingAdditionaFieldsn();
}
if (string.IsNullOrEmpty(SelectShippingOptionNullJson))
{
SelectShippingOptionNullJson = "#st\r\nkey!checkout-fulfillment-deliveryTab-delivery-location-address-postalCode;\r\nurl!/shop/checkoutx?_a=calculate&_m=checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address;\r\npost!checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.postalCode={postalCode};\r\nparam!postalCode;\r\nvalue!p.postalCode;\r\n#end\r\n\r\n#st\r\nkey!checkout.fulfillment.deliveryTab.delivery.deliveryLocation;\r\nurl!/shop/checkoutx?_a=Apply&_m=checkout.fulfillment.deliveryTab.delivery.deliveryLocation;\r\npost!checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryLocationSelection.state={state}&checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryLocationSelection.postalCode={postalCode}&checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryLocationSelection.cityTypeAhead.city={city};\r\nparam!state,postalCode,city;\r\nvalue!r.0,p.postalCode,p.city;\r\nr!abs.DeliveryLocationSelection([\\s\\S]*?)abstract-\"value\":\"([\\s\\S]*?)\"|;\r\n#end\r\n\r\n#st\r\nkey!checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryWarmingSubLayout;\r\nurl!/shop/checkoutx?_a=state-warm-up&_m=checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryWarmingSubLayout;\r\npost!checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryWarmingSubLayout.postalCode={postalCode}&checkout.fulfillment.deliveryTab.delivery.deliveryLocation.address.deliveryWarmingSubLayout.state={state};\r\nparam!state,postalCode;\r\nvalue!r.0,p.postalCode;\r\nr!abs.DeliveryWarmingSubLayout([\\s\\S]*?)layout-\"value\":\"([\\s\\S]*?)\"|;\r\n#end";
}
}
return SelectShippingOptionNullJson;
}
public string getSelectShippingAdditionaFieldsn()
{
if (SelectShippingOptionAdditionaFieldsJson == string.Empty)
{
HttpResult html = new HttpHelper().GetHtml(new HttpItem
{
URL = ApiNetReq.host + "/js/SelectShippingOptionAdditionaFieldsJson.Json",
Timeout = 8000
});
if (html.StatusCode == HttpStatusCode.OK)
{
SelectShippingOptionAdditionaFieldsJson = html.Html;
}
if (string.IsNullOrEmpty(SelectShippingOptionAdditionaFieldsJson))
{
SelectShippingOptionAdditionaFieldsJson = "BRA:checkout.shipping.addressSelector.newAddress.address.zipLookup.state=Amazonas&checkout.shipping.addressSelector.newAddress.address.zipLookup.district=aaaa&checkout.shipping.taxInformation.taxIdType=CPF&checkout.shipping.taxInformation.cpf.cpf=007.408.869-67";
}
}
return SelectShippingOptionAdditionaFieldsJson;
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using AppleBatch_June.Model;
namespace AppleBatch_June.Domain
{
public class UserNationalData
{
private string path => AppDomain.CurrentDomain.BaseDirectory;
private string mvationPath => path + "userNationalData.json";
public List<NationalList> getMation()
{
if (File.Exists(mvationPath))
{
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
string input = Tools.readFile(mvationPath, Encoding.UTF8);
return javaScriptSerializer.Deserialize<List<NationalList>>(input);
}
return new List<NationalList>();
}
public void saveMation(NationalList item)
{
List<NationalList> mation = getMation();
mation.Add(item);
string contents = new JavaScriptSerializer().Serialize(mation);
File.WriteAllText(mvationPath, contents, Encoding.UTF8);
}
public void removeMation(string code)
{
List<NationalList> mation = getMation();
NationalList nationalList = mation.Where((NationalList c) => c.Id == code).FirstOrDefault();
if (nationalList != null)
{
mation.Remove(nationalList);
string contents = new JavaScriptSerializer().Serialize(mation);
File.WriteAllText(mvationPath, contents, Encoding.UTF8);
}
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class AccountCheckTask : BaseTask
{
public static AccountCheckTask Instance { get; private set; }
static AccountCheckTask()
{
Instance = new AccountCheckTask("账号检测");
}
public AccountCheckTask(string _taskName)
: base(_taskName)
{
}
public async void appleAccountCheck(AppleAcount account, Action<string, AppleItunesLogin> action, Action<string, DisplyType, string> _applyAction, bool _OpenVpn)
{
base.isRun = true;
Tuple<string, AppleItunesLogin> tuple = await Task.Run(delegate
{
ApiNetReq.startNowFun = 9;
base.TaskIsRun = true;
AppleItunesLogin itunesLoginRef = null;
try
{
string msg = "";
HttpResult isLogin = APIUtlis.getIsLogin(9);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(9).consNum)
{
if (new ItunesUtlis(this, account.appleId, _applyAction, _OpenVpn).getAccountStateMsg(account, ref msg, ref itunesLoginRef))
{
APIUtlis.ApiApplyAct(9, "Apple账号检测");
}
}
else
{
msg = "点数不足,请联系客服充值";
}
}
else
{
msg = ((dynamic)obj)["Message"];
}
}
else
{
msg = "网络请求失败,请重试";
}
return new Tuple<string, AppleItunesLogin>(msg, itunesLoginRef);
}
catch (Exception ex)
{
APIUtlis.ApiSeriveError(ex);
return new Tuple<string, AppleItunesLogin>(ex.Message, itunesLoginRef);
}
});
base.TaskIsRun = false;
base.isRun = false;
action?.Invoke(tuple.Item1, tuple.Item2);
}
}
}

View File

@@ -0,0 +1,503 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.SMS;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class ActivateiCloudTask : BaseTask
{
private static readonly object lockActClientObj;
private readonly Dictionary<string, object> actClientLockObjs = new Dictionary<string, object>();
public static ActivateiCloudTask Instance { get; private set; }
public static ActivateiCloudTask InstanceSub { get; private set; }
public int nasType { get; set; } = 1;
private ActiotiCloudConfig baseCloudConfig { get; set; }
private Action<string, DisplyType, string> baseAction { get; set; }
static ActivateiCloudTask()
{
Instance = null;
InstanceSub = null;
lockActClientObj = new object();
Instance = new ActivateiCloudTask("激活iCloud");
InstanceSub = new ActivateiCloudTask("激活iCloudSub");
}
public ActivateiCloudTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteLeaveFamily(int TaskSize, bool openVpn, ActiotiCloudConfig cloudConfig, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 30;
TaskSize = 4;
Task[] array = new Task[TaskSize];
List<Task> openAuthActionTask = new List<Task>();
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount listView = null;
try
{
lock (lvItems)
{
listView = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (listView == null)
{
break;
}
listView.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, listView.appleId))
{
int type = 40;
iCloundUtils icloud = new iCloundUtils(this, listView.appleId, _action, openVpn);
if (icloud.getIsLogin(40, _action))
{
_action?.Invoke(listView.appleId, DisplyType.chongzhi, "");
icloud.appleId = listView.appleId;
NasQualifyModel nasQualifyInfo = icloud.GetNasQualifyInfo(nasType);
bool flag = false;
if (nasQualifyInfo != null && !string.IsNullOrEmpty(nasQualifyInfo.nasQualify) && !string.IsNullOrEmpty(nasQualifyInfo.clientInfo) && !string.IsNullOrEmpty(nasQualifyInfo.userAgent))
{
string text = icloud.GetKeyValue("<key>client-id</key>", "<string>", "</string>", nasQualifyInfo.postData);
if (string.IsNullOrEmpty(text))
{
text = "9B134D07-1389-4872-A249-9DF756337B97";
}
lock (lockActClientObj)
{
if (!actClientLockObjs.ContainsKey(text))
{
actClientLockObjs.Add(text, new object());
}
}
string reflocalizedError = "";
bool flag2 = false;
lock (actClientLockObjs[text])
{
flag2 = icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref reflocalizedError);
}
if (!flag2)
{
int num = 0;
while ((reflocalizedError == "MOBILEME_CREATE_UNAVAILABLE" || reflocalizedError == "MOBILEME_TERMS_OF_SERVICE_UPDATE" || string.IsNullOrEmpty(reflocalizedError)) && base.isRun && num <= 5)
{
num++;
nasQualifyInfo = icloud.GetNasQualifyInfo(nasType);
if (nasQualifyInfo != null && !string.IsNullOrEmpty(nasQualifyInfo.nasQualify) && !string.IsNullOrEmpty(nasQualifyInfo.clientInfo) && !string.IsNullOrEmpty(nasQualifyInfo.userAgent))
{
if (flag2 = icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref reflocalizedError))
{
ApiApplyAct(type, "激活iCloud");
reflocalizedError = "Success";
break;
}
Thread.Sleep(1000);
if (reflocalizedError == "MOBILEME_CREATE_UNAVAILABLE" || reflocalizedError == "MOBILEME_TERMS_OF_SERVICE_UPDATE" || (string.IsNullOrEmpty(reflocalizedError) && base.isRun && num <= 5))
{
_action?.Invoke(listView.appleId, DisplyType.xinxi, "重新激活..." + num);
Thread.Sleep(1000);
}
}
}
if (reflocalizedError == "ACCOUNT_INVALID_HSA_TOKEN" || reflocalizedError == "HSA2_NEEDS_2FA_AUTH" || (reflocalizedError == "ACCOUNT_UNAVAILABLE" && cloudConfig.isOpenAuthAction))
{
AppleManageWeb webUtlis = new AppleManageWeb(openVpn, _action, _action, this);
baseCloudConfig = cloudConfig;
baseAction = _action;
flag = true;
openAuthActionTask.Add(Task.Run(delegate
{
try
{
if (reflocalizedError == "ACCOUNT_UNAVAILABLE" && AuthActionTask(webUtlis, listView, cloudConfig))
{
Thread.Sleep(5000);
AutoActioniCloud(icloud, listView, forgotAttempt: false, nasQualifyInfo);
}
if (reflocalizedError == "ACCOUNT_INVALID_HSA_TOKEN" || reflocalizedError == "HSA2_NEEDS_2FA_AUTH")
{
AutoActioniCloud(icloud, listView, forgotAttempt: false, nasQualifyInfo);
}
}
catch (Exception ex3)
{
APIUtlis.ApiSeriveError(ex3);
_action?.Invoke(listView.appleId, DisplyType.xinxi, ex3.Message);
}
finally
{
sucessAct?.Invoke(listView.appleId);
}
}));
}
}
}
else
{
_action?.Invoke(listView.appleId, DisplyType.xinxi, "数据加载失败..");
}
if (!flag)
{
sucessAct?.Invoke(listView.appleId);
}
}
goto IL_07d3;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (listView != null)
{
_action?.Invoke(listView.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_07d3;
}
continue;
IL_07d3:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
Task.WaitAll(openAuthActionTask.ToArray());
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
foreach (Task item in openAuthActionTask)
{
item.Dispose();
}
openAuthActionTask = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
public bool AuthActionTask(AppleManageWeb webUtlis, AppleAcount listView, ActiotiCloudConfig _cloudConfig)
{
int num = 0;
while (true)
{
if (num < _cloudConfig.openNumber)
{
if (base.isRun)
{
listView.moblie = "18888888888";
webUtlis.listCookie.Clear();
webUtlis.ProxyIp = "";
listView.isAccountException = false;
if (webUtlis.OpenAuthen(listView, new AppleChangeItem
{
countryCode = _cloudConfig.smsCountry,
mode = "sms"
}, actGetCode, listView.appleId))
{
return true;
}
if (listView.isHsa2)
{
return true;
}
if (listView.isAccountException)
{
return false;
}
if (_cloudConfig.smsService == null)
{
break;
}
}
num++;
continue;
}
return false;
}
return false;
}
public bool AutoActioniCloud(iCloundUtils icloud, AppleAcount listView, bool forgotAttempt, NasQualifyModel nasQualifyInfo)
{
string moblie = listView.moblie;
if (!string.IsNullOrEmpty(moblie))
{
if (nasQualifyInfo != null && !string.IsNullOrEmpty(nasQualifyInfo.nasQualify) && !string.IsNullOrEmpty(nasQualifyInfo.clientInfo) && !string.IsNullOrEmpty(nasQualifyInfo.userAgent))
{
string text = icloud.GetKeyValue("<key>client-id</key>", "<string>", "</string>", nasQualifyInfo.postData);
if (string.IsNullOrEmpty(text))
{
text = "9B134D07-1389-4872-A249-9DF756337B97";
}
string localizedError = "";
CookieItem cookieItem = icloud.listCookie.Where((CookieItem c) => c.Key == "repairSteps").FirstOrDefault();
if (cookieItem == null)
{
if (icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref localizedError))
{
return true;
}
if (localizedError == "MOBILEME_CREATE_UNAVAILABLE" || localizedError == "MOBILEME_UNSUPPORTED_DEVICE" || string.IsNullOrEmpty(localizedError))
{
int num = 0;
do
{
nasQualifyInfo = icloud.GetNasQualifyInfo(nasType);
if (!icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref localizedError))
{
Thread.Sleep(2000);
num++;
continue;
}
return true;
}
while ((localizedError == "MOBILEME_CREATE_UNAVAILABLE" || localizedError == "MOBILEME_UNSUPPORTED_DEVICE" || string.IsNullOrEmpty(localizedError)) && num < 5);
}
if (localizedError != "ACCOUNT_INVALID_HSA_TOKEN" && localizedError != "HSA2_NEEDS_2FA_AUTH")
{
return false;
}
}
string errmess = "";
string icMsmCode = "";
if (icloud.iCloudVerifyauthen(listView.appleId, listView.applePwd, moblie, nasQualifyInfo, actGetCode, ref errmess, ref icMsmCode))
{
if (localizedError != "HSA2_NEEDS_2FA_AUTH")
{
icMsmCode = "";
}
if (!icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref localizedError, isAgree: false, icMsmCode))
{
for (int i = 0; i < 5; i++)
{
if (!(localizedError == "MOBILEME_CREATE_UNAVAILABLE") && !(localizedError == "MOBILEME_UNSUPPORTED_DEVICE") && !string.IsNullOrEmpty(localizedError))
{
break;
}
nasQualifyInfo = icloud.GetNasQualifyInfo(nasType);
if (nasQualifyInfo != null && !string.IsNullOrEmpty(nasQualifyInfo.nasQualify) && !string.IsNullOrEmpty(nasQualifyInfo.clientInfo) && !string.IsNullOrEmpty(nasQualifyInfo.userAgent) && icloud.ActioniCloud(listView.appleId, listView.applePwd, nasQualifyInfo.nasQualify, nasQualifyInfo.clientInfo, text, ref localizedError, isAgree: false, icMsmCode))
{
break;
}
}
}
if (!string.IsNullOrEmpty(baseCloudConfig.ActivaNewPwd))
{
AppleiForgotWeb appleiForgotWeb = new AppleiForgotWeb(icloud.openVpn, baseAction, null, this);
bool flag = false;
int num2 = 0;
string text2 = baseCloudConfig.ActivaNewPwd;
while (!(flag = appleiForgotWeb.RetrievePassword(listView, text2, listView.appleId, isCloseAuthen: true)))
{
if (!listView.notAuthen)
{
if (listView.notRepeatPwd)
{
Thread.Sleep(2000);
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "关双失败,切换备用密码....");
text2 = baseCloudConfig.ActivaStandbyPwd;
}
else
{
Thread.Sleep(2000);
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "关双失败,重新关闭....");
}
Thread.Sleep(1000);
num2++;
if (flag || !base.isRun || num2 >= 5)
{
break;
}
continue;
}
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "已没有双重,请验证密码[" + text2 + "]");
break;
}
}
}
else if (!string.IsNullOrEmpty(baseCloudConfig.ActivaStandbyPwd) && !forgotAttempt && errmess.Contains("输入的代码无效"))
{
Thread.Sleep(2000);
string text3 = baseCloudConfig.ActivaStandbyPwd;
int num3 = 0;
bool flag2 = false;
AppleiForgotWeb appleiForgotWeb2 = new AppleiForgotWeb(icloud.openVpn, baseAction, null, this);
do
{
if (!(flag2 = appleiForgotWeb2.RetrievePassword(listView, text3, listView.appleId, isCloseAuthen: true)))
{
if (listView.notRepeatPwd)
{
Thread.Sleep(2000);
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "验证不通过,关双失败,切换备用密码....");
text3 = baseCloudConfig.ActivaNewPwd;
}
else
{
Thread.Sleep(2000);
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "验证不通过,关双失败,重新关闭....");
}
Thread.Sleep(1000);
num3++;
continue;
}
listView.applePwd = text3;
cookieItem = icloud.listCookie.Where((CookieItem c) => c.Key == "repairSteps").FirstOrDefault();
if (cookieItem != null)
{
try
{
icloud.listCookie.Remove(cookieItem);
}
catch (Exception)
{
}
}
return AutoActioniCloud(icloud, listView, forgotAttempt: true, nasQualifyInfo);
}
while (!flag2 && base.isRun && num3 < 5);
}
}
else
{
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "数据加载失败..");
}
}
else
{
baseAction?.Invoke(listView.appleId, DisplyType.xinxi, "未输入手机号码");
}
return false;
}
public string actGetCode(string appleId, int type)
{
if (baseCloudConfig.smsService == null)
{
return baseCloudConfig.actGetCode?.Invoke(appleId, type);
}
if (type == 10)
{
baseCloudConfig.smsService.blackPhone(appleId);
}
switch (type)
{
case 11:
{
SmsRespon molieNumber = baseCloudConfig.smsService.getMolieNumber(ref appleId);
if (molieNumber.code == "0000")
{
return appleId;
}
return molieNumber.ErrMessage + "[" + baseCloudConfig.smsService.smsName + "]";
}
case 9:
{
string phone = "";
SmsRespon molieNumber2 = baseCloudConfig.smsService.getMolieNumber(ref phone);
if (molieNumber2.code == "0000")
{
return phone;
}
baseAction?.Invoke(appleId, DisplyType.xinxi, molieNumber2.ErrMessage + "[" + baseCloudConfig.smsService.smsName + "]");
return "";
}
case 1:
case 15:
case 16:
{
string value = new Regex("<([\\s\\S]*?)>").Match(appleId).Groups[1].Value;
string value2 = new Regex(":([\\s\\S]*?),").Match(appleId).Groups[1].Value;
if (string.IsNullOrEmpty(value))
{
break;
}
int num = ((type == 15) ? 15 : baseCloudConfig.getSmsMsgMaxCount);
string text = "";
for (int i = 0; i < num; i++)
{
if (!base.isRun)
{
continue;
}
SmsRespon sms = baseCloudConfig.smsService.getSms(value);
if (sms.code == "0000" && !string.IsNullOrEmpty(sms.Data))
{
string value3 = new Regex("([\\d]{6})").Match(sms.Data).Groups[1].Value;
if (!string.IsNullOrEmpty(value3))
{
return value3;
}
}
if (type == 15 || type == 16)
{
text = "ic";
}
baseAction?.Invoke(value2, DisplyType.xinxi, text + " 获取[" + value + "]短信...." + i + "[" + baseCloudConfig.smsService.smsName + "]");
Thread.Sleep(3000);
}
baseCloudConfig.smsService.releasePhone(value);
break;
}
}
return "";
}
}
}

View File

@@ -0,0 +1,155 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class AddRemoveFamilyMemberTask : BaseTask
{
public static AddRemoveFamilyMemberTask Instance { get; private set; }
static AddRemoveFamilyMemberTask()
{
Instance = new AddRemoveFamilyMemberTask("添加或移除家庭成员");
}
public AddRemoveFamilyMemberTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteAddRemoveFamilyMember(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 31;
Task[] array = new Task[1];
for (int i = 0; i < array.Length; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.lvItemGuid))
{
int type = 31;
iCloundUtils iCloundUtils2 = new iCloundUtils(this, appleAcount.lvItemGuid, _action, openVpn);
_action?.Invoke(appleAcount.lvItemGuid, DisplyType.chongzhi, "");
iCloundUtils2.appleId = appleAcount.appleId;
AppleiCloundLogin appleiCloundLogin = iCloundUtils2.loginDelegates(appleAcount.appleId, appleAcount.applePwd, type);
if (appleiCloundLogin != null)
{
iCloundUtils2.getFamilyDetails(appleiCloundLogin, iCloundUtils2);
if (iCloundUtils2.parentAccount.ToLower() == appleAcount.appleId.ToLower())
{
long result;
if (appleAcount.overflow != "del")
{
appleiCloundLogin.account = appleAcount.appleId;
iCloudVerifyCVVModel iCloudVerifyCVVModel = iCloundUtils2.getiTunesAccountPaymentInfo(appleiCloundLogin);
if (iCloudVerifyCVVModel != null)
{
iCloudVerifyCVVModel.securityCode = appleAcount.overflow;
string text = iCloundUtils2.verifyCVV(appleiCloundLogin, iCloudVerifyCVVModel);
if (!string.IsNullOrEmpty(text) && iCloundUtils2.addFamilyMember(appleiCloundLogin, appleAcount.newAppleId, appleAcount.newApplePopPwd, text))
{
ApiApplyAct(type, "添加或删除家庭成员");
}
}
}
else if (long.TryParse(appleAcount.newAppleId, out result))
{
if (iCloundUtils2.removeFamilyMember(appleiCloundLogin, appleAcount.newAppleId))
{
ApiApplyAct(type, "添加或删除家庭成员");
}
}
else
{
_action?.Invoke(appleAcount.lvItemGuid, DisplyType.xinxi, "失败移除请输入成员的Dsid");
}
}
else
{
_action?.Invoke(appleAcount.lvItemGuid, DisplyType.xinxi, "失败:请使用组织者账号添加或移除成员");
}
}
sucessAct?.Invoke(appleAcount.lvItemGuid);
goto IL_02a2;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.lvItemGuid, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_02a2;
}
continue;
IL_02a2:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class AppleAccountChangeTask : BaseTask
{
public static AppleAccountChangeTask Instance { get; set; }
static AppleAccountChangeTask()
{
Instance = new AppleAccountChangeTask("资料修改");
}
public AppleAccountChangeTask(string _taskName)
: base(_taskName)
{
}
public void AppleChangeTask(bool openVpn, bool errorGoint, int TaskSize, List<AppleAcount> lvItems, AppleChangeItem changeItem, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, int intType)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!openVpn)
{
TaskSize = 2;
}
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = intType;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
object lockObj = new object();
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lockObj)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(intType);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(intType).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
string accountName = "";
bool flag = false;
AppleChangeItem changeItem2 = new AppleChangeItem
{
newGuojia = changeItem.newGuojia,
newPwd = changeItem.newPwd,
newQt1 = changeItem.newQt1,
newQt2 = changeItem.newQt2,
newQt3 = changeItem.newQt3,
newshengri = changeItem.newshengri,
pay = changeItem.pay,
isDeleteDevice = changeItem.isDeleteDevice,
CreatePin = changeItem.CreatePin,
isRemoveRescueEmail = changeItem.isRemoveRescueEmail,
isUnlinkFamily = changeItem.isUnlinkFamily
};
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis(_action, _applyAtion, this).applyChangeAcount(appleAcount, changeItem2, errorGoint, openVpn, guidTag, ref accountName) : new AppleManageWeb(openVpn, _action, _applyAtion, this).applyChangeAcount(appleAcount, changeItem2, errorGoint, guidTag, ref accountName))
{
APIUtlis.ApiApplyAct(intType, (intType == 1) ? "修改资料" : "国家转换");
}
else if (!errorGoint)
{
base.isRun = false;
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_0706;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0706;
}
continue;
IL_0706:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,17 @@
namespace AppleBatch_June.ExecuteTasks
{
public class AppleChangAccountTask : AppleAccountChangeTask
{
public new static AppleChangAccountTask Instance { get; private set; }
static AppleChangAccountTask()
{
Instance = new AppleChangAccountTask("账号更改");
}
public AppleChangAccountTask(string _taskName)
: base(_taskName)
{
}
}
}

View File

@@ -0,0 +1,17 @@
namespace AppleBatch_June.ExecuteTasks
{
public class AppleChangeCityTask : AppleAccountChangeTask
{
public new static AppleChangeCityTask Instance { get; private set; }
static AppleChangeCityTask()
{
Instance = new AppleChangeCityTask("白ID转国家");
}
public AppleChangeCityTask(string _taskName)
: base(_taskName)
{
}
}
}

View File

@@ -0,0 +1,689 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class AppleNetworkBase
{
protected ITaskRunState taskState;
public bool openVpn;
protected Action<string, DisplyType, string> action;
private string _appleId;
public string ProxyIp { get; set; }
public string appleId
{
get
{
return _appleId;
}
set
{
_appleId = value;
}
}
public string notyKey { get; set; }
public AppleNetworkBase(ITaskRunState _taskState, string _notyKey, Action<string, DisplyType, string> _action = null, bool _OpenVpn = false)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
notyKey = _notyKey;
openVpn = _OpenVpn;
action = _action;
}
public bool getIsLogin(int type, Action<string, DisplyType, string> _action)
{
_action?.Invoke(notyKey, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(type);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(isLogin.Html);
if (val["Code"] == "0000")
{
if (val["Data"]["integral"] >= AppSysConfig.getTypeById(type).consNum)
{
return true;
}
_action?.Invoke(notyKey, DisplyType.xinxi, "点数不足,请联系客服充值");
}
else
{
_action?.Invoke(notyKey, DisplyType.xinxi, val["Message"]);
}
}
else
{
_action?.Invoke(notyKey, DisplyType.xinxi, "网络请求失败");
}
return false;
}
public string GetNoticeActKey(HttpItem item)
{
string result = notyKey;
if (item != null && item.Header != null)
{
string text = "noticeActKey";
if (item.Header.AllKeys.Contains(text))
{
result = item.Header[text];
lock (item)
{
item.Header.Remove(text);
return result;
}
}
}
return result;
}
public HttpResult GetHttpReuslt(HttpItem item, bool isContityNeet = true)
{
if (!taskState.isRun)
{
throw new Exception("停止执行");
}
using HttpHelper httpHelper = new HttpHelper();
string noticeActKey = GetNoticeActKey(item);
HttpResult httpResult = null;
int num = Tools.ToNetWorkInt(ConfigUtlis.getConfigValue("comNetworkConfig"), 0);
if (openVpn && num < 3)
{
bool flag = false;
int num2 = 1;
List<ProxyAccountModel> proxyAccountModel = ProxyAccountCache.GetProxyAccountModel(ProxyIp);
do
{
flag = false;
if (num == 0 || num == 1)
{
if (!string.IsNullOrEmpty(ProxyIp))
{
int secondsTimeOut = 15;
if (item.URL.Contains("redeemCode"))
{
secondsTimeOut = item.Timeout / 1000;
}
if (!ProxyRunService.CheckIpAlive(ProxyIp, secondsTimeOut))
{
ProxyIp = "";
}
}
if (string.IsNullOrEmpty(ProxyIp))
{
action?.Invoke(noticeActKey, DisplyType.xinxi, "正在获取代理IP..." + num2);
ProxyIp = ProxyRunService.getProxyIp(taskState, num2);
if (string.IsNullOrEmpty(ProxyIp))
{
if (taskState.isRun)
{
break;
}
throw new Exception("停止执行");
}
foreach (ProxyAccountModel item2 in proxyAccountModel)
{
item2.ProxyIp = ProxyIp;
}
action?.Invoke(noticeActKey, DisplyType.xinxi, "代理IP获取成功.." + num2);
}
if (ProxyIp.Split('|').Length == 4)
{
string[] array = ProxyIp.Split('|');
WebProxy webProxy = new WebProxy();
webProxy.Address = new Uri($"http://{array[0].Trim()}:{array[1].Trim()}");
webProxy.Credentials = new NetworkCredential(array[2].Trim(), array[3].Trim());
item.WebProxy = webProxy;
item.KeepAlive = false;
}
else if (!string.IsNullOrEmpty(ProxyIp))
{
item.WebProxy = new WebProxy(ProxyIp);
}
}
else if (num == 2)
{
WebProxy webProxy2 = new WebProxy();
webProxy2.Address = new Uri(string.Format("http://{0}:{1}", ConfigUtlis.getConfigValue("txtTpsHost"), ConfigUtlis.getConfigValue("txtTpsPort")));
webProxy2.Credentials = new NetworkCredential(ConfigUtlis.getConfigValue("txtTpsUserName"), ConfigUtlis.getConfigValue("txtTpsPwd"));
item.WebProxy = webProxy2;
}
if (item.Timeout > 35000 && isContityNeet)
{
item.Timeout = 35000;
}
if (item.ReadWriteTimeout > 35000)
{
item.ReadWriteTimeout = 35000;
}
if (num2 >= 2)
{
item.KeepAlive = false;
}
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
httpResult = httpHelper.GetHtml(item);
stopwatch.Stop();
if (httpResult.StatusCode != 0 && httpResult.StatusCode != (HttpStatusCode)441 && httpResult.StatusCode != HttpStatusCode.RequestTimeout && httpResult.StatusCode != HttpStatusCode.BadGateway && httpResult.StatusCode != HttpStatusCode.ServiceUnavailable && !(httpResult.Html == "操作已超时。"))
{
if (httpResult.StatusCode == HttpStatusCode.ProxyAuthenticationRequired)
{
ProxyRunService.removeIp(ProxyIp);
flag = true;
ProxyIp = string.Empty;
}
if (httpResult.Html.Contains("407 Proxy Authentication Required"))
{
ProxyRunService.removeIp(ProxyIp);
flag = true;
ProxyIp = string.Empty;
}
if (httpResult.Html.Contains("远程主机强迫关闭了一个现有的连接"))
{
ProxyRunService.removeIp(ProxyIp);
flag = true;
ProxyIp = string.Empty;
}
if ((item.Method.ToUpper() == "POST" || item.Method.ToUpper() == "PUT") && (httpResult.Html.Contains("发生未知错误") || httpResult.Html.Contains("BuyContentDisallowedForAccountFromFraudScoringTxn")))
{
ProxyRunService.removeIp(ProxyIp);
flag = true;
ProxyIp = string.Empty;
}
if (proxyAccountModel.Count == 0 && !string.IsNullOrEmpty(ProxyIp))
{
ProxyAccountCache.RestAllot(ProxyIp);
}
}
else
{
ProxyRunService.removeIp(ProxyIp);
flag = true;
ProxyIp = string.Empty;
}
num2++;
if (num2 > 50)
{
httpResult = null;
break;
}
}
while (flag && taskState.isRun && isContityNeet);
}
else
{
item.WebProxy = WebRequest.DefaultWebProxy;
httpResult = httpHelper.GetHtml(item);
}
if (httpResult == null)
{
item.Timeout = 30000;
item.ReadWriteTimeout = 30000;
item.WebProxy = WebRequest.DefaultWebProxy;
httpResult = httpHelper.GetHtml(item);
}
if (!string.IsNullOrEmpty(httpResult.Html))
{
APIUtlis.AppRequestHtml(httpResult.Html);
APIUtlis.requestUrl = item.URL;
}
return httpResult;
}
public HttpResult getItunesWebContext(string url, string referer, AppleItunesLogin itunelogin, Dictionary<string, string> hander, bool addToken, ResultType resultType = ResultType.String)
{
string text = "";
KeyValuePair<string, string>[] array = itunelogin.cookis.ToArray();
for (int i = 0; i < array.Length; i++)
{
KeyValuePair<string, string> keyValuePair = array[i];
text = text + keyValuePair.Key + "=" + keyValuePair.Value + ";";
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "get",
Timeout = 180000,
ReadWriteTimeout = 60000,
UserAgent = itunelogin.UserAgent,
Cookie = text,
ContentType = "text/html",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
PostDataType = PostDataType.Byte,
ResultType = resultType,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
array = hander.ToArray();
for (int i = 0; i < array.Length; i++)
{
KeyValuePair<string, string> keyValuePair2 = array[i];
httpItem.Header.Add(keyValuePair2.Key, keyValuePair2.Value);
}
}
if (addToken)
{
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
}
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(itunelogin, httpReuslt.Cookie);
return httpReuslt;
}
protected void addHander(HttpItem item)
{
item.Header.Add("Accept-Encoding", "gzip, deflate");
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0");
}
protected void addCookle(AppleItunesLogin itunesLogin, string cookies)
{
if (cookies == null || string.IsNullOrEmpty(cookies.Trim()))
{
return;
}
foreach (CookieItem cookie in HttpCookieHelper.GetCookieList(cookies))
{
if (cookie.Key.ToLower() != "path" && cookie.Key.ToLower() != "domain" && cookie.Key.ToLower() != "expires" && cookie.Key.ToLower() != "max-age")
{
if (!itunesLogin.cookis.ContainsKey(cookie.Key))
{
itunesLogin.cookis.Add(cookie.Key, cookie.Value);
}
else if (!string.IsNullOrEmpty(cookie.Value.Trim()))
{
itunesLogin.cookis[cookie.Key] = cookie.Value;
}
}
}
}
public HttpResult postJsonItunesWebContext(string url, string postData, string referer, AppleItunesLogin itunelogin, Dictionary<string, string> hander, bool addToken)
{
string text = "";
KeyValuePair<string, string>[] array = itunelogin.cookis.ToArray();
for (int i = 0; i < array.Length; i++)
{
KeyValuePair<string, string> keyValuePair = array[i];
text = text + keyValuePair.Key + "=" + keyValuePair.Value + ";";
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 180000,
ReadWriteTimeout = 60000,
UserAgent = itunelogin.UserAgent,
Cookie = text,
ContentType = "application/json; charset=UTF-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
PostEncoding = Encoding.UTF8,
Postdata = postData,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
if (addToken)
{
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
}
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(itunelogin, httpReuslt.Cookie);
return httpReuslt;
}
public HttpResult getJsonItunesWebContext(string url, string referer, AppleItunesLogin itunelogin, Dictionary<string, string> hander, bool addToken)
{
string text = "";
KeyValuePair<string, string>[] array = itunelogin.cookis.ToArray();
for (int i = 0; i < array.Length; i++)
{
KeyValuePair<string, string> keyValuePair = array[i];
text = text + keyValuePair.Key + "=" + keyValuePair.Value + ";";
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "get",
Timeout = 180000,
ReadWriteTimeout = 60000,
UserAgent = itunelogin.UserAgent,
Cookie = text,
ContentType = "application/json; charset=UTF-8",
Accept = "application/json, text/javascript, */*; q=0.01",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
PostDataType = PostDataType.Byte,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
if (addToken)
{
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
}
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(itunelogin, httpReuslt.Cookie);
return httpReuslt;
}
protected HttpResult postLoginWebContext(string url, byte[] postData, string referer, string userAgent, Dictionary<string, string> cookis, string index, Dictionary<string, string> hander)
{
string cookie = "mzf_in=072381; " + ((index != "0") ? ("itspod=" + index + ";") : "") + " s_vi=; itsMetricsR=Genre-CN-Mobile%20Software%20Applications-29099@@Mobile%20Software%20Applications-main@@@@; " + ((index != "0") ? ("pod=" + index + ";") : "") + " s_vnum_n2_us=0%7C1";
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 13000,
ReadWriteTimeout = 13000,
UserAgent = userAgent,
Cookie = cookie,
ContentType = "application/x-apple-plist; Charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
PostdataByte = postData,
PostDataType = PostDataType.Byte,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
addHander(httpItem);
httpItem.Header.Add("X-Apple-Partner", "origin.0");
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
httpItem.Header.Add("X-Apple-Client-Versions", "GameCenter/2.0");
httpItem.Header.Add("X-Token-T", "M");
httpItem.Header.Add("X-Apple-Tz", "28800");
HttpResult httpReuslt = GetHttpReuslt(httpItem);
Array.Clear(postData, 0, postData.Length);
return httpReuslt;
}
public string GetKeyValue(string itemKey, string valueKey1, string valueKey2, string plist)
{
string text = "";
bool num = plist.Contains(itemKey);
int num2 = 0;
if (num)
{
try
{
num2 = plist.IndexOf(itemKey, StringComparison.InvariantCulture);
text = plist.Substring(num2 + itemKey.Length);
num2 = text.IndexOf(valueKey1, StringComparison.InvariantCulture);
text = text.Substring(num2 + valueKey1.Length);
num2 = text.IndexOf(valueKey2, StringComparison.InvariantCulture);
text = text.Substring(0, num2);
}
catch (ArgumentNullException)
{
}
}
return text.Trim();
}
protected Dictionary<string, string> ConveCookle(string cookies)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
if (cookies != null && !string.IsNullOrEmpty(cookies.Trim()))
{
foreach (CookieItem cookie in HttpCookieHelper.GetCookieList(cookies))
{
if (cookie.Key.ToLower() != "path" && cookie.Key.ToLower() != "domain" && cookie.Key.ToLower() != "expires" && cookie.Key.ToLower() != "max-age")
{
if (!dictionary.ContainsKey(cookie.Key))
{
dictionary.Add(cookie.Key, cookie.Value);
}
else if (!string.IsNullOrEmpty(cookie.Value.Trim()))
{
dictionary[cookie.Key] = cookie.Value;
}
}
}
return dictionary;
}
return dictionary;
}
public static string GetToken(string source, string string_1, string string_2)
{
int num = source.IndexOf(string_1);
if (num > -1)
{
if (string.IsNullOrEmpty(string_2))
{
return source.Substring(num + string_1.Length, source.Length - num - string_1.Length);
}
int num2 = source.IndexOf(string_2, num + string_1.Length);
if (num2 > -1)
{
return source.Substring(num + string_1.Length, num2 - num - string_1.Length);
}
}
return string.Empty;
}
public string strplist(string string_0)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n\t<dict>\n");
string[] array = string_0.Split('&');
foreach (string source in array)
{
string token = GetToken(source, "", "=");
string token2 = GetToken(source, "=", "");
stringBuilder.Append("\t\t<key>");
stringBuilder.Append(token);
stringBuilder.Append("</key>\n");
if (token != "kbsync")
{
if (token == "supportsGpuContentProtection")
{
stringBuilder.Append("\t\t<" + token2 + "/>\n");
continue;
}
stringBuilder.Append("\t\t<string>");
stringBuilder.Append(token2);
stringBuilder.Append("</string>\n");
}
else
{
stringBuilder.Append("\t\t<data>");
stringBuilder.Append(token2);
stringBuilder.Append("</data>\n");
}
}
stringBuilder.Append("\t</dict>\n</plist>");
return stringBuilder.ToString();
}
public HttpResult postJsoniCloudWebContext(string url, string postData, string referer, AppleiCloundLogin cloundLogin, Dictionary<string, string> hander)
{
string cookie = "";
if (cloundLogin == null)
{
throw new Exception("没有登录状态");
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 30000,
ReadWriteTimeout = 30000,
UserAgent = cloundLogin.userAgent,
Cookie = cookie,
ContentType = "application/json; charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
ResultType = ResultType.String,
Postdata = postData,
WebProxy = WebRequest.DefaultWebProxy
};
hander.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(cloundLogin.dsid + ":" + cloundLogin.mmeAuthToken)));
hander.Add("X-Mme-Client-Info", cloundLogin.clientInfo);
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
addHander(httpItem);
return GetHttpReuslt(httpItem);
}
public HttpResult postItunesWebContext(string url, string postData, string referer, AppleItunesLogin itunelogin, Dictionary<string, string> hander, bool isContityNeet = true)
{
string text = "";
foreach (KeyValuePair<string, string> cooki in itunelogin.cookis)
{
if (!string.IsNullOrEmpty(cooki.Value) && cooki.Key != "wosid")
{
text = text + cooki.Key + "=" + cooki.Value + ";";
}
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 90000,
ReadWriteTimeout = 60000,
UserAgent = itunelogin.UserAgent,
Cookie = text,
ContentType = "application/x-apple-plist; Charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
Postdata = strplist(postData),
PostDataType = PostDataType.String,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy,
Encoding = Encoding.UTF8
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
httpItem.Header.Add("X-Apple-Software-Guid", itunelogin.Guid);
httpItem.Header.Add("X-Apple-Partner", "origin.0");
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
httpItem.Header.Add("X-Apple-Client-Versions", "GameCenter/2.0");
httpItem.Header.Add("X-Token-T", "M");
httpItem.Header.Add("X-Apple-Tz", "28800");
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem, isContityNeet);
addCookle(itunelogin, httpReuslt.Cookie);
return httpReuslt;
}
public HttpResult postUrlencodedItunesWebContext(string url, string postData, string referer, AppleItunesLogin itunelogin, Dictionary<string, string> hander)
{
string text = "";
foreach (KeyValuePair<string, string> cooki in itunelogin.cookis)
{
text = text + cooki.Key + "=" + cooki.Value + ";";
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 180000,
ReadWriteTimeout = 60000,
UserAgent = itunelogin.UserAgent,
Cookie = text,
ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
Postdata = postData,
PostDataType = PostDataType.String,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
httpItem.Header.Add("X-Apple-Software-Guid", itunelogin.Guid);
httpItem.Header.Add("X-Apple-Partner", "origin.0");
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
httpItem.Header.Add("X-Apple-Client-Versions", "GameCenter/2.0");
httpItem.Header.Add("X-Token-T", "M");
httpItem.Header.Add("X-Apple-Tz", "28800");
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(itunelogin, httpReuslt.Cookie);
return httpReuslt;
}
}
}

View File

@@ -0,0 +1,283 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class AreaQueryTask : BaseTask
{
public static AreaQueryTask Instance { get; private set; }
static AreaQueryTask()
{
Instance = new AreaQueryTask("区域查询");
}
public AreaQueryTask(string _taskName)
: base(_taskName)
{
}
public void AreaRequestTask(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string, AreaRequestModel> resut, string type = "area")
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
ApiNetReq.startNowFun = ((type == "area") ? 5 : 2);
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
AreaRequestModel model = new AreaRequestModel();
model.state = 0;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string notityKey = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, delegate(string appleid, DisplyType reustType, string dasReust2)
{
resut?.Invoke(notityKey, model.Init(0, dasReust2));
}, notityKey))
{
resut?.Invoke(notityKey, model.Init(0, "正在处理"));
if (AppSysConfig.iTunesisRemoteLogin)
{
HttpResult httpResult = APIUtlis.QueryInfo(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""), type);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(httpResult.Html);
string text = ((dynamic)obj)["Message"];
if (string.IsNullOrEmpty(text) || text == "失败:")
{
int num = 0;
do
{
httpResult = APIUtlis.QueryInfo(appleAcount.appleId, appleAcount.applePwd + ((!appleAcount.isDoubleModl) ? "" : appleAcount.DoublePwd), type);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
obj = Tools.Todejosn<object>(httpResult.Html);
text = ((dynamic)obj)["Message"];
if (text == "失败:")
{
text = "";
}
}
num++;
}
while (num < 5 && string.IsNullOrEmpty(text));
}
if (((dynamic)obj)["Code"] == "0000")
{
Dictionary<string, object> dictionary = ((dynamic)obj)["Data"] as Dictionary<string, object>;
object obj2 = ((dynamic)obj)["Data"]["ServerId"];
object obj3 = ((dynamic)obj)["Data"]["bannal"];
string value = ((dynamic)obj)["Data"]["Area"];
string text2 = ((dynamic)obj)["Data"]["msg"];
if (dictionary.ContainsKey("nextServerId"))
{
int num2 = Tools.ToInt((dynamic)dictionary["nextServerId"], 0);
bool flag;
if (((!(flag = num2 > 0)) ? ((object)flag) : (flag & string.IsNullOrEmpty((dynamic)obj3))) && string.IsNullOrEmpty((dynamic)obj2) && string.IsNullOrEmpty(value))
{
string[] array3 = AppSysConfig.getConfig("UpIdGuidKeyWork").Split('|');
foreach (string value2 in array3)
{
if (text2.Contains(value2))
{
AppleGuidManage.UpIdGuid(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""));
httpResult = APIUtlis.QueryInfo(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""), type);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
obj = Tools.Todejosn<object>(httpResult.Html);
text = ((dynamic)obj)["Message"];
if (text == "失败:")
{
text = "";
}
}
break;
}
}
}
}
}
if (((dynamic)obj)["Code"] == "0000")
{
Dictionary<string, object> dictionary2 = ((dynamic)obj)["Data"] as Dictionary<string, object>;
object obj4 = ((dynamic)obj)["Data"]["ServerId"];
object obj5 = ((dynamic)obj)["Data"]["bannal"];
if (string.IsNullOrEmpty((dynamic)obj5))
{
obj5 = "0";
}
string area = ((dynamic)obj)["Data"]["Area"];
string isDisabledAccount = ((dynamic)obj)["Data"]["isDisabledAccount"];
if (dictionary2.ContainsKey("extend"))
{
model.extension = (dynamic)dictionary2["extend"];
}
model.msg = ((dynamic)obj)["Data"]["msg"];
model.ServerId = (dynamic)obj4;
model.balance = (dynamic)obj5;
model.Area = AppleUtlis.GetAreaByArea(area);
model.state = 1;
model.isDisabledAccount = isDisabledAccount;
resut?.Invoke(notityKey, model);
}
else
{
resut?.Invoke(notityKey, model.Init(1, ((dynamic)obj)["Message"]));
}
}
else
{
resut?.Invoke(notityKey, model.Init(1, "网络请求失败:" + httpResult.StatusCode));
}
}
else
{
HttpResult isLogin = APIUtlis.getIsLogin((type == "area") ? 5 : 2);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj6 = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj6)["Code"] == "0000")
{
if (((dynamic)obj6)["Data"]["integral"] >= AppSysConfig.getTypeById((type == "area") ? 5 : 2).consNum)
{
resut?.Invoke(notityKey, model.Init(0, "开始登录.."));
ItunesUtlis itunesUtlis = new ItunesUtlis(this, notityKey, delegate(string apple, DisplyType Dtype, string reust)
{
if (Dtype == DisplyType.xinxi)
{
resut?.Invoke(notityKey, model.Init(-1, reust));
}
}, openVpn);
AppleItunesLogin appleItunesLogin = null;
bool isAppleSuccess = false;
string msgReust = "";
if (string.IsNullOrEmpty(itunesUtlis.ProxyIp))
{
itunesUtlis.ProxyIp = ProxyAccountCache.getProxyAccountIP(appleAcount.appleId);
}
appleItunesLogin = itunesUtlis.appleLogin(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""), 1, ref msgReust, out isAppleSuccess);
if (appleItunesLogin != null)
{
if (appleAcount.isDoubleModl)
{
appleItunesLogin.pwd = appleAcount.applePwd;
}
iTunesAccountLoginCache.addReddemUserInfo(appleAcount.appleId, appleItunesLogin);
string serverId = appleItunesLogin.ServerId.ToString();
model.ServerId = serverId;
model.balance = appleItunesLogin.Balance;
model.Area = appleItunesLogin.Area;
model.state = 1;
model.extension = appleItunesLogin.extension;
model.isDisabledAccount = appleItunesLogin.isDisabledAccount;
resut?.Invoke(notityKey, model.Init(1, "查询完成"));
}
else
{
resut?.Invoke(notityKey, model.Init(1, msgReust));
isAppleSuccess = false;
}
if (isAppleSuccess)
{
APIUtlis.ApiApplyAct((type == "area") ? 5 : 2, (type == "area") ? "区域查询" : "余额查询");
}
}
else
{
resut?.Invoke(notityKey, model.Init(1, "点数不足,请联系客服充值"));
}
}
else
{
resut?.Invoke(notityKey, model.Init(1, ((dynamic)obj6)["Message"]));
}
}
else
{
resut?.Invoke(notityKey, model.Init(1, "网络请求失败"));
}
}
goto IL_1cb8;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
resut?.Invoke(appleAcount.guidTag, model.Init(-1, " 请求失败: " + ex2.Message));
}
goto IL_1cb8;
}
continue;
IL_1cb8:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,17 @@
namespace AppleBatch_June.ExecuteTasks
{
public class BalanceQueryTask : AreaQueryTask
{
public new static BalanceQueryTask Instance { get; private set; }
static BalanceQueryTask()
{
Instance = new BalanceQueryTask("余额查询");
}
public BalanceQueryTask(string _taskName)
: base(_taskName)
{
}
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class CloseAuthenTask : BaseTask
{
public static CloseAuthenTask Instance { get; private set; }
static CloseAuthenTask()
{
Instance = new CloseAuthenTask("关闭双重认证");
}
public CloseAuthenTask(string _taskName)
: base(_taskName)
{
}
public void AppleCloseAuthenTask(int TaskSize, string newPassWord, bool openVpn, bool ckTailNumber, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
ApiNetReq.startNowFun = 14;
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(14);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(14).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis(_action, null, this).RetrievePassword(openVpn, appleAcount, newPassWord, guidTag, isCloseAuthen: true, ckTailNumber) : new AppleiForgotWeb(openVpn, _action, null, this).RetrievePassword(appleAcount, newPassWord, guidTag, isCloseAuthen: true, ckTailNumber))
{
APIUtlis.ApiApplyAct(14, "关闭双重认证");
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_0551;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0551;
}
continue;
IL_0551:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class CountryTask : BaseTask
{
public static CountryTask Instance { get; private set; }
static CountryTask()
{
Instance = new CountryTask("iTunes转国家");
}
public CountryTask(string _taskName)
: base(_taskName)
{
}
public void AppleCountryTask(int TaskSize, PaymentInfo payment, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
ApiNetReq.startNowFun = 11;
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
ItunesUtlis itunesUtlis = new ItunesUtlis(this, guidTag, _action, openVpn);
AppleItunesLogin itunesLogin = getItunesLogin(appleAcount, 11, _action, itunesUtlis);
if (itunesLogin != null)
{
itunesLogin.account = appleAcount.appleId;
_action?.Invoke(guidTag, DisplyType.area, itunesLogin.Area);
_action?.Invoke(guidTag, DisplyType.xinxi, "正在修改国家");
string msg = "";
bool num = itunesUtlis.itunesCountryChangen(itunesLogin, payment, openVpn, ref msg);
_action?.Invoke(guidTag, DisplyType.xinxi, msg);
if (num)
{
_action?.Invoke(guidTag, DisplyType.guojia, payment.billingAddress.countryCode);
APIUtlis.ApiApplyAct(11, "itunes修改国家");
}
sucessAct?.Invoke(guidTag);
}
goto IL_01f7;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_01f7;
}
continue;
IL_01f7:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class CreateFamilyTask : BaseTask
{
public static CreateFamilyTask Instance { get; private set; }
static CreateFamilyTask()
{
Instance = new CreateFamilyTask("开通家庭共享");
}
public CreateFamilyTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteCreateFamily(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
int type = 32;
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = type;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
iCloundUtils iCloundUtils2 = new iCloundUtils(this, appleAcount.appleId, _action, openVpn);
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
iCloundUtils2.appleId = appleAcount.appleId;
AppleiCloundLogin appleiCloundLogin = iCloundUtils2.loginDelegates(appleAcount.appleId, appleAcount.applePwd, type);
if (appleiCloundLogin != null)
{
appleiCloundLogin.account = appleAcount.appleId;
if (iCloundUtils2.createFamily(appleiCloundLogin, appleAcount.newAppleId, appleAcount.newAppleId, appleAcount.newApplePopPwd))
{
ApiApplyAct(type, "开通家庭共享");
}
}
sucessAct?.Invoke(appleAcount.appleId);
goto IL_01b6;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_01b6;
}
continue;
IL_01b6:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,259 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class CycleReddemTask : BaseTask
{
private readonly Dictionary<string, AppleItunesLogin> ReddemLogAccount = new Dictionary<string, AppleItunesLogin>();
private readonly Dictionary<string, object> objReddemLockS = new Dictionary<string, object>();
private readonly object objReddemLock = new object();
public static CycleReddemTask Instance { get; private set; }
static CycleReddemTask()
{
Instance = new CycleReddemTask("循环卡片兑换");
}
public CycleReddemTask(string _taskName)
: base(_taskName)
{
}
public void AppleCycleReddemTask(int TaskSize, List<AppleAcount> lvItems, bool _OpenVpn, bool remoteReddem, bool singleProcessRedeem, Action startAct, Action endTakAct, Action<string, string> sucessAct, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion)
{
TaskSize = Tools.getTaskSize(_OpenVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ReddemLogAccount.Clear();
ApiNetReq.startNowFun = 37;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount listView = null;
try
{
lock (lvItems)
{
AppleAcount appleAcount = lvItems.Where((AppleAcount c) => !c.isAct && c.reddeemLockTaskGuid == guid).FirstOrDefault();
if (appleAcount == null)
{
listView = lvItems.Where((AppleAcount c) => !c.isAct && string.IsNullOrEmpty(c.reddeemLockTaskGuid)).FirstOrDefault();
if (listView == null)
{
break;
}
listView.isAct = true;
if (singleProcessRedeem)
{
foreach (AppleAcount item in lvItems.Where((AppleAcount c) => c.appleId == listView.appleId).ToList())
{
item.reddeemLockTaskGuid = guid;
}
}
}
else
{
appleAcount.isAct = true;
listView = appleAcount;
}
}
if (BaseTask.startRuning(taskRunModel, _action, listView.reddemCode))
{
ItunesUtlis itunesUtlis = new ItunesUtlis(this, listView.reddemCode, _action, _OpenVpn);
AppleItunesLogin appleItunesLogin = null;
lock (objReddemLock)
{
if (!objReddemLockS.ContainsKey(listView.appleId))
{
objReddemLockS.Add(listView.appleId, new object());
}
}
lock (objReddemLockS[listView.appleId])
{
if (!ReddemLogAccount.ContainsKey(listView.appleId))
{
appleItunesLogin = getItunesLogin(listView, 8, _action, itunesUtlis, 1);
if (appleItunesLogin != null)
{
ReddemLogAccount.Add(listView.appleId, appleItunesLogin);
}
}
else
{
appleItunesLogin = ReddemLogAccount[listView.appleId];
}
}
if (appleItunesLogin != null)
{
string msg = "";
ReddemeState reddemeState = ReddemeState.Unknown;
if (AppSysConfig.getConfig("ReddemCHNCheckRealName") == "1" && appleItunesLogin.AreaCode == "CHN" && !itunesUtlis.checkAccountRealNameState(listView.appleId))
{
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "查询中国账号是否已实名..");
switch (itunesUtlis.CheckNeedRealName(appleItunesLogin))
{
case CheckRealNameType.Need:
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "ID账号未实名认证");
goto end_IL_0055;
case CheckRealNameType.Unknown:
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "实名检查失败,请重试");
goto end_IL_0055;
}
}
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "正在兑换");
appleItunesLogin.reddemQts = listView.reddemQts;
string errorMessageKey = "";
if (remoteReddem)
{
reddemeState = itunesUtlis.serverReddeme(appleItunesLogin, listView.reddemCode, ref msg, ref errorMessageKey, appleItunesLogin.serverIndex);
}
else
{
reddemeState = itunesUtlis.reddeme(appleItunesLogin, _OpenVpn, listView.reddemCode, listView.reddemCode, ref msg, ref errorMessageKey);
if (reddemeState == ReddemeState.doLogin)
{
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "正在重新登录..");
appleItunesLogin = getItunesLogin(listView, 8, _action, itunesUtlis, 2);
if (appleItunesLogin != null)
{
if (ReddemLogAccount.ContainsKey(listView.appleId))
{
ReddemLogAccount[listView.appleId] = appleItunesLogin;
}
else
{
ReddemLogAccount.Add(listView.appleId, appleItunesLogin);
}
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "正在兑换");
reddemeState = itunesUtlis.reddeme(appleItunesLogin, _OpenVpn, listView.reddemCode, listView.reddemCode, ref msg, ref errorMessageKey);
}
}
}
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, msg);
int num = 8;
if (reddemeState != ReddemeState.Unknown)
{
if (reddemeState == ReddemeState.lose)
{
_applyAtion?.Invoke(listView.reddemCode, DisplyType.reddemLose, "无效");
}
else if (msg.Contains("兑换成功"))
{
_applyAtion?.Invoke(listView.reddemCode, DisplyType.reddemValid, "完成");
num = 36;
}
else
{
_applyAtion?.Invoke(listView.reddemCode, DisplyType.reddemValid, "有效");
}
if (int.TryParse(listView.overflow, out var result) && result > 0 && num == 8)
{
num = 37;
}
if (!msg.Contains("本商城无法获得您的账户信息"))
{
APIUtlis.ApiApplyAct(num, "Apple兑换");
}
}
else
{
bool flag = false;
string[] array3 = AppSysConfig.getConfig("ReddemCardKeywordLoseOther").Split(',');
foreach (string value in array3)
{
if (!string.IsNullOrEmpty(value) && errorMessageKey.Contains(value))
{
_applyAtion?.Invoke(listView.reddemCode, DisplyType.reddemLose, "无效");
flag = true;
}
}
if (!flag)
{
_applyAtion?.Invoke(listView.reddemCode, DisplyType.reddemUNlock, "未知");
lock (objReddemLock)
{
ReddemLogAccount.Remove(listView.appleId);
}
}
else
{
APIUtlis.ApiApplyAct(37, "循环兑换无效");
}
}
sucessAct?.Invoke(listView.reddemCode, listView.appleId);
}
goto IL_0799;
}
end_IL_0055:;
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (listView != null)
{
_action?.Invoke(listView.reddemCode, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0799;
}
continue;
IL_0799:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.Interfaces;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class DisabledTask : BaseTask
{
public static DisabledTask Instance { get; private set; }
static DisabledTask()
{
Instance = new DisabledTask("禁用查询");
}
public DisabledTask(string _taskName)
: base(_taskName)
{
}
public void AppleDisabledTask(bool openVpn, int TaskSize, int checkType, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
ApiNetReq.startNowFun = 3;
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(3);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(3).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
IAccountDisabled accountDisabled = null;
accountDisabled = ((checkType != 1) ? ((IAccountDisabled)new iTunesAccountDisabled(openVpn, _action, _applyAtion, this)) : ((IAccountDisabled)new WebAccountDisabled(openVpn, _action, _applyAtion, this)));
if (accountDisabled.accountCheck(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""), guidTag))
{
APIUtlis.ApiApplyAct(3, "Apple禁用检测");
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_055e;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_055e;
}
continue;
IL_055e:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class EditAddrsTask : BaseTask
{
public static EditAddrsTask Instance { get; private set; }
static EditAddrsTask()
{
Instance = new EditAddrsTask("修改账单地址");
}
public EditAddrsTask(string _taskName)
: base(_taskName)
{
}
public void AppleEditAddrsTask(int TaskSize, bool openVpn, bool ckShippingAddress, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 18;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (appleAcount != null)
{
string guidTag = appleAcount.guidTag;
if (!BaseTask.startRuning(taskRunModel, _action, guidTag))
{
continue;
}
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(18);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(18).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
AppleChangeItem changeItem = new AppleChangeItem
{
editAddrs = appleAcount.addres,
newGuojia = "",
newPwd = "",
newQt1 = "",
newQt2 = "",
newQt3 = "",
pay = null,
newshengri = "",
ckShippingAddress = ckShippingAddress
};
string accountName = "";
bool flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis(_action, _action, this).applyChangeAcount(appleAcount, changeItem, errorGoint: true, openVpn, guidTag, ref accountName) : new AppleManageWeb(openVpn, _action, _action, this).applyChangeAcount(appleAcount, changeItem, errorGoint: true, guidTag, ref accountName))
{
sucessAct?.Invoke(guidTag);
APIUtlis.ApiApplyAct(18, "Apple账单地址修改");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
}
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class FamilyInfoTask : BaseTask
{
public static FamilyInfoTask Instance { get; private set; }
static FamilyInfoTask()
{
Instance = new FamilyInfoTask("家庭共享详情");
}
public FamilyInfoTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteQueryFamilyInfo(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 29;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
iCloundUtils iCloundUtils2 = new iCloundUtils(this, appleAcount.appleId, _action, openVpn)
{
appleId = appleAcount.appleId
};
int type = 29;
AppleiCloundLogin appleiCloundLogin = iCloundUtils2.loginDelegates(appleAcount.appleId, appleAcount.applePwd + (appleAcount.isDoubleModl ? appleAcount.DoublePwd : ""), type);
if (appleiCloundLogin != null)
{
appleiCloundLogin.account = appleAcount.appleId;
if (iCloundUtils2.getFamilyDetails(appleiCloundLogin, iCloundUtils2))
{
ApiApplyAct(type, "家庭共享详情");
}
}
sucessAct?.Invoke(appleAcount.appleId);
goto IL_01be;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_01be;
}
continue;
IL_01be:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using AppleBatch_June.Utils;
namespace AppleBatch_June.ExecuteTasks
{
public class GameTask : BaseTask
{
public static GameTask Instance { get; private set; }
static GameTask()
{
Instance = new GameTask("获取游戏");
}
public GameTask(string _taskName)
: base(_taskName)
{
}
private int passGetGameByUrl(bool ckQueryMOdel, GetGameUtils itunes, string gameUrl, AppleItunesLogin itunesLogin)
{
int num = 0;
if (ckQueryMOdel)
{
return itunes.getNewGameByUrl3(gameUrl, itunesLogin);
}
return itunes.getGameByUrl(gameUrl, itunesLogin);
}
public void AppleGameTask(int TaskSize, List<string> gameUrls, bool openVpn, bool ckQueryMOdel, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 10;
base.TaskIsRun = true;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
GetGameUtils getGameUtils = new GetGameUtils(this, guidTag, _action, openVpn)
{
appleId = appleAcount.appleId
};
AppleItunesLogin itunesLogin = getItunesLogin(appleAcount, 10, _action, getGameUtils, 1);
if (itunesLogin != null)
{
_action?.Invoke(guidTag, DisplyType.area, itunesLogin.Area);
_action?.Invoke(guidTag, DisplyType.gameCount, gameUrls.Count.ToString());
_action?.Invoke(guidTag, DisplyType.gameFire, "");
_action?.Invoke(guidTag, DisplyType.gameSuccess, "");
_action?.Invoke(guidTag, DisplyType.xinxi, "正在获取应用");
int num = 1;
int num2 = 0;
int num3 = 0;
foreach (string gameUrl in gameUrls)
{
if (base.isRun)
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在获取第" + num + "个应用");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
num3 = passGetGameByUrl(ckQueryMOdel, getGameUtils, gameUrl, itunesLogin);
stopwatch.Stop();
if (num3 == 99)
{
itunesLogin = getItunesLogin(appleAcount, 10, _action, getGameUtils, 2);
if (itunesLogin == null)
{
_action?.Invoke(guidTag, DisplyType.gameFire, "账号登录失败");
break;
}
_action?.Invoke(guidTag, DisplyType.xinxi, "正在获取第" + num + "个应用");
num3 = passGetGameByUrl(ckQueryMOdel, getGameUtils, gameUrl, itunesLogin);
_action?.Invoke(guidTag, DisplyType.gameCount, gameUrls.Count.ToString());
}
if (num3 == 1)
{
num2++;
_action?.Invoke(guidTag, DisplyType.gameSuccess, "获取成功");
}
else
{
_action?.Invoke(guidTag, DisplyType.gameFire, "获取失败");
}
num++;
}
}
getGameUtils.endGetGame(itunesLogin);
if (num2 > 0)
{
if (num3 != 99)
{
_action?.Invoke(guidTag, DisplyType.xinxi, "获取完成");
ApiApplyAct(10, "Apple获取游戏");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "获取失败");
}
sucessAct?.Invoke(guidTag);
}
goto IL_03f9;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_03f9;
}
continue;
IL_03f9:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,6 @@
namespace AppleBatch_June.ExecuteTasks
{
public class GiftCardBalanceCheckTask
{
}
}

View File

@@ -0,0 +1,448 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AppleBatch_June.Domain;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class GiftcardBalanceAotuQueryTask
{
private GiftcardBalanceWeb giftcardBalance;
public BaseFormTaskRunState taskState = new BaseFormTaskRunState("礼品卡余额定时查询");
private Action<string, DisplyType, string> action;
public static object loginLockObj = new object();
public DateTime loginTime = DateTime.Now.AddHours(-1.0);
public DateTime loginCheckTime = DateTime.Now.AddHours(-1.0);
public bool expirationExecuted { get; set; }
public string storeAppleHostLists
{
get
{
return _storeAppleHostLists;
}
set
{
if (value != _storeAppleHostLists)
{
if (giftcardBalance != null)
{
giftcardBalance = null;
}
giftcardBalance = new GiftcardBalanceWeb(value, action, action, taskState);
}
_storeAppleHostLists = value;
}
}
private string _storeAppleHostLists { get; set; }
public GiftcardBalanceAotuQueryTask(Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion)
{
action = _action;
giftcardBalance = new GiftcardBalanceWeb(_storeAppleHostLists, _action, _applyAtion, taskState);
}
public void QuertAppleBlance(List<AppleAcount> acounts, Action<string, DisplyType, string> reddemAction)
{
Task.Run(delegate
{
foreach (AppleAcount acount in acounts)
{
string appleId = acount.appleId;
string applePwd = acount.applePwd;
ItunesUtlis itunesUtlis = new ItunesUtlis(taskState, appleId, reddemAction);
reddemAction?.Invoke(appleId, DisplyType.xinxi, "正在查询..");
string msgReust = "";
AppleItunesLogin appleItunesLogin = itunesUtlis.remoteAppleLogin(appleId.Trim(), applePwd, ref msgReust, 2);
if (appleItunesLogin != null)
{
APIUtlis.ApiApplyAct(2, "余额查询");
string text = ((appleItunesLogin.isDisabledAccount.ToLower() == "false") ? "正常" : "禁用");
reddemAction?.Invoke(appleId, DisplyType.xinxi, "登录完成,余额:" + appleItunesLogin.Balance + ",状态:" + text + ",国家:" + appleItunesLogin.Area);
}
else
{
reddemAction?.Invoke(appleId, DisplyType.error, "失败");
reddemAction?.Invoke(appleId, DisplyType.xinxi, msgReust);
}
}
});
}
public void Reddem(string reddemCode, List<AppleAcount> acounts, Action<string, DisplyType, string> reddemAction)
{
ItunesUtlis itunesUtlis = new ItunesUtlis(taskState, reddemCode, reddemAction);
action?.Invoke(reddemCode, DisplyType.xinxi, "正在兑换..");
foreach (AppleAcount acount in acounts)
{
bool flag = false;
string appleId = acount.appleId;
string applePwd = acount.applePwd;
reddemAction?.Invoke(appleId, DisplyType.xinxi, "正在登录");
string msgReust = "";
AppleItunesLogin appleItunesLogin = itunesUtlis.remoteAppleLogin(appleId.Trim(), applePwd, ref msgReust, 1);
if (appleItunesLogin != null)
{
if (appleItunesLogin.isDisabledAccount.ToLower() == "false")
{
reddemAction?.Invoke(appleId, DisplyType.xinxi, "登录完成,国家:" + appleItunesLogin.Area);
string msg = "";
string errorMessageKey = "";
if (itunesUtlis.serverReddeme(appleItunesLogin, reddemCode.Trim(), ref msg, ref errorMessageKey, appleItunesLogin.serverIndex) == ReddemeState.valid && string.IsNullOrEmpty(errorMessageKey))
{
string text = appleId + msg;
action?.Invoke(reddemCode, DisplyType.reddemValid, text);
string value = new Regex("加载金额:([\\s\\S]*?),").Match(msg).Groups[1].Value;
decimal num = Tools.ConverCurrency(value);
reddemAction?.Invoke(appleId, DisplyType.reddemValid, num.ToString());
APIUtlis.ApiApplyAct(33, "礼品卡余额自动兑换");
action?.Invoke(reddemCode, DisplyType.xinxi, "兑换成功,金额:" + value.ToString());
ininserToDb(reddemCode, value, text);
break;
}
string[] array = AppSysConfig.getConfig("AotoReddemCardKeywordAccountError").Split(',');
foreach (string value2 in array)
{
if (!string.IsNullOrEmpty(value2) && errorMessageKey.Contains(value2))
{
reddemAction?.Invoke(appleId, DisplyType.error, "失败");
reddemAction?.Invoke(appleId, DisplyType.xinxi, msg);
flag = true;
break;
}
}
if (!flag)
{
action?.Invoke(reddemCode, DisplyType.xinxi, "卡状态未知");
action?.Invoke(reddemCode, DisplyType.reddemLose, appleId + msg);
ininserToDb(reddemCode, "", appleId + msg);
break;
}
}
else
{
reddemAction?.Invoke(appleId, DisplyType.error, "失败");
reddemAction?.Invoke(appleId, DisplyType.xinxi, "账户已被禁用");
}
}
else
{
reddemAction?.Invoke(appleId, DisplyType.error, "失败");
reddemAction?.Invoke(appleId, DisplyType.xinxi, msgReust);
}
}
}
public void Query(List<AppleAcount> lvItems, bool startVpn, string LoginAppleId, string LoginApwd, Action endAct, bool isAgain = false)
{
Task.Run(delegate
{
expirationExecuted = true;
int taskSize = Tools.getTaskSize(startVpn, lvItems.Count);
taskState.isRun = true;
taskState.TaskIsRun = true;
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
string text = "";
if (lvItems.Count > 0)
{
text = lvItems[0].reddemCode;
}
giftcardBalance.appleId = text;
int num = 0;
DateTime now = DateTime.Now;
while (giftcardBalance.state == GiftcardBalanceWeb.GiftcardBalancState.busy && DateTime.Now.AddMinutes(-1.5) < now)
{
action(text, DisplyType.xinxi, "ID登录中" + getIngStr(num, 5));
Thread.Sleep(300);
num++;
}
if (giftcardBalance.state == GiftcardBalanceWeb.GiftcardBalancState.success && !(giftcardBalance.LoginAppleId != LoginAppleId))
{
action(text, DisplyType.xinxi, "ID登陆完成");
}
else
{
action(text, DisplyType.xinxi, "正在登陆ID" + getIngStr(3, 4));
if (!giftcardBalance.shopSignIn(LoginAppleId, LoginApwd, startVpn, out var error))
{
giftcardBalance.Reset();
action(text, DisplyType.error, error);
action(text, DisplyType.xinxi, error);
endAct?.Invoke();
return;
}
string arg = giftcardBalance.storeAppleHost.Replace(".store.apple.com", "");
GiftcardBalanceStandby standby = GiftcardBalanceManage.GetStandby(_storeAppleHostLists, LoginAppleId);
if (standby == null)
{
GiftcardBalanceManage.AddGifStandby(_storeAppleHostLists, LoginAppleId, LoginApwd);
standby = GiftcardBalanceManage.GetStandby(_storeAppleHostLists, LoginAppleId);
}
if (standby != null && giftcardBalance.storeAppleHostLists == _storeAppleHostLists)
{
standby.AddGiftcardBalance(giftcardBalance);
}
ProxyAccountCache.addProxyIp(LoginAppleId.Trim() + "_Aoto", giftcardBalance.ProxyIp);
action(text, DisplyType.newAccount, arg);
action(text, DisplyType.error, "ID登陆完成");
action(text, DisplyType.xinxi, "ID登陆完成");
}
Task[] array = new Task[taskSize];
for (int i = 0; i < taskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (taskState.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, action, appleAcount.reddemCode))
{
GiftcardBalanceStandby standby2 = GiftcardBalanceManage.GetStandby(_storeAppleHostLists, LoginAppleId);
if (standby2 == null)
{
GiftcardBalanceManage.AddGifStandby(_storeAppleHostLists, LoginAppleId, LoginApwd);
standby2 = GiftcardBalanceManage.GetStandby(_storeAppleHostLists, LoginAppleId);
standby2.GetRandomGiftcard(startVpn);
}
lock (loginLockObj)
{
if (DateTime.Now.AddSeconds(-10.0) > loginCheckTime)
{
loginCheckTime = DateTime.Now;
standby2.check(startVpn, action);
}
}
action(appleAcount.reddemCode, DisplyType.xinxi, "正在处理");
int id = 23;
HttpResult isLogin = APIUtlis.getIsLogin(23);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (!((((dynamic)obj)["Code"] == "0000") ? true : false))
{
action(appleAcount.reddemCode, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
else if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(id).consNum)
{
action(appleAcount.appleId, DisplyType.chongzhi, "");
bool flag = false;
int num2 = 0;
int num3 = 10;
do
{
flag = false;
GiftcardBalanceWeb randomGiftcard = standby2.GetRandomGiftcard(startVpn);
if (randomGiftcard == null)
{
flag = true;
action(appleAcount.reddemCode, DisplyType.xinxi, "等待重新登录中..." + (num2 + 1));
}
else
{
randomGiftcard.ProxyIp = ProxyAccountCache.getProxyAccountIP(LoginAppleId + "_Aoto", 18);
randomGiftcard.isUpProxyAccountCache = true;
randomGiftcard.action = action;
randomGiftcard.taskState = taskState;
GiftcardBalanceModel giftcardBalanceModel = randomGiftcard.giftCardBalanceCheck(appleAcount.reddemCode, startVpn);
if (giftcardBalanceModel != null)
{
if (giftcardBalanceModel.head.status == 200 && !giftcardBalanceModel.body.giftCardBalanceCheck.d.maxAttemptReached)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>
{
{ "type", "giftcardBalance" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{ "value1", appleAcount.reddemCode }
};
if (giftcardBalanceModel.body.giftCardBalanceCheck.d.balance != null)
{
string balance = giftcardBalanceModel.body.giftCardBalanceCheck.d.balance;
dictionary.Add("value2", balance);
dictionary.Add("value3", "查询完成");
action(appleAcount.reddemCode, DisplyType.xinxi, "查询完成,余额:" + balance);
action(appleAcount.reddemCode, DisplyType.balance, balance);
string arg2 = HttpUtility.HtmlDecode(giftcardBalanceModel.body.giftCardBalanceCheck.d.giftCardNumber);
action(appleAcount.reddemCode, DisplyType.lostBillNo, arg2);
APIUtlis.ApiApplyAct(34, "自动礼品卡余额有效");
SqliteHelper.ExecuteInsert("itunes_db", dictionary);
}
else if (giftcardBalanceModel.body.giftCardBalanceCheck.d.alertMessages != null)
{
string text2 = "错误:" + giftcardBalanceModel.body.giftCardBalanceCheck.d.alertMessages[0];
dictionary.Add("value2", "无");
dictionary.Add("value3", text2);
action(appleAcount.reddemCode, DisplyType.balance, "无");
action(appleAcount.reddemCode, DisplyType.xinxi, text2);
if (int.TryParse(appleAcount.overflow, out var result) && result > 0)
{
APIUtlis.ApiApplyAct(35, "自动礼品卡余额无效");
}
else
{
APIUtlis.ApiApplyAct(23, "自动礼品卡余额无效");
}
SqliteHelper.ExecuteInsert("itunes_db", dictionary);
}
else
{
string text3 = "错误:不是有效的礼品卡";
dictionary.Add("value2", "无");
dictionary.Add("value3", text3);
if (int.TryParse(appleAcount.overflow, out var result2) && result2 > 0)
{
APIUtlis.ApiApplyAct(35, "自动礼品卡余额无效");
}
else
{
APIUtlis.ApiApplyAct(23, "自动礼品卡余额无效");
SqliteHelper.ExecuteInsert("itunes_db", dictionary);
}
action(appleAcount.reddemCode, DisplyType.balance, "无");
action(appleAcount.reddemCode, DisplyType.xinxi, text3);
}
action(appleAcount.reddemCode, DisplyType.gameCount, "+1");
}
else
{
bool? flag2 = giftcardBalanceModel?.body?.giftCardBalanceCheck?.d?.maxAttemptReached;
if (giftcardBalanceModel.head.status != 302 && (!flag2.HasValue || !flag2.Value))
{
randomGiftcard.timeCheck = DateTime.Now.AddMinutes(10.5).ToString("yyMMddHHmmss");
flag = true;
action(appleAcount.reddemCode, DisplyType.xinxi, "未知,等待重新查询.." + (num2 + 1));
}
else
{
flag = true;
standby2.removeGiftcardBalance(randomGiftcard.StdndbyKey);
action(appleAcount.reddemCode, DisplyType.xinxi, "等待重新查询中..." + (num2 + 1));
}
}
}
else
{
action(appleAcount.reddemCode, DisplyType.xinxi, "请求错误,请重新查询");
}
}
if (flag)
{
if (num2 + 1 < num3)
{
Thread.Sleep(1000 * (2 * num2));
}
else
{
action(appleAcount.reddemCode, DisplyType.xinxi, "查询失败,请重新登录");
}
}
if (!taskState.isRun)
{
action(appleAcount.reddemCode, DisplyType.xinxi, "停止执行");
}
num2++;
}
while (flag && num2 < num3 && taskState.isRun);
}
else
{
action(appleAcount.reddemCode, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
action(appleAcount.reddemCode, DisplyType.xinxi, "网络请求失败");
}
goto IL_0b3d;
}
}
catch (Exception ex)
{
APIUtlis.ApiSeriveError(ex);
if (appleAcount != null)
{
action(appleAcount.reddemCode, DisplyType.xinxi, "请求失败:" + ex.Message);
}
goto IL_0b3d;
}
continue;
IL_0b3d:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
AppleExecuteTask.TaskRunModels.Clear();
taskState.isRun = false;
taskState.TaskIsRun = false;
expirationExecuted = false;
endAct?.Invoke();
});
}
public void ininserToDb(string reddemCode, string balance, string errmsg)
{
try
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("type", "giftcardBalance");
dictionary.Add("addTime", Tools.GenerateTimeStamp().ToString());
dictionary.Add("value1", reddemCode);
dictionary.Add("value2", balance);
dictionary.Add("value3", errmsg);
SqliteHelper.ExecuteInsert("itunes_db", dictionary);
}
catch (Exception)
{
}
}
public void Stop()
{
taskState.Stop();
}
private string getIngStr(int cont, int maxCount)
{
int totalWidth = cont % maxCount;
return ".".PadRight(totalWidth, '.');
}
}
}

View File

@@ -0,0 +1,11 @@
namespace AppleBatch_June.ExecuteTasks
{
public interface ITaskRunState
{
bool TaskIsRun { get; set; }
bool isRun { get; set; }
void Stop();
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class InfoQueryTask : BaseTask
{
public static InfoQueryTask Instance { get; private set; }
static InfoQueryTask()
{
Instance = new InfoQueryTask("账号信息查询");
}
public InfoQueryTask(string _taskName)
: base(_taskName)
{
}
public void AppleInfoQueryTask(int TaskSize, bool openVpn, bool openOwe, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 16;
base.baseEndTakAct = endTakAct;
base.TaskIsRun = true;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
ItunesUtlis itunesUtlis = new ItunesUtlis(this, guidTag, _action, openVpn);
AppleItunesLogin itunesLogin = getItunesLogin(appleAcount, 16, _action, itunesUtlis);
if (itunesLogin != null)
{
itunesLogin.account = appleAcount.appleId;
itunesUtlis.appleId = itunesLogin.account;
_action?.Invoke(guidTag, DisplyType.xinxi, "正在查询");
bool openOweReust = false;
if (itunesUtlis.getAccountSummary(itunesLogin, openOwe, guidTag, ref openOweReust))
{
APIUtlis.ApiApplyAct(16, "Apple账号信息查询");
if (openOweReust)
{
APIUtlis.ApiApplyAct(20, "查询欠费");
}
}
sucessAct?.Invoke(guidTag);
}
goto IL_01b7;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_01b7;
}
continue;
IL_01b7:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class LeaveFamilyTask : BaseTask
{
public static LeaveFamilyTask Instance { get; private set; }
static LeaveFamilyTask()
{
Instance = new LeaveFamilyTask("关闭家庭共享");
}
public LeaveFamilyTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteLeaveFamily(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 30;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
int type = 30;
iCloundUtils iCloundUtils2 = new iCloundUtils(this, appleAcount.appleId, _action, openVpn);
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
iCloundUtils2.appleId = appleAcount.appleId;
AppleiCloundLogin appleiCloundLogin = iCloundUtils2.loginDelegates(appleAcount.appleId, appleAcount.applePwd, type);
if (appleiCloundLogin != null)
{
appleiCloundLogin.account = appleAcount.appleId;
if (iCloundUtils2.leaveFamily(appleiCloundLogin))
{
ApiApplyAct(type, "leaveFamily");
}
}
sucessAct?.Invoke(appleAcount.appleId);
goto IL_01a0;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_01a0;
}
continue;
IL_01a0:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class OpenAuthenTask : BaseTask
{
public static OpenAuthenTask Instance { get; private set; }
static OpenAuthenTask()
{
Instance = new OpenAuthenTask("开通双重认证");
}
public OpenAuthenTask(string _taskName)
: base(_taskName)
{
}
public void AppleOpenAuthenTask(int TaskSize, string countryCode, string countryValue, string mode, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action, Func<string, int, string> actGetCode)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 21;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(21);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(21).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
new AppleChangeItem
{
countryCode = countryCode,
mode = mode
};
bool flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis(_action, null, this).OpenAuthen(appleAcount, new AppleChangeItem
{
countryCode = countryCode,
mode = mode
}, openVpn, actGetCode, guidTag) : new AppleManageWeb(openVpn, _action, null, this).OpenAuthen(appleAcount, new AppleChangeItem
{
countryCode = countryCode,
mode = mode
}, actGetCode, guidTag))
{
_action?.Invoke(guidTag, DisplyType.mima, "成功");
APIUtlis.ApiApplyAct(21, "开启双重认证");
}
else
{
_action?.Invoke(guidTag, DisplyType.normal, "失败");
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_05d2;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_05d2;
}
continue;
IL_05d2:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class OrderQueryTask : BaseTask
{
public static OrderQueryTask Instance { get; private set; }
static OrderQueryTask()
{
Instance = new OrderQueryTask("订单查询");
}
public OrderQueryTask(string _taskName)
: base(_taskName)
{
}
public void AppleOrderQueryTask(int TaskSize, bool openVpn, string amountSpik, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 17;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (appleAcount != null)
{
if (!BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
continue;
}
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(17);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(17).consNum)
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
AppleManageWebUtlis appleManageWebUtlis = new AppleManageWebUtlis(_action, _action, this);
appleManageWebUtlis.checkDisable(openVpn, appleAcount.appleId, appleAcount.applePwd, appleAcount.appleId);
if (appleManageWebUtlis.idIsNormal && appleManageWebUtlis.sponsorRefund(appleAcount.appleId, amountSpik))
{
appleManageWebUtlis.reportSingOut();
sucessAct?.Invoke(appleAcount.appleId);
APIUtlis.ApiApplyAct(17, "Apple订单提取");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "网络请求失败");
}
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
}
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,149 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class OvercheckTask : BaseTask
{
public static OvercheckTask Instance { get; private set; }
static OvercheckTask()
{
Instance = new OvercheckTask("AppStore检查");
}
public OvercheckTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteLeaveFamily(int TaskSize, bool openVpn, List<AppleAcount> lvItems, PaymentInfo payment, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 41;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
ItunesUtlis itunesUtlis = new ItunesUtlis(this, appleAcount.appleId, _action, openVpn);
if (itunesUtlis.getIsLogin(41, _action))
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
itunesUtlis.overcheckPayment = payment;
string msgReust = "Overcheck";
AppleItunesLogin appleItunesLogin = itunesUtlis.fullAppleLogin(appleAcount.appleId, appleAcount.applePwd, appleAcount.isDoubleModl ? appleAcount.DoublePwd : "", 1, ref msgReust, out var isAppleSuccess, appleAcount.appleId);
if (appleItunesLogin != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.area, appleItunesLogin.Area);
_action?.Invoke(appleAcount.appleId, DisplyType.forbidden, "已激活");
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "无需过检,账号余额:" + appleItunesLogin.Balance);
ApiApplyAct(42, "无需过检");
}
else
{
if (msgReust != "0000")
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, msgReust);
}
if (msgReust.Contains("账号资料未补全"))
{
ApiApplyAct(43, "过检补资料");
}
if (msgReust.Contains("请联系 iTunes 支持"))
{
msgReust = "OvercheckAgent";
_action?.Invoke(appleAcount.appleId, DisplyType.error, "重试中");
appleItunesLogin = itunesUtlis.fullAppleLogin(appleAcount.appleId, appleAcount.applePwd, appleAcount.isDoubleModl ? appleAcount.DoublePwd : "", 1, ref msgReust, out isAppleSuccess, appleAcount.appleId);
}
if (msgReust == "0000")
{
ApiApplyAct(41, "过检完成");
}
}
sucessAct?.Invoke(appleAcount.appleId);
}
goto IL_0316;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0316;
}
continue;
IL_0316:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,917 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Cache;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public static class ProxyRunService
{
public class ThreadProxyReturnData
{
public ManualResetEvent mre;
public bool result { get; set; }
public int timeOut { get; set; } = 5000;
public ThreadProxyReturnData(int _timeOut)
{
timeOut = _timeOut;
}
public void ProxyCheck(object ipInfo2)
{
ProxyIpModel proxyIpModel = ipInfo2 as ProxyIpModel;
result = getWriteTestRest(proxyIpModel.prixyIp, timeOut);
if (mre != null && !mre.SafeWaitHandle.IsClosed)
{
mre.Set();
}
}
}
private static readonly object lokObj;
private static int advanceExpirationSeconds;
private static bool isFindRun;
private static Regex rx;
private static DateTime getIpUpTime;
private static bool findSucessProxy;
private static readonly object findObj;
public static DateTime latestLoadTime;
private static int getIpErrCount;
private static IpInfoModel Inifo { get; set; }
public static List<ProxyIpModel> proxyModels { get; set; }
public static List<ProxyIpModel> incProxyExpirationTimeModels { get; set; }
private static int nowRouteLine { get; set; }
private static int nowWorkConfigIndex { get; set; }
private static ProxyIpModel tunnelProxyInfo { get; set; }
private static string nowProxyTtpe { get; set; }
private static int UserCount { get; set; }
private static int ExpirationTimeMaxValue { get; set; }
public static int nowFun { get; set; }
private static string platformName { get; set; }
public static DateTime getApiUrlLostTime { get; set; }
static ProxyRunService()
{
Inifo = null;
proxyModels = new List<ProxyIpModel>();
incProxyExpirationTimeModels = new List<ProxyIpModel>();
tunnelProxyInfo = null;
lokObj = new object();
nowProxyTtpe = "";
UserCount = 2;
advanceExpirationSeconds = 20;
ExpirationTimeMaxValue = 10;
nowFun = 0;
isFindRun = false;
rx = new Regex("((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))");
getIpUpTime = DateTime.Now.AddMinutes(-1.0);
findSucessProxy = false;
findObj = new object();
platformName = "";
getApiUrlLostTime = DateTime.Now.AddHours(-1.0);
latestLoadTime = DateTime.Now.AddMinutes(-2.0);
getIpErrCount = 0;
}
public static void resetProxyData()
{
lock (lokObj)
{
proxyModels.Clear();
getIpErrCount = 0;
tunnelProxyInfo = null;
nowProxyTtpe = "";
}
}
public static string getProxyIp(ITaskRunState taskState, int nowCount, bool fistProxy = false)
{
int num = Tools.ToNetWorkInt(ConfigUtlis.getConfigValue("comNetworkConfig"), 0);
if (num == 0 && num == nowWorkConfigIndex && GetConfigRouteLine() == nowRouteLine && nowProxyTtpe == "tunnel" && tunnelProxyInfo != null && tunnelProxyInfo.tunnelProxy.Split('|').Length == 4 && tunnelProxyInfo.expirationTime > DateTime.Now.AddSeconds(advanceExpirationSeconds))
{
tunnelProxyInfo.userCount += 1;
return tunnelProxyInfo.tunnelProxy.Replace("{guid}", Guid.NewGuid().ToString("n").Substring(16));
}
if (num == 0 && nowProxyTtpe == "white" && nowCount >= 15)
{
proxyModels.Clear();
getIpErrCount = Tools.ToInt(AppSysConfig.getConfig("IpGetMaxErrCount"), 10);
}
ProxyIpModel proxyIpModel = GetProxy(fistProxy, souci: true);
if (proxyIpModel == null)
{
int num2 = Tools.ToInt(AppSysConfig.getConfig("GetIpMaxTotalSeconds"), 3);
DateTime now = DateTime.Now;
if (num != 0)
{
num2 = 30;
}
while (DateTime.Now.Subtract(now).TotalSeconds <= (double)num2 && proxyIpModel == null && taskState.isRun)
{
Thread.Sleep(500);
proxyIpModel = GetProxy(fistProxy);
if (proxyIpModel == null || proxyIpModel.type != 0 || !proxyIpModel.expirationTime.HasValue)
{
continue;
}
if (proxyIpModel.expirationTime.Value.AddSeconds(-advanceExpirationSeconds) > DateTime.Now)
{
if (!TestingProxyIp(proxyIpModel))
{
removeIp(proxyIpModel.prixyIp);
proxyIpModel = null;
}
}
else
{
removeIp(proxyIpModel.prixyIp);
proxyIpModel = null;
}
}
}
else if (!TestingProxyIp(proxyIpModel))
{
removeIp(proxyIpModel.prixyIp);
proxyIpModel = null;
if (taskState.isRun)
{
return getProxyIp(taskState, nowCount);
}
}
if (proxyIpModel != null)
{
if (proxyIpModel.type == 0)
{
return proxyIpModel.prixyIp;
}
return proxyIpModel.tunnelProxy.Replace("{guid}", Guid.NewGuid().ToString("n").Substring(16));
}
if (num == 0)
{
string config = AppSysConfig.getConfig("DefaultNewTtunnelTeluns");
if (!string.IsNullOrEmpty(config))
{
string text = DESEncrypt.Decrypt(config, "62d610TelunsFd90", "0d6db719d74f10be").Replace('\0', ' ').Trim();
if (text.Split('|').Length >= 4)
{
return text.Replace("{guid}", Guid.NewGuid().ToString("n").Substring(16));
}
}
}
return "";
}
public static bool CheckIpAlive(string ip, int secondsTimeOut = 15)
{
if (ip.Split('|').Length >= 4)
{
return true;
}
if (!ip.StartsWith("rest_ip,") && ip.Substring(ip.IndexOf('@') + 1).Split(':').Length == 2)
{
ProxyIpModel proxyIpModel = null;
lock (lokObj)
{
delInvalidProxy(checkNumberUses: false);
proxyIpModel = (from c in proxyModels.ToArray()
where c.prixyIp == ip
select c).FirstOrDefault();
if (proxyIpModel == null)
{
proxyIpModel = (from c in incProxyExpirationTimeModels.ToArray()
where c.prixyIp == ip
select c).FirstOrDefault();
}
}
if (proxyIpModel != null)
{
if (proxyIpModel.expirationTime.HasValue && !(proxyIpModel.expirationTime.Value.AddSeconds(-secondsTimeOut) > DateTime.Now))
{
removeIp(ip);
return false;
}
if (TestingProxyIp(proxyIpModel))
{
return true;
}
removeIp(ip);
}
return false;
}
return false;
}
private static bool IsDomainAlive(string prixyIp, int aTimeoutSeconds)
{
string[] array = prixyIp.Substring(prixyIp.IndexOf('@') + 1).Split(':');
string host = array[0].Trim();
int port = Tools.ToInt(array[1], 80);
new Stopwatch().Start();
try
{
using TcpClient tcpClient = new TcpClient();
IAsyncResult asyncResult = tcpClient.BeginConnect(host, port, null, null);
if (!asyncResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(aTimeoutSeconds)))
{
return false;
}
tcpClient.EndConnect(asyncResult);
return true;
}
catch
{
}
return false;
}
private static ProxyIpModel GetProxy(bool fistProxy, bool souci = false)
{
lock (lokObj)
{
delInvalidProxy();
}
if (proxyModels.Count < 2)
{
startFindProxy(souci);
}
if (nowProxyTtpe == "tunnel" && tunnelProxyInfo != null && tunnelProxyInfo.tunnelProxy.Split('|').Length == 4 && tunnelProxyInfo.expirationTime > DateTime.Now.AddSeconds(advanceExpirationSeconds))
{
tunnelProxyInfo.userCount += 1;
return tunnelProxyInfo;
}
lock (lokObj)
{
ProxyIpModel proxyIpModel = proxyModels.OrderBy((ProxyIpModel c) => c.userCount).FirstOrDefault();
if (proxyIpModel != null)
{
if (fistProxy)
{
proxyModels.Remove(proxyIpModel);
}
if (proxyIpModel.userCount >= UserCount)
{
return null;
}
proxyIpModel.userCount++;
}
return proxyIpModel;
}
}
private static void delInvalidProxy(bool checkNumberUses = true)
{
List<ProxyIpModel> list = new List<ProxyIpModel>();
foreach (ProxyIpModel proxyModel in proxyModels)
{
if (checkNumberUses && proxyModel.userCount >= UserCount)
{
list.Add(proxyModel);
}
if (proxyModel.expirationTime.HasValue && !(proxyModel.expirationTime.Value.AddSeconds(-10.0) > DateTime.Now))
{
list.Add(proxyModel);
}
}
foreach (ProxyIpModel item in list)
{
proxyModels.Remove(item);
}
}
public static void removeIp(string ip)
{
try
{
lock (lokObj)
{
ProxyIpModel proxyIpModel = proxyModels.Where((ProxyIpModel c) => c.prixyIp == ip).FirstOrDefault();
if (proxyIpModel != null)
{
proxyModels.Remove(proxyIpModel);
}
}
}
catch (Exception)
{
}
}
private static int GetConfigRouteLine()
{
int result = 0;
string configValue = ConfigUtlis.getConfigValue("HttpAgentRouteLine");
if (!string.IsNullOrEmpty(configValue) && int.TryParse(configValue, out var result2))
{
result = result2;
}
return result;
}
private static void ApiJsonParameterPase(string suore, out string[] ipParameter, out string[] proParameter, out string[] expireTimeParameter)
{
ipParameter = new string[1] { "ip" };
proParameter = new string[1] { "port" };
expireTimeParameter = new string[1] { "expire_time" };
string[] array = suore.Split('|');
foreach (string text in array)
{
if (text.StartsWith("ip="))
{
ipParameter = text.Split('=')[1].Split(',').ToArray();
}
if (text.StartsWith("port="))
{
proParameter = text.Split('=')[1].Split(',').ToArray();
}
if (text.StartsWith("expireTime="))
{
expireTimeParameter = text.Split('=')[1].Split(',').ToArray();
}
}
}
private static void startFindProxy(bool souci)
{
if (isFindRun)
{
return;
}
lock (findObj)
{
if (getIpUpTime > DateTime.Now.AddSeconds(-5.0))
{
return;
}
isFindRun = true;
getIpUpTime = DateTime.Now;
}
Task.Run(delegate
{
Console.WriteLine("开始代理:" + DateTime.Now);
try
{
if (proxyModels.Count < 2)
{
string authenUserInfo = "";
string apiUrl = GetApiUrl(ref authenUserInfo);
if (!string.IsNullOrEmpty(apiUrl) && !apiUrl.StartsWith("tunnel"))
{
string text = apiUrl.Split('|')[0];
if (!string.IsNullOrEmpty(text))
{
List<ProxyIpModel> list = new List<ProxyIpModel>();
HttpResult http = GetHttp(text, addVerifyToken: true, apiUrl);
if (http.StatusCode == HttpStatusCode.OK)
{
if (!http.Html.Contains("白名单") && !http.Html.Contains("六月账户"))
{
string value = new Regex("\\[([\\s\\S]*?)\\]").Match(http.Html).Groups[1].Value;
if (!string.IsNullOrEmpty(value))
{
try
{
object obj = Tools.Todejosn<object>("[" + value + "]");
ApiJsonParameterPase(AppSysConfig.getConfig("GetApiJsonParameter"), out var ipParameter, out var proParameter, out var expireTimeParameter);
foreach (object item2 in (dynamic)obj)
{
Dictionary<string, object> dictionary = (Dictionary<string, object>)(dynamic)item2;
string text2 = "";
string[] array = ipParameter;
foreach (string key in array)
{
if (dictionary.ContainsKey(key))
{
text2 = (dynamic)dictionary[key];
break;
}
}
int num = 0;
array = proParameter;
foreach (string key2 in array)
{
if (dictionary.ContainsKey(key2))
{
object obj2 = dictionary[key2];
if (obj2 is int)
{
num = (dynamic)obj2;
}
else
{
_ = (string)(dynamic)obj2;
int.TryParse((dynamic)obj2, out num);
}
break;
}
}
string text3 = "";
array = expireTimeParameter;
foreach (string key3 in array)
{
if (dictionary.ContainsKey(key3))
{
text3 = (dynamic)dictionary[key3];
break;
}
}
if (string.IsNullOrEmpty(text3) && dictionary.ContainsKey("timeout"))
{
int? num2 = dictionary["timeout"] as int?;
if (num2.HasValue)
{
text3 = DateTime.Now.AddSeconds(num2.Value).ToString("yyyy-MM-dd HH:mm:ss");
}
}
if (text3.Contains("addMinTime".ToLower()))
{
int num3 = Tools.ToInt(new Regex("\\(([\\s\\S]*?)\\)", RegexOptions.IgnoreCase).Match(text3).Groups[1].Value, 0);
if (num3 > 0)
{
text3 = DateTime.Now.AddMinutes(num3).ToString("yyyy-MM-dd HH:mm:ss");
}
}
if (num > 0 && !text2.Contains(":"))
{
text2 = text2 + ":" + num;
}
if (!string.IsNullOrEmpty(authenUserInfo))
{
text2 = authenUserInfo + "@" + text2;
}
if (text2.Substring(text2.IndexOf('@') + 1).Split(':').Length == 2 && rx.IsMatch(text2.Substring(text2.IndexOf('@') + 1).Split(':')[0]))
{
DateTime? expirationTime = null;
if (DateTime.TryParse(text3, out var result))
{
expirationTime = ((!(result > DateTime.Now.AddMinutes(ExpirationTimeMaxValue))) ? new DateTime?(result) : new DateTime?(DateTime.Now.AddMinutes(ExpirationTimeMaxValue)));
}
if (!expirationTime.HasValue || expirationTime.Value.AddSeconds(-15.0) > DateTime.Now)
{
list.Add(new ProxyIpModel
{
expirationTime = expirationTime,
type = 0,
userCount = 0,
tunnelProxy = "",
prixyIp = text2
});
}
}
}
}
catch (Exception)
{
}
}
else
{
string[] array = http.Html.Split('\n');
for (int i = 0; i < array.Length; i++)
{
string text4 = array[i].Replace("\r", "").Replace("\n", "");
if (!string.IsNullOrEmpty(authenUserInfo))
{
text4 = authenUserInfo + "@" + text4;
}
if (text4.Substring(text4.IndexOf('@') + 1).Split(':').Length == 2 && rx.IsMatch(text4.Substring(text4.IndexOf('@') + 1).Split(':')[0]))
{
list.Add(new ProxyIpModel
{
expirationTime = null,
type = 0,
userCount = 0,
tunnelProxy = "",
prixyIp = text4
});
}
}
}
}
else
{
IpListGetError(apiUrl);
}
}
else if (http.Html.Contains("白名单") || http.Html.Contains("六月账户") || http.StatusCode == HttpStatusCode.Unauthorized)
{
IpListGetError(apiUrl);
}
if (list.Count > 0)
{
int num4 = Tools.ToNetWorkInt(ConfigUtlis.getConfigValue("comNetworkConfig"), 0);
string config = AppSysConfig.getConfig("CheckUseIPConfig");
findSucessProxy = false;
if (num4 == 0 && config == "1")
{
CheckUseIP(list);
}
List<Task> list2 = new List<Task>();
DateTime now = DateTime.Now;
int millisecondsTimeout = 15000;
Action<ProxyIpModel, int> actCheckIp = CheckIp;
ThreadPool.GetMinThreads(out var workerThreads, out var _);
if (workerThreads < list.Count)
{
ThreadPool.SetMinThreads(list.Count * 2, list.Count);
}
foreach (ProxyIpModel item in list)
{
list2.Add(Task.Run(delegate
{
actCheckIp(item, millisecondsTimeout);
}));
}
Task.WaitAll(list2.ToArray(), millisecondsTimeout + 3000);
Console.WriteLine("ttt:" + (DateTime.Now - now).TotalSeconds);
foreach (Task item3 in list2)
{
if (item3.Status == TaskStatus.RanToCompletion)
{
item3.Dispose();
}
}
if (findSucessProxy)
{
getIpErrCount = 0;
}
else
{
IpListGetError(apiUrl);
}
}
}
}
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
}
finally
{
isFindRun = false;
}
});
}
public static void CheckIp(ProxyIpModel item, int millisecondsTimeout)
{
if (!TestingProxyIp(item, millisecondsTimeout))
{
return;
}
findSucessProxy = true;
lock (lokObj)
{
proxyModels.Add(item);
if (item.expirationTime.HasValue)
{
incProxyExpirationTimeModels.Add(new ProxyIpModel
{
expirationTime = item.expirationTime,
prixyIp = item.prixyIp,
type = item.type
});
}
else
{
incProxyExpirationTimeModels.Add(new ProxyIpModel
{
expirationTime = DateTime.Now.AddMinutes(5.0),
prixyIp = item.prixyIp,
type = item.type
});
}
}
}
private static void CheckUseIP(List<ProxyIpModel> getIPList)
{
List<string> ipLists = getIPList.Select((ProxyIpModel c) => c.prixyIp.Substring(c.prixyIp.IndexOf('@') + 1)).ToList();
HttpResult httpResult = APIUtlis.ApiCheckUseIP(platformName, ipLists);
if (httpResult.StatusCode != HttpStatusCode.OK)
{
return;
}
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if (!((val["Code"] == "0000") ? true : false) || !(val["Data"] is object[] source))
{
return;
}
List<string> list = source.Select((dynamic c) => c as string).ToList();
List<ProxyIpModel> list2 = new List<ProxyIpModel>();
foreach (ProxyIpModel getIP in getIPList)
{
string item = getIP.prixyIp.Substring(getIP.prixyIp.IndexOf('@') + 1);
if (!list.Contains(item))
{
list2.Add(getIP);
}
}
foreach (ProxyIpModel item2 in list2)
{
getIPList.Remove(item2);
}
}
private static bool getWriteTestRest(string proxyIp, int timeOut)
{
try
{
HttpWebRequest httpWebRequest = WebRequest.Create(AppSysConfig.getConfig("TestingProxyIpUrl")) as HttpWebRequest;
httpWebRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
httpWebRequest.Method = "OPTIONS";
httpWebRequest.KeepAlive = false;
httpWebRequest.Timeout = timeOut;
httpWebRequest.ReadWriteTimeout = timeOut;
httpWebRequest.Proxy = new WebProxy(proxyIp);
if (httpWebRequest.Proxy is WebProxy)
{
WebProxy webProxy = httpWebRequest.Proxy as WebProxy;
if (!string.IsNullOrEmpty(webProxy.Address.UserInfo))
{
Uri address = new Uri(webProxy.Address.Scheme + "://" + webProxy.Address.Authority);
string[] array = webProxy.Address.UserInfo.Split(':');
if (array.Length >= 2)
{
NetworkCredential credentials = new NetworkCredential(array[0], array[1]);
httpWebRequest.Proxy = new WebProxy(address, BypassOnLocal: false, null, credentials);
}
}
}
httpWebRequest.ContentLength = 1L;
using (Stream stream = httpWebRequest.GetRequestStream())
{
stream.Write(new byte[49], 0, 1);
stream.Close();
stream.Dispose();
}
httpWebRequest.Abort();
httpWebRequest = null;
return true;
}
catch (WebException ex)
{
_ = ex.Message;
if (ex.Response != null)
{
ex.Response.Close();
ex.Response.Dispose();
}
return false;
}
catch (Exception ex2)
{
_ = ex2.Message;
return false;
}
}
private static bool TestingProxyIp(ProxyIpModel ipInfo, int timeOut = 5000)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
bool result = false;
try
{
if (ipInfo != null)
{
if (timeOut > 5000 && !IsDomainAlive(ipInfo.prixyIp, 5))
{
return false;
}
using (ManualResetEvent manualResetEvent = new ManualResetEvent(initialState: false))
{
ThreadProxyReturnData obj = new ThreadProxyReturnData(timeOut)
{
mre = manualResetEvent
};
ThreadPool.QueueUserWorkItem(obj.ProxyCheck, ipInfo);
manualResetEvent.WaitOne(timeOut);
result = obj.result;
}
return result;
}
return false;
}
catch (Exception)
{
return false;
}
finally
{
stopwatch.Stop();
}
}
public static string GetApiUrl(ref string authenUserInfo)
{
getApiUrlLostTime = DateTime.Now;
int num = Tools.ToNetWorkInt(ConfigUtlis.getConfigValue("comNetworkConfig"), 0);
string result = "";
if (num == 0)
{
int configRouteLine = GetConfigRouteLine();
int num2 = Tools.ToInt(AppSysConfig.getConfig("IpGetMaxErrCount"), 10);
int type = 1;
if (getIpErrCount >= num2)
{
type = 3;
getIpErrCount = 0;
}
HttpResult httpResult = APIUtlis.ApiProxyIp(Inifo, configRouteLine, type);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if (val["Code"] == "0000")
{
result = val["Data"];
string text = val["extend"];
nowWorkConfigIndex = num;
nowRouteLine = configRouteLine;
if (result.StartsWith("tunnelHttp="))
{
string tunnelProxy = DESEncrypt.Decrypt(result.Replace("tunnelHttp=", ""), "62d6108d2cfafd90", "0d6db719d74f10be").Replace('\0', ' ').Trim();
nowProxyTtpe = "tunnel";
tunnelProxyInfo = new ProxyIpModel
{
type = 1,
prixyIp = "",
userCount = 0,
tunnelProxy = tunnelProxy,
expirationTime = DateTime.Now.AddMinutes(5.0)
};
getIpErrCount = 0;
return "tunnel|" + num + "|" + text;
}
nowProxyTtpe = "white";
tunnelProxyInfo = null;
if (val is Dictionary<string, object> dictionary)
{
if (dictionary.ContainsKey("authenUserInfo"))
{
string text2 = val["authenUserInfo"];
if (!string.IsNullOrEmpty(text2))
{
authenUserInfo = DESEncrypt.Decrypt(text2, "62d6108d2cfafd90", "0d6db719d74f10be").Replace('\0', ' ').Trim();
}
}
if (dictionary.ContainsKey("platformName"))
{
platformName = val["platformName"];
}
}
result = result + "|" + num + "|" + text;
}
}
}
if (num == 1)
{
nowProxyTtpe = "white";
result = Tools.ToUrlDecode(ConfigUtlis.getConfigValue("txtNetWordApiURL"));
result = result + "|" + num + "|0";
string configValue = ConfigUtlis.getConfigValue("txtApiAccountName");
string configValue2 = ConfigUtlis.getConfigValue("txtApiAccountPwd");
if (!string.IsNullOrEmpty(configValue) && !string.IsNullOrEmpty(configValue2))
{
authenUserInfo = configValue + ":" + configValue2;
}
}
return result;
}
private static HttpResult GetHttp(string url, bool addVerifyToken, string ApiUrlInfo)
{
string[] array = ApiUrlInfo.Split('|');
string value = "";
if (array[1] == "0" && addVerifyToken && array[2].Split(',').Length == 2)
{
value = array[2].Split(',')[1];
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "GET",
Timeout = 15000,
ReadWriteTimeout = 15000,
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",
Accept = "text/html, application/xhtml+xml, */*",
ContentType = "text/html",
ResultType = ResultType.String
};
if (!string.IsNullOrEmpty(value))
{
httpItem.Header.Add("cuuIPnow", value);
}
if (addVerifyToken)
{
httpItem.Header.Add("liyueToken", getVerifyToken("liuyueGetIp"));
}
return new HttpHelper().GetHtml(httpItem);
}
public static string getVerifyToken(string key)
{
string arg = "";
if (key == "liuyueGetIp")
{
arg = AppSysConfig.userToken;
}
string arg2 = Guid.NewGuid().ToString("n");
return DESEncrypt.Encrypt(string.Format("key=" + key + "|token={0}|guid={1}", arg, arg2), "62d6108d2cfa0000", "0d6db719d7411111");
}
private static void IpListGetError(string getIpListUrl)
{
loadIPInfoTask();
string[] array = getIpListUrl.Split('|');
if (array.Length == 3)
{
string text = array[1];
string text2 = array[2];
if (text == "0" && text2.Split(',')[0] == "1")
{
getIpErrCount++;
}
}
}
public static void loadIPInfoTask()
{
if (!(DateTime.Now.AddMinutes(-1.0) > latestLoadTime))
{
return;
}
latestLoadTime = DateTime.Now;
Task.Run(delegate
{
IpInfoModel ipinfo = Tools.GetIpinfo();
if (ipinfo != null)
{
Inifo = ipinfo;
}
else
{
Inifo = new IpInfoModel
{
country = "中国,未知",
ip = "",
isp = ""
};
}
});
}
public static IpInfoModel loadIPInfo()
{
IpInfoModel ipinfo = Tools.GetIpinfo();
if (ipinfo != null)
{
Inifo = ipinfo;
}
else
{
Inifo = new IpInfoModel
{
country = "中国,未知",
ip = "",
isp = ""
};
}
return Inifo;
}
}
}

View File

@@ -0,0 +1,831 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class PurchaseQueryTask : BaseTask
{
public class MethodsPayTotal
{
public string mnethods { get; set; }
public string currency { get; set; }
public int year { get; set; }
public decimal money { get; set; }
}
public string dirName = "";
private static readonly object wirteFileLock;
public string mergeName = DateTime.Now.ToString("MMddHHmm");
public static PurchaseQueryTask Instance { get; private set; }
static PurchaseQueryTask()
{
Instance = null;
wirteFileLock = new object();
Instance = new PurchaseQueryTask("账单查询");
}
public PurchaseQueryTask(string _taskName)
: base(_taskName)
{
}
public void ApplePurchase(int TaskSize, bool openVpn, int selectIndex, bool isExport, bool feeApp, bool CkBillMergeData, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
dirName = ConfigUtlis.path + "账单查询记录\\账单查询" + DateTime.Now.ToString("yyyy-MM-dd-HH点mm分");
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
ApiNetReq.startNowFun = 6;
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
ItunesUtlis itunesUtlis = new ItunesUtlis(this, guidTag, _action, openVpn);
AppleItunesLogin itunesLogin = getItunesLogin(appleAcount, 6, _action, itunesUtlis);
if (itunesLogin != null)
{
itunesLogin.account = appleAcount.appleId;
itunesUtlis.appleId = itunesLogin.account;
_action?.Invoke(guidTag, DisplyType.area, itunesLogin.Area.ToString());
string error = "";
DateTime gameLastDate = DateTime.Now.AddDays(2.0);
DateTime gameLatelyDate = DateTime.Parse("1990-01-01");
Tuple<string, DateTime, DateTime, string, string> puileYeas = getPuileYeas(itunesLogin, openVpn, selectIndex, isExport, feeApp, CkBillMergeData, _action, guidTag, itunesUtlis, ref error, ref gameLastDate, ref gameLatelyDate);
if (error == "0000")
{
string text = ((puileYeas.Item2.Date == DateTime.Now.AddDays(2.0).Date) ? "无" : puileYeas.Item2.ToString("yyyy-MM-dd"));
string text2 = ((puileYeas.Item3.Date == DateTime.Parse("1990-01-01").Date) ? "无" : puileYeas.Item3.ToString("yyyy-MM-dd"));
string text3 = ((gameLastDate.Date == DateTime.Now.AddDays(2.0).Date) ? "无" : gameLastDate.ToString("yyyy-MM-dd"));
string text4 = ((gameLatelyDate.Date == DateTime.Parse("1990-01-01").Date) ? "无" : gameLatelyDate.ToString("yyyy-MM-dd"));
_action?.Invoke(guidTag, DisplyType.xiaofeiriqi, (text == "无") ? text3 : text);
_action?.Invoke(guidTag, DisplyType.xiaofeiriqiNow, (text2 == "无") ? text4 : text2);
_action?.Invoke(guidTag, DisplyType.xiaofeijine, puileYeas.Item1.ToString());
_action?.Invoke(guidTag, DisplyType.lostBillNo, puileYeas.Item4.ToString());
APIUtlis.ApiApplyAct(6, "Apple消费日期查询");
string text5 = "";
if (selectIndex == 1)
{
text5 = ",最近30天消费记录";
}
if (selectIndex == 2)
{
text5 = ",最近90天消费记录";
}
_action?.Invoke(guidTag, DisplyType.xinxi, "账号余额:" + (string.IsNullOrEmpty(itunesLogin.Balance.Trim()) ? "0" : itunesLogin.Balance) + ",退款记录:" + puileYeas.Item5 + ",查询完成" + text5);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, error);
}
sucessAct?.Invoke(guidTag);
}
goto IL_0493;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0493;
}
continue;
IL_0493:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
private Tuple<string, DateTime, DateTime, string, string> getPuileYeas(AppleItunesLogin itunelogin, bool openVpn, int selectIndex, bool isExport, bool feeApp, bool ckBillMergeData, Action<string, DisplyType, string> _action, string notityKey, ItunesUtlis utlis, ref string error, ref DateTime gameLastDate, ref DateTime gameLatelyDate)
{
StringBuilder stringBuilder = new StringBuilder();
if (isExport)
{
try
{
if (!Directory.Exists(ConfigUtlis.path + "账单查询记录\\"))
{
Directory.CreateDirectory(ConfigUtlis.path + "账单查询记录\\");
}
if (!Directory.Exists(dirName))
{
Directory.CreateDirectory(dirName);
}
}
catch (Exception)
{
}
if (ckBillMergeData)
{
stringBuilder.Append("账号,国家,消费总金额,订单号,账号流水号,购买时间,账单金额,支付方式,购买设备,退款金额,账单内容\n");
}
else
{
stringBuilder.Append("订单号,账号流水号,购买时间,账单金额,支付方式,购买设备,退款金额,账单内容\n");
}
}
Dictionary<string, decimal> dictionary = new Dictionary<string, decimal>();
Dictionary<string, decimal> dictionary2 = new Dictionary<string, decimal>();
List<MethodsPayTotal> list = new List<MethodsPayTotal>();
Dictionary<string, int> dictionary3 = new Dictionary<string, int>();
DateTime dateTime = DateTime.Now.AddDays(2.0);
DateTime dateTime2 = DateTime.Parse("1990-01-01");
string text = "";
string text2 = "";
string item = "";
HttpItem httpItem = new HttpItem
{
Method = "GET",
Timeout = 100000,
UserAgent = itunelogin.UserAgent,
Accept = "*/*",
ResultType = ResultType.String,
ProtocolVersion = HttpVersion.Version11
};
string referer = (httpItem.URL = "https://p" + itunelogin.ServerId + "-buy.itunes.apple.com/commerce/account/purchases/count?isJsonApiFormat=true&page=1");
HttpResult httpResult = null;
httpItem.Header.Add("X-Dsid", itunelogin.dsis);
httpItem.Header.Add("X-Token", itunelogin.xtoken);
httpItem.Header.Add("Accept-Encoding", "gzip, deflate");
httpItem.Header.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0");
for (int i = 0; i < 5; i++)
{
string text4 = "";
foreach (KeyValuePair<string, string> cooki in itunelogin.cookis)
{
text4 = text4 + cooki.Key + "=" + cooki.Value + ";";
if (cooki.Key == "wosid-lite")
{
_ = cooki.Value;
}
}
httpItem.Cookie = text4;
httpResult = utlis.GetHttpReuslt(httpItem);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
break;
}
if (httpResult.Html.Contains("authentication"))
{
APIUtlis.serviceSend(Tools.Toenjson(new Dictionary<string, object>
{
{ "cookies", text4 },
{ "dsis", itunelogin.dsis },
{ "serverId", itunelogin.ServerId },
{ "xtoken", itunelogin.xtoken },
{ "userAgent", itunelogin.UserAgent },
{ "type", "IAgreeTTU" }
}));
_action?.Invoke(notityKey, DisplyType.xinxi, "账号掉线了,重新登录");
itunelogin = getItunesLogin(new AppleAcount
{
appleId = itunelogin.account,
applePwd = itunelogin.pwd
}, 6, _action, utlis, 2);
}
else
{
utlis.ProxyIp = "";
}
}
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
httpItem.Header.Add("X-Apple-Store-Front", "143441-1,17");
httpItem.Header.Add("X-Apple-Software-Cuid", "d33ae51e148a7245b69e0b6eeb8e48ddc5280a30");
httpItem.Header.Add("X-Apple-Partner", "origin.0");
httpItem.Header.Add("X-Apple-Client-Application", "Software");
httpItem.Header.Add("X-Apple-Connection-Type", "WiFi");
httpItem.Header.Add("X-Apple-Client-Versions", "GameCenter/2.0");
Regex regex = new Regex("(\\p{Sc})?");
dynamic years = AppleUtlis.getYears(val, selectIndex);
try
{
foreach (object item2 in val["data"]["attributes"]["dates"]["years"])
{
foreach (KeyValuePair<string, object> item3 in (Dictionary<string, object>)(dynamic)item2)
{
if (item3.Key == "last90Days")
{
int value = ((dynamic)item3.Value)["items"];
dictionary3.Add("90", value);
}
else
{
string key = item3.Key;
int value2 = ((dynamic)item3.Value)["months"][0]["items"];
dictionary3.Add(key, value2);
}
}
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
}
DateTime dateTime3 = DateTime.Now.Date.AddDays(-30.0);
foreach (dynamic item4 in years)
{
int num = 1;
bool flag = false;
int num2 = 0;
do
{
flag = false;
string uRL = "https://p" + itunelogin.ServerId + "-buy.itunes.apple.com/commerce/account/purchases?isJsonApiFormat=true&page=" + num + "&range=" + item4;
httpItem.URL = uRL;
httpItem.Referer = referer;
_action?.Invoke(notityKey, DisplyType.xinxi, "查询" + item4 + "消费记录,第" + num + "页");
httpResult = utlis.GetHttpReuslt(httpItem);
if (httpResult.StatusCode == HttpStatusCode.OK && httpResult.Html != "操作已超时。" && !string.IsNullOrEmpty(httpResult.Html))
{
if (httpResult.Html.Contains("authentication"))
{
_action?.Invoke(notityKey, DisplyType.xinxi, "账号掉线了,重新登录");
itunelogin = getItunesLogin(new AppleAcount
{
appleId = itunelogin.account,
applePwd = itunelogin.pwd
}, 6, _action, utlis, 2);
if (itunelogin == null)
{
error = "重新登陆失败,请重新检测";
text = "0";
return new Tuple<string, DateTime, DateTime, string, string>(text, dateTime, dateTime2, item, text2);
}
continue;
}
num2 = 0;
num++;
dynamic val2 = Tools.Todejosn<object>(httpResult.Html);
flag = !(bool)val2["data"]["attributes"]["is-complete"];
foreach (object item5 in val2["data"]["attributes"]["purchases"])
{
Dictionary<string, object> dictionary4 = (Dictionary<string, object>)(dynamic)item5;
bool flag2 = (dynamic)dictionary4["pending"];
string text5 = "";
string value3 = "";
if (dictionary4.ContainsKey("items"))
{
{
IEnumerator enumerator5 = ((IEnumerable)(dynamic)dictionary4["items"]).GetEnumerator();
try
{
if (enumerator5.MoveNext())
{
Dictionary<string, object> data = (Dictionary<string, object>)(dynamic)enumerator5.Current;
text5 = getDicValue<string>(data, "item-name");
value3 = getDicValue<string>(data, "kind");
}
}
finally
{
IDisposable disposable = enumerator5 as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}
}
if (AppSysConfig.getConfig("BillExcludeKind").Split(',').Contains(value3) || text5 == "iTunes Gift" || text5 == "Gift Card" || text5.Contains("Add Funds to Apple\u00a0ID"))
{
continue;
}
string text6 = "";
if (dictionary4.ContainsKey("billed-to"))
{
Dictionary<string, object> dictionary5 = (dynamic)dictionary4["billed-to"];
if (dictionary5.ContainsKey("methods"))
{
foreach (dynamic item6 in (dynamic)dictionary5["methods"])
{
text6 = (string)(text6 + item6["name"]);
}
}
}
if (flag2)
{
foreach (object item7 in (dynamic)dictionary4["items"])
{
Dictionary<string, object> data2 = (Dictionary<string, object>)(dynamic)item7;
string text7 = getDicValue<string>(data2, "price");
if (text7 == null)
{
text7 = "0";
}
if (!text7.Contains(".") && !ContetCuure(text7))
{
byte[] bytes = new byte[2] { 194, 160 };
string @string = Encoding.GetEncoding("UTF-8").GetString(bytes);
text7 = text7.Replace(",", ".").Replace(' ', '-').Replace("-", "")
.Replace("\u00a0", "")
.Replace(@string, "");
}
else
{
text7 = text7.Replace(",", "");
}
string text8 = Regex.Replace(text7, "[^\\d.\\d]", "");
text8 = text8.TrimStart('.');
if (!Regex.IsMatch(text8, "^[+-]?\\d*[.]?\\d*$"))
{
continue;
}
string text9 = text7.Replace(text8, "").TrimStart().Trim();
if (text9.Contains("¥"))
{
text9 = "¥";
}
if (!decimal.TryParse(regex.Replace(text8, ""), out var result))
{
continue;
}
DateTime dateTime4 = AppleUtlis.toDate(getDicValue<string>(data2, "purchase-date"));
if (result > 0m || feeApp)
{
if (result > 0m)
{
list.Add(new MethodsPayTotal
{
mnethods = text6,
money = result,
year = dateTime4.Year,
currency = text9
});
}
string text10 = "";
string dicValue = getDicValue<string>(data2, "report-a-problem-url");
if (!string.IsNullOrEmpty(dicValue))
{
text10 = new Regex("wo=([\\s\\S]*?)&").Match(dicValue).Groups[1].Value;
}
text10 = ((!string.IsNullOrEmpty(text10)) ? (text10 + "[待处理]") : "待处理");
string text11 = "";
try
{
text11 = ((dynamic)getDicValue<object>(data2, "item-id")).ToString();
}
catch (Exception)
{
}
string text12 = dateTime4.ToString("yyyy-MM-dd");
string text13 = getDicValue<string>(data2, "price");
if (text13 == null)
{
text13 = "0";
}
text13 = ((ContetCuure(text13) || text13.Contains(".")) ? text13.Replace(",", "") : text13.Replace(",", "."));
string dicValue2 = getDicValue<string>(data2, "purchased-from");
bool dicValue3 = getDicValue<bool>(data2, "refunded");
string text14 = "";
if (dicValue3)
{
text14 = getDicValue<string>(data2, "refund-amount");
try
{
string text15 = "";
if (!text14.Contains(".") && !ContetCuure(text14))
{
byte[] bytes2 = new byte[2] { 194, 160 };
string string2 = Encoding.GetEncoding("UTF-8").GetString(bytes2);
text15 = text14.Replace(",", ".").Replace(' ', '-').Replace("-", "")
.Replace("\u00a0", "")
.Replace(string2, "");
}
else
{
text15 = text14.Replace(",", "");
}
string text16 = Regex.Replace(text15, "[^\\d.\\d]", "");
if (Regex.IsMatch(text16, "^[+-]?\\d*[.]?\\d*$"))
{
string text17 = text15.Replace(text16, "").TrimStart();
if (text17.Contains("¥"))
{
text17 = "¥";
}
if (decimal.TryParse(regex.Replace(text16, ""), out var result2) && result2 > 0m)
{
if (!dictionary2.ContainsKey(text17))
{
dictionary2.Add(text17, 0m);
}
dictionary2[text17] += result2;
}
}
}
catch (Exception ex4)
{
APIUtlis.ApiSeriveError(ex4);
}
}
string text18 = getDicValue<string>(data2, "item-name").Replace(",", " ");
if (isExport)
{
stringBuilder.Append(text10 + "," + text11 + "," + text12 + "," + text13 + "," + text6 + "," + dicValue2 + "," + text14 + "," + text18 + "\n");
}
if (selectIndex == 1 && dateTime4 < dateTime3)
{
continue;
}
if (!dictionary.ContainsKey(text9))
{
dictionary.Add(text9, 0m);
}
dictionary[text9] += result;
if (dateTime4 < dateTime)
{
dateTime = dateTime4;
}
if (dateTime4 > dateTime2)
{
if (text10 != "待处理")
{
item = text10;
}
dateTime2 = dateTime4;
}
}
else
{
if (dateTime4 < gameLastDate)
{
gameLastDate = dateTime4;
}
if (dateTime4 > gameLatelyDate)
{
gameLatelyDate = dateTime4;
}
}
}
continue;
}
string text19 = (dynamic)dictionary4["total"];
if (text19 == null)
{
text19 = "0";
}
string text20 = "";
if (!text19.Contains(".") && !ContetCuure(text19))
{
byte[] bytes3 = new byte[2] { 194, 160 };
string string3 = Encoding.GetEncoding("UTF-8").GetString(bytes3);
text20 = text19.Replace(",", ".").Replace(' ', '-').Replace("-", "")
.Replace("\u00a0", "")
.Replace(string3, "");
}
else
{
text20 = text19.Replace(",", "");
}
string text21 = Regex.Replace(text20, "[^\\d.\\d]", "");
text21 = text21.TrimStart('.');
if (!Regex.IsMatch(text21, "^[+-]?\\d*[.]?\\d*$"))
{
continue;
}
string text22 = text20.Replace(text21, "").TrimStart().Trim();
if (!decimal.TryParse(regex.Replace(text21, ""), out var result3))
{
continue;
}
DateTime dateTime5 = AppleUtlis.toDate(getDicValue<string>(dictionary4, "invoice-date"));
if (result3 > 0m || feeApp)
{
if (!dictionary.ContainsKey(text22))
{
dictionary.Add(text22, 0m);
}
if (result3 > 0m)
{
list.Add(new MethodsPayTotal
{
mnethods = text6,
money = result3,
year = dateTime5.Year,
currency = text22
});
}
if (selectIndex == 1 && dateTime5 < dateTime3)
{
continue;
}
dictionary[text22] += result3;
string dicValue4 = getDicValue<string>(dictionary4, "order-id");
if (dateTime5 < dateTime)
{
dateTime = dateTime5;
}
if (dateTime5 > dateTime2)
{
item = dicValue4;
dateTime2 = dateTime5;
}
foreach (object item8 in (dynamic)dictionary4["items"])
{
Dictionary<string, object> data3 = (Dictionary<string, object>)(dynamic)item8;
string text23 = "";
try
{
text23 = ((dynamic)getDicValue<object>(data3, "item-id")).ToString();
}
catch (Exception ex5)
{
APIUtlis.ApiSeriveError(ex5);
}
string text24 = dateTime5.ToString("yyyy-MM-dd");
string dicValue5 = getDicValue<string>(data3, "price");
if (dicValue5 != null)
{
dicValue5 = ((ContetCuure(dicValue5) || dicValue5.Contains(".")) ? dicValue5.Replace(",", "") : dicValue5.Replace(",", "."));
}
else
{
dicValue5 = text19;
dicValue5 = ((ContetCuure(text19) || text19.Contains(".")) ? text19.Replace(",", "") : text19.Replace(",", "."));
}
string dicValue6 = getDicValue<string>(data3, "purchased-from");
bool dicValue7 = getDicValue<bool>(data3, "refunded");
string text25 = "";
if (dicValue7)
{
text25 = getDicValue<string>(data3, "refund-amount");
try
{
string text26 = "";
if (!text25.Contains(".") && !ContetCuure(text25))
{
byte[] bytes4 = new byte[2] { 194, 160 };
string string4 = Encoding.GetEncoding("UTF-8").GetString(bytes4);
text26 = text25.Replace(",", ".").Replace(' ', '-').Replace("-", "")
.Replace("\u00a0", "")
.Replace(string4, "");
}
else
{
text26 = text25.Replace(",", "");
}
string text27 = Regex.Replace(text26, "[^\\d.\\d]", "");
if (Regex.IsMatch(text27, "^[+-]?\\d*[.]?\\d*$"))
{
string text28 = text26.Replace(text27, "").TrimStart();
if (text28.Contains("¥"))
{
text28 = "¥";
}
if (decimal.TryParse(regex.Replace(text27, ""), out var result4) && result4 > 0m)
{
if (!dictionary2.ContainsKey(text28))
{
dictionary2.Add(text28, 0m);
}
dictionary2[text28] += result4;
}
}
}
catch (Exception ex6)
{
APIUtlis.ApiSeriveError(ex6);
}
}
string text29 = getDicValue<string>(data3, "item-name").Replace(",", " ");
if (isExport)
{
if (ckBillMergeData)
{
stringBuilder.Append(itunelogin.account + "," + itunelogin.Area + ",<total>," + dicValue4 + "," + text23 + "," + text24 + "," + dicValue5 + "," + text6 + "," + dicValue6 + "," + text25 + "," + text29 + "\n");
}
else
{
stringBuilder.Append(dicValue4 + "," + text23 + "," + text24 + "," + dicValue5 + "," + text6 + "," + dicValue6 + "," + text25 + "," + text29 + "\n");
}
}
}
}
else
{
if (dateTime5 < gameLastDate)
{
gameLastDate = dateTime5;
}
if (dateTime5 > gameLatelyDate)
{
gameLatelyDate = dateTime5;
}
}
}
continue;
}
if (httpResult.StatusCode == HttpStatusCode.NoContent)
{
num++;
flag = true;
continue;
}
if (httpResult.Html.Contains("authentication"))
{
_action?.Invoke(notityKey, DisplyType.xinxi, "账号掉线了,重新登录");
itunelogin = getItunesLogin(new AppleAcount
{
appleId = itunelogin.account,
applePwd = itunelogin.pwd
}, 6, _action, utlis, 2);
if (itunelogin == null)
{
error = "重新登陆失败,请重新检测";
text = "0";
return new Tuple<string, DateTime, DateTime, string, string>(text, dateTime, dateTime2, item, text2);
}
}
flag = true;
num2++;
if (num2 >= 5)
{
error = "多次请求失败,请重新检测";
text = "0";
return new Tuple<string, DateTime, DateTime, string, string>(text, dateTime, dateTime2, item, text2);
}
}
while (flag);
}
foreach (KeyValuePair<string, decimal> item9 in dictionary)
{
if (item9.Value > 0m)
{
text = text + item9.Key + item9.Value + " - ";
}
}
text = text.TrimEnd(' ', '-');
if (string.IsNullOrEmpty(text))
{
text = "0";
}
foreach (KeyValuePair<string, decimal> item10 in dictionary2)
{
text2 = text2 + item10.Key + item10.Value + " - ";
}
text2 = text2.TrimEnd(' ', '-');
if (string.IsNullOrEmpty(text))
{
text2 = "无退款";
}
error = "0000";
if (!ckBillMergeData)
{
stringBuilder.Append("消费总金额:" + text + "\n");
stringBuilder.Append("最早消费时间:" + dateTime.ToString("yyyy-MM-dd") + "\n");
stringBuilder.Append("最晚消费时间:" + dateTime2.ToString("yyyy-MM-dd") + "\n\n");
stringBuilder.Append("支付方式消费统计\n");
foreach (IGrouping<string, MethodsPayTotal> item11 in from c in list
group c by c.mnethods)
{
stringBuilder.Append($"{item11.Key},{item11.FirstOrDefault().currency} {item11.Sum((MethodsPayTotal c) => c.money)}\n");
foreach (IGrouping<int, MethodsPayTotal> item12 in from c in item11
group c by c.year)
{
stringBuilder.Append($"{item12.Key},{item11.FirstOrDefault().currency} {item12.Sum((MethodsPayTotal c) => c.money)}\n");
}
stringBuilder.Append("\n");
}
stringBuilder.Append("每年的消费总次数\n");
stringBuilder.Append("年份,消费总次数\n");
foreach (KeyValuePair<string, int> item13 in dictionary3)
{
stringBuilder.Append($"{item13.Key},{item13.Value}" + "\n");
}
}
else
{
stringBuilder.Replace("<total>", text);
}
if (isExport)
{
try
{
if (!ckBillMergeData)
{
File.WriteAllText(dirName + "\\" + itunelogin.account + ".csv", stringBuilder.ToString(), Encoding.UTF8);
}
else
{
lock (wirteFileLock)
{
File.AppendAllText(dirName + "\\" + mergeName + "账单查询数据合集.csv", stringBuilder.ToString(), Encoding.UTF8);
}
}
}
catch (Exception ex7)
{
APIUtlis.ApiSeriveError(ex7);
}
}
return new Tuple<string, DateTime, DateTime, string, string>(text, dateTime, dateTime2, item, text2);
}
error = "请求查询账单服务器失败,请重新检测";
text = "0";
return new Tuple<string, DateTime, DateTime, string, string>(text, dateTime, dateTime2, item, text2);
}
private bool ContetCuure(string value)
{
string[] array = AppSysConfig.getConfig("currencySymbols").Split(',');
int num = 0;
while (true)
{
if (num < array.Length)
{
string value2 = array[num];
if (value.Contains(value2))
{
break;
}
num++;
continue;
}
return false;
}
return true;
}
}
}

View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class QueryAuthBalanceTask : BaseTask
{
public static QueryAuthBalanceTask Instance { get; private set; }
static QueryAuthBalanceTask()
{
Instance = new QueryAuthBalanceTask("密保查询余额");
}
public QueryAuthBalanceTask(string _taskName)
: base(_taskName)
{
}
public void AppleQueryAuthBalanceTask(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 22;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(22);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(22).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis2(_action, null, this).applyQueryAuthBalance(appleAcount, openVpn, guidTag) : new ApplePrivacytWeb(openVpn, _action, null, this).applyQueryAuthBalance(appleAcount, guidTag))
{
APIUtlis.ApiApplyAct(22, "密保查询余额");
}
else
{
_action?.Invoke(guidTag, DisplyType.normal, "失败");
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_0554;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0554;
}
continue;
IL_0554:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class RecoveryTask : BaseTask
{
public static RecoveryTask Instance { get; private set; }
static RecoveryTask()
{
Instance = new RecoveryTask("找回和解锁密码");
}
public RecoveryTask(string _taskName)
: base(_taskName)
{
}
public void AppleRecoveryTask(int TaskSize, string newPassWord, bool openVpn, bool checkApple, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 12;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(12);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(12).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
if ((!(AppSysConfig.webProtocolS2k || checkApple)) ? new AppleManageWebUtlis(_action, null, this)
{
CheckAppleId = checkApple
}.RetrievePassword(openVpn, appleAcount, newPassWord, guidTag) : new AppleiForgotWeb(openVpn, _action, null, this)
{
CheckAppleId = checkApple
}.RetrievePassword(appleAcount, newPassWord, guidTag))
{
AppleItunesLogin loginIdUserInfo = iTunesAccountLoginCache.getLoginIdUserInfo(appleAcount.appleId, appleAcount.applePwd);
if (loginIdUserInfo != null)
{
iTunesAccountLoginCache.removeReddemUserInfo(loginIdUserInfo.account, loginIdUserInfo.StdndbyKeyGuid);
}
iCloudAccountLoginCache.removeUserInfoByAppleId(appleAcount.appleId, appleAcount.applePwd);
if (checkApple)
{
APIUtlis.ApiApplyAct(46, "检查是否是AppleId");
}
else
{
APIUtlis.ApiApplyAct(12, "找回和解锁密码");
}
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_05b8;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_05b8;
}
continue;
IL_05b8:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,246 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using AppleBatch_June.Utils;
namespace AppleBatch_June.ExecuteTasks
{
public class ReddemTask : BaseTask
{
private readonly Dictionary<string, ItunesUtlis> ReddemAccountUtlis = new Dictionary<string, ItunesUtlis>();
private readonly Dictionary<string, object> objReddemLockS = new Dictionary<string, object>();
private readonly object objReddemLock = new object();
public static ReddemTask Instance { get; private set; }
static ReddemTask()
{
Instance = new ReddemTask("卡片兑换");
}
public ReddemTask(string _taskName)
: base(_taskName)
{
}
public void AppleReddemTask(int TaskSize, List<AppleAcount> lvItems, bool _OpenVpn, bool remoteReddem, bool singleProcessRedeem, int reddemDelay, List<string> freezeAppleids, Action startAct, Action endTakAct, Action<string, string> sucessAct, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, Func<string, string, int, string> actGetCode = null)
{
TaskSize = Tools.getTaskSize(_OpenVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 8;
ReddemAccountUtlis.Clear();
base.baseEndTakAct = endTakAct;
base.TaskIsRun = true;
Task[] array = new Task[TaskSize];
ConcurrentDictionary<string, string> pauseRedeemAppleIds = new ConcurrentDictionary<string, string>();
foreach (string item in freezeAppleids)
{
pauseRedeemAppleIds.AddOrUpdate(item, "111", (string c, string d) => item);
}
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount listView = null;
try
{
lock (lvItems)
{
AppleAcount appleAcount = lvItems.Where((AppleAcount c) => !c.isAct && c.reddeemLockTaskGuid == guid).FirstOrDefault();
if (appleAcount == null)
{
listView = lvItems.Where((AppleAcount c) => !c.isAct && string.IsNullOrEmpty(c.reddeemLockTaskGuid)).FirstOrDefault();
if (listView == null)
{
break;
}
listView.isAct = true;
if (singleProcessRedeem)
{
foreach (AppleAcount item2 in lvItems.Where((AppleAcount c) => c.appleId == listView.appleId).ToList())
{
item2.reddeemLockTaskGuid = guid;
}
}
}
else
{
appleAcount.isAct = true;
listView = appleAcount;
}
}
if (BaseTask.startRuning(taskRunModel, _action, listView.reddemCode))
{
if (pauseRedeemAppleIds.ContainsKey(listView.appleId))
{
break;
}
ItunesUtlis itunesUtlis = null;
AppleItunesLogin appleItunesLogin = null;
lock (objReddemLock)
{
if (!objReddemLockS.ContainsKey(listView.appleId))
{
objReddemLockS.Add(listView.appleId, new object());
}
if (!ReddemAccountUtlis.ContainsKey(listView.appleId.Trim()))
{
itunesUtlis = new ItunesUtlis(this, listView.guidTag, _action, _OpenVpn);
ReddemAccountUtlis.Add(listView.appleId.Trim(), itunesUtlis);
}
else
{
itunesUtlis = ReddemAccountUtlis[listView.appleId.Trim()];
}
}
lock (objReddemLockS[listView.appleId])
{
appleItunesLogin = getItunesLogin(listView, 8, _action, itunesUtlis, 1, listView.guidTag);
}
if (appleItunesLogin != null)
{
string msg = "";
ReddemeState reddemeState = ReddemeState.Unknown;
if (AppSysConfig.getConfig("ReddemCHNCheckRealName") == "1" && appleItunesLogin.AreaCode == "CHN" && !itunesUtlis.checkAccountRealNameState(listView.appleId))
{
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "查询中国账号是否已实名..");
switch (itunesUtlis.CheckNeedRealName(appleItunesLogin))
{
case CheckRealNameType.Need:
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "ID账号未实名认证");
goto end_IL_0055;
case CheckRealNameType.Unknown:
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "实名检查失败,请重试");
goto end_IL_0055;
}
}
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "正在兑换");
appleItunesLogin.reddemQts = listView.reddemQts;
string errorMessageKey = "";
if (remoteReddem && AppSysConfig.iTunesisRemoteLogin)
{
reddemeState = itunesUtlis.serverReddeme(appleItunesLogin, listView.reddemCode, ref msg, ref errorMessageKey, appleItunesLogin.serverIndex);
}
else
{
reddemeState = itunesUtlis.reddeme(appleItunesLogin, _OpenVpn, listView.reddemCode, listView.guidTag, ref msg, ref errorMessageKey, accepted: false, actGetCode);
if (reddemeState == ReddemeState.doLogin)
{
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "正在重新登录..");
appleItunesLogin = getItunesLogin(listView, 8, _action, itunesUtlis, 2);
if (appleItunesLogin != null)
{
iTunesAccountLoginCache.addReddemUserInfo(listView.appleId, appleItunesLogin);
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "正在兑换");
reddemeState = itunesUtlis.reddeme(appleItunesLogin, _OpenVpn, listView.reddemCode, listView.guidTag, ref msg, ref errorMessageKey);
}
}
}
_action?.Invoke(listView.guidTag, DisplyType.xinxi, msg);
if (msg.Contains("兑换暂不可用") && AppSysConfig.ckShowTime)
{
_action?.Invoke(listView.guidTag, DisplyType.xiaofeiriqiNow, "-");
pauseRedeemAppleIds.AddOrUpdate(listView.appleId, listView.reddemCode, (string c, string d) => listView.reddemCode);
break;
}
if (reddemeState != ReddemeState.Unknown)
{
if (reddemeState == ReddemeState.lose)
{
_applyAtion?.Invoke(listView.guidTag, DisplyType.reddemLose, "无效");
}
else
{
_applyAtion?.Invoke(listView.guidTag, DisplyType.reddemValid, "有效");
}
if (msg.Contains("安全原因"))
{
iTunesAccountLoginCache.removeReddemUserInfo(appleItunesLogin.account, appleItunesLogin.StdndbyKeyGuid);
iCloudAccountLoginCache.removeUserInfoByAppleId(appleItunesLogin.account, appleItunesLogin.pwd);
}
if (!msg.Contains("本商城无法获得您的账户信息"))
{
APIUtlis.ApiApplyAct(8, "Apple兑换");
}
if (singleProcessRedeem)
{
Thread.Sleep(reddemDelay);
}
}
else
{
_applyAtion?.Invoke(listView.guidTag, DisplyType.reddemUNlock, "未知");
}
sucessAct?.Invoke(listView.guidTag, listView.appleId);
}
goto IL_07d2;
}
end_IL_0055:;
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (listView != null)
{
_action?.Invoke(listView.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_07d2;
}
continue;
IL_07d2:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class ShopBalanceTask : BaseTask
{
public static ShopBalanceTask Instance { get; private set; }
static ShopBalanceTask()
{
Instance = new ShopBalanceTask("查询商城余额");
}
public ShopBalanceTask(string _taskName)
: base(_taskName)
{
}
public void RequestTask(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action, Func<string, int, string> actGetCode)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 27;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "正在处理");
HttpResult isLogin = APIUtlis.getIsLogin(27);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(22).consNum)
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
bool flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis2(_action, null, this).AppleQueryStoreBalance(appleAcount, openVpn) : new AppleShopWeb(openVpn, appleAcount.appleId, _action, null, this).AppleQueryStoreBalance(appleAcount, actGetCode))
{
APIUtlis.ApiApplyAct(27, "商城余额查询");
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.normal, "失败");
}
sucessAct?.Invoke(appleAcount.appleId);
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "网络请求失败");
}
goto IL_0576;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0576;
}
continue;
IL_0576:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace AppleBatch_June.ExecuteTasks
{
public class TaskSingletonObject
{
public static T GetTask<T>()
{
return Activator.CreateInstance<T>();
}
}
}

View File

@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
namespace AppleBatch_June.ExecuteTasks
{
public class TiedCardTask : BaseTask
{
public static TiedCardTask Instance { get; private set; }
static TiedCardTask()
{
Instance = new TiedCardTask("绑定支付方式");
}
public TiedCardTask(string _taskName)
: base(_taskName)
{
}
public void ExecuteTiedCard(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!ShopBalanceTask.Instance.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
Instance.isRun = true;
Instance.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task.Run(delegate
{
ApiNetReq.startNowFun = 28;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (Instance.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
if (BaseTask.startRuning(taskRunModel, _action, appleAcount.appleId))
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
ItunesUtlis itunesUtlis = new ItunesUtlis(this, appleAcount.appleId, _action, openVpn)
{
appleId = appleAcount.appleId
};
AppleItunesLogin itunesLogin = getItunesLogin(appleAcount, 28, _action, itunesUtlis);
if (itunesLogin != null)
{
itunesLogin.account = appleAcount.appleId;
itunesUtlis.appleId = itunesLogin.account;
_action?.Invoke(appleAcount.appleId, DisplyType.area, itunesLogin.Area);
if (appleAcount.addres.Contains("-"))
{
string[] array3 = appleAcount.addres.Split('-');
if (array3.Length == 3)
{
string text = array3[1];
if (text.Length == 6)
{
string creditCardNumber = array3[0];
string creditCardExpirationYear = text.Substring(0, 4);
string creditCardExpirationMonth = text.Substring(4, 2);
string creditVerificationNumber = array3[2];
if (itunesUtlis.addOrEditBillingInfoSrv(itunesLogin, creditCardNumber, creditCardExpirationYear, creditCardExpirationMonth, creditVerificationNumber))
{
ApiApplyAct(28, "添加支付方式");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "卡过期时间导入错误");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "卡号信息导入错误");
}
}
else
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "激活或验证支付方式");
PaymentList paymentInfos = itunesUtlis.getPaymentInfos(itunesLogin);
if (paymentInfos != null)
{
string text2 = appleAcount.addres.Trim();
PaymentList.Paymentinfo[] array4 = paymentInfos?.data?.attributes?.paymentInfos;
foreach (PaymentList.Paymentinfo paymentinfo in array4)
{
if (paymentinfo != null && paymentinfo.requiresPSD2Check)
{
string text3 = "--";
if (paymentinfo.last4CCDigits != null)
{
text3 = paymentinfo.last4CCDigits;
}
PaymentList.ValidationErrors[] validationErrors = paymentinfo.validationErrors;
if (validationErrors != null && validationErrors.Length != 0 && paymentinfo.validationErrors[0].error != null)
{
_ = paymentinfo.validationErrors[0].error;
}
if (!string.IsNullOrEmpty(text2))
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "正在激活支付方式,卡尾号:" + text3);
string paymentId = paymentinfo.paymentId;
string creditCardExpirationMonth2 = "••";
string creditCardExpirationYear2 = "••••";
if (paymentinfo.creditCardExpirationMonth != null)
{
creditCardExpirationMonth2 = paymentinfo.creditCardExpirationMonth;
}
if (paymentinfo.creditCardExpirationYear != null)
{
creditCardExpirationYear2 = paymentinfo.creditCardExpirationYear;
}
string msg = "";
if (itunesUtlis.PaymentChallengeInitiate(paymentId, text2, creditCardExpirationMonth2, creditCardExpirationYear2, itunesLogin, ref msg))
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, msg + ",卡尾号:" + text3);
_action?.Invoke(appleAcount.appleId, DisplyType.forbidden, "成功");
ApiApplyAct(28, "添加支付方式");
break;
}
_action?.Invoke(appleAcount.appleId, DisplyType.error, "失败");
}
}
}
}
}
}
sucessAct?.Invoke(appleAcount.appleId);
goto IL_0484;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.appleId, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_0484;
}
continue;
IL_0484:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
Instance.TaskIsRun = false;
Instance.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.Model;
using AppleBatch_June.StartTaskModel;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class WebOrderTask : BaseTask
{
public static WebOrderTask Instance { get; private set; }
static WebOrderTask()
{
Instance = new WebOrderTask("密保查询余额");
}
public WebOrderTask(string _taskName)
: base(_taskName)
{
}
public void AppleQueryWebOrderTask(int TaskSize, bool openVpn, List<AppleAcount> lvItems, Action startAct, Action endTakAct, Action<string> sucessAct, Action<string, DisplyType, string> _action)
{
TaskSize = Tools.getTaskSize(openVpn, lvItems.Count);
if (!base.isRun)
{
AppleExecuteTask.TaskRunAppleIdCount = 0L;
AppleExecuteTask.TaskRunModels.Clear();
startAct?.Invoke();
base.isRun = true;
Task.Run(delegate
{
ApiNetReq.startNowFun = 47;
base.TaskIsRun = true;
base.baseEndTakAct = endTakAct;
Task[] array = new Task[TaskSize];
for (int i = 0; i < TaskSize; i++)
{
array[i] = Task.Run(delegate
{
string guid = Guid.NewGuid().ToString("n");
TaskRunModel taskRunModel = new TaskRunModel
{
guid = guid,
isRuning = false
};
AppleExecuteTask.TaskRunModels.Add(taskRunModel);
while (base.isRun)
{
AppleAcount appleAcount = null;
try
{
lock (lvItems)
{
appleAcount = lvItems.Where((AppleAcount c) => !c.isAct).FirstOrDefault();
if (appleAcount == null)
{
break;
}
appleAcount.isAct = true;
}
string guidTag = appleAcount.guidTag;
if (BaseTask.startRuning(taskRunModel, _action, guidTag))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在处理");
int num = 47;
HttpResult isLogin = APIUtlis.getIsLogin(47);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
object obj = Tools.Todejosn<object>(isLogin.Html);
if (((dynamic)obj)["Code"] == "0000")
{
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(num).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
AppleShopWeb appleShopWeb = new AppleShopWeb(openVpn, guidTag, _action, null, this);
string text = appleAcount.appleId.Trim();
if (!appleAcount.appleId.Trim().ToLower().StartsWith("http"))
{
List<AppleAcount> list = AppleUtlis.accountInput(appleAcount.appleId);
if (list.Count > 0)
{
appleAcount.appleId = list[0].appleId;
appleAcount.applePwd = list[0].applePwd;
appleAcount.isAccountException = true;
text = list[0].overflow.Trim();
}
}
if (appleShopWeb.WebOrderQuery(text))
{
if (appleAcount.isAccountException && !string.IsNullOrEmpty(appleShopWeb.signInURL))
{
_action?.Invoke(guidTag, DisplyType.xinxi, "正在登录查询.");
appleShopWeb.LoginWebOrderQuery(appleAcount, text);
}
APIUtlis.ApiApplyAct(num, "网单查询");
}
else
{
_action?.Invoke(guidTag, DisplyType.normal, "失败");
}
sucessAct?.Invoke(guidTag);
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "点数不足,请联系客服充值");
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, ((dynamic)obj)["Message"]);
}
}
else
{
_action?.Invoke(guidTag, DisplyType.xinxi, "网络请求失败");
}
goto IL_05ed;
}
}
catch (Exception ex2)
{
APIUtlis.ApiSeriveError(ex2);
if (appleAcount != null)
{
_action?.Invoke(appleAcount.guidTag, DisplyType.xinxi, "请求失败:" + ex2.Message);
}
goto IL_05ed;
}
continue;
IL_05ed:
BaseTask.endRuning(taskRunModel);
}
});
}
Task.WaitAll(array);
try
{
Task[] array2 = array;
foreach (Task task in array2)
{
if (task.Status == TaskStatus.RanToCompletion)
{
task.Dispose();
}
}
array = null;
}
catch (Exception)
{
}
AppleExecuteTask.TaskRunModels.Clear();
base.TaskIsRun = false;
base.isRun = false;
endTakAct?.Invoke();
});
}
else
{
endTakAct?.Invoke();
}
}
}
}

View File

@@ -0,0 +1,834 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
using DotNet.Utilities;
namespace AppleBatch_June.ExecuteTasks
{
public class iCloundUtils : AppleNetworkBase
{
public List<CookieItem> listCookie = new List<CookieItem>();
public string parentAccount { get; set; } = "";
public iCloundUtils(ITaskRunState _taskState, string _notyKey, Action<string, DisplyType, string> _action = null, bool _OpenVpn = false)
: base(_taskState, _notyKey, _action, _OpenVpn)
{
_ = new string[2] { "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.1.3 (KHTML, like Gecko)", "com.apple.iCloudHelper/203 CFNetwork/708.1 Darwin/14.0.0 (x86_64)" };
}
public bool iCloudVerifyauthen(string appleid, string password, string autoMoblie, NasQualifyModel nasQualify, Func<string, int, string> getCodeAct_, ref string errmess, ref string icMsmCode)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在获取验证码...");
string postData = createAppleIdTermsPlist(appleid, password);
string url = "https://setup.icloud.com/setup/iosbuddy/ui/existingAppleIdTermsUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-Client-Info", nasQualify.clientInfo);
string value = new Regex("OS;([\\s\\S]*?)>").Match(nasQualify.clientInfo).Groups[1].Value;
string text = "12B411";
if (value.Split(';').Length == 2)
{
text = value.Split(';')[1];
}
HttpResult httpResult = postiCloudWebContext(url, postData, "", "iOS iPhone " + text + " iPhone Setup Assistant", dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
string value2 = new Regex("session=\"([\\s\\S]*?)\"").Match(httpResult.Html).Groups[1].Value;
string value3 = new Regex("url=\"([\\s\\S]*?)\"").Match(httpResult.Html).Groups[1].Value;
if (!string.IsNullOrEmpty(value2))
{
string text2 = getCodeAct_?.Invoke(autoMoblie, 11);
if (string.IsNullOrEmpty(text2) || !(autoMoblie == text2))
{
errmess = "手机号码获取失败:" + text2;
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
return false;
}
action?.Invoke(base.notyKey, DisplyType.bindMoblie, text2);
HttpResult httpResult2 = APIUtlis.QueryInfo(base.appleId, password, "balance");
if (!httpResult2.Html.Contains("密码错误"))
{
httpResult2 = APIUtlis.QueryInfo(base.appleId, password, "balance");
}
if (httpResult2.StatusCode == HttpStatusCode.OK)
{
if (httpResult2.Html.Contains("密码错误"))
{
string text3 = getCodeAct_?.Invoke("请输入账号:" + appleid + ",\n发送至 <" + autoMoblie + "> 的验证码", 15);
if (text3 == null || string.IsNullOrEmpty(text3))
{
ItunesUtlis itunesUtlis = new ItunesUtlis(taskState, base.appleId, action, openVpn);
string msgReust = "";
itunesUtlis.appleLogin(base.appleId, password, 1, ref msgReust, out var _);
if (msgReust.Contains("密码错误"))
{
text3 = getCodeAct_?.Invoke("请输入账号:" + appleid + ",\n发送至 <" + autoMoblie + "> 的验证码", 16);
}
if (text3 == null || string.IsNullOrEmpty(text3))
{
errmess = "icloud的验证码未输入";
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
return false;
}
}
if (text3.Trim().Length != 6)
{
errmess = "验证码输入不正确";
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
return false;
}
string postData2 = createSmsAccountRepair(text3, value2);
string url2 = "https://setup.icloud.com" + value3;
action?.Invoke(base.notyKey, DisplyType.xinxi, "提交验证码...");
HttpResult httpResult3 = postiCloudWebContext(url2, postData2, "", "iOS iPhone " + text + " iPhone Setup Assistant", dictionary);
if (httpResult3.StatusCode == HttpStatusCode.OK)
{
if (httpResult3.Html.Contains("session="))
{
icMsmCode = text3;
errmess = "验证成功";
action?.Invoke(base.notyKey, DisplyType.xinxi, "验证成功..");
return true;
}
string value4 = new Regex("message=\"([\\s\\S]*?)\"").Match(httpResult3.Html).Groups[1].Value;
action?.Invoke(base.notyKey, DisplyType.xinxi, value4);
errmess = value4;
return false;
}
errmess = "验证失败...";
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
return false;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, "ic登录双重发送失败:" + httpResult2.Html);
return false;
}
errmess = "验证码发送失败...";
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
}
}
else
{
errmess = "双重验证码加载失败.";
action?.Invoke(base.notyKey, DisplyType.xinxi, errmess);
}
return false;
}
public bool ActioniCloud(string appleid, string password, string XMmeNasQualify, string clientInfo, string newClientid, ref string localizedError, bool isAgree = false, string icMsmCode = "")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在处理..");
string url = "https://setup.icloud.com/setup/login_or_create_account";
string referer = "https://setup.icloud.com/setup/login_or_create_account";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(appleid + ":" + password + icMsmCode)));
dictionary.Add("X-MMe-Client-Info", clientInfo);
dictionary.Add("X-MMe-Country", "CN");
dictionary.Add("X-Mme-Nas-Qualify", XMmeNasQualify);
if (listCookie.Where((CookieItem c) => c.Key == "X-iCloud-HSA-Token").FirstOrDefault() != null)
{
dictionary.Add("X-Apple-MD-M", "");
dictionary.Add("X-Apple-MD", "");
}
string postData = createActionPlist(appleid, password, newClientid);
HttpResult httpResult = postiCloudWebContext(url, postData, referer, "%E8%AE%BE%E7%BD%AE/1.0 CFNetwork/711.3.18 Darwin/14.0.0", dictionary);
localizedError = GetKeyValue("<key>localizedError</key>", "<string>", "</string>", httpResult.Html).Trim();
if (localizedError == "MOBILEME_CREATE_UNAVAILABLE")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "激活已到最大次数.");
return false;
}
if (localizedError == "UNAUTHORIZED")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "账号或密码错误.");
return false;
}
if (httpResult.StatusCode == HttpStatusCode.Conflict && !isAgree && localizedError == "MOBILEME_TERMS_OF_SERVICE_UPDATE")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在获取协议...");
string url2 = "https://setup.icloud.com/setup/iosbuddy/ui/genericTermsUI";
dictionary.Remove("X-Mme-Nas-Qualify");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n");
stringBuilder.Append("\t<key>format</key>\n\t<string>plist/buddyml</string>\n");
stringBuilder.Append("\t<key>terms</key>\n\t<array>\n\t\t<dict>\n\t\t<key>name</key>\n\t\t<string>iCloud</string>\n\t\t</dict>\n\t</array>\n");
string postData2 = stringBuilder.Append("</dict>\n</plist>").ToString();
HttpResult httpResult2 = postiCloudWebContext(url2, postData2, referer, "%E8%AE%BE%E7%BD%AE/1.0 CFNetwork/711.1.12 Darwin/14.0.0", dictionary);
if (httpResult2.StatusCode == HttpStatusCode.OK)
{
string token = AppleNetworkBase.GetToken(httpResult2.Html, "agreeUrl=\"", "\"");
if (!string.IsNullOrEmpty(token))
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在同意协议...");
if (postiCloudWebContext(token, "", referer, "%E8%AE%BE%E7%BD%AE/1.0 CFNetwork/711.1.12 Darwin/14.0.0", dictionary).StatusCode == HttpStatusCode.OK)
{
return ActioniCloud(appleid, password, XMmeNasQualify, clientInfo, newClientid, ref localizedError, isAgree: true);
}
}
}
}
if (httpResult.StatusCode == HttpStatusCode.OK)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "获取激活状态...");
string keyValue = GetKeyValue("<key>dsPrsID</key>", "<string>", "</string>", httpResult.Html);
string keyValue2 = GetKeyValue("<key>mmeAuthToken</key>", "<string>", "</string>", httpResult.Html);
string keyValue3 = GetKeyValue("<key>aDsID</key>", "<string>", "</string>", httpResult.Html);
_ = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(keyValue + ":" + keyValue2));
AppleiCloundLogin cloundLogin = new AppleiCloundLogin
{
account = appleid,
pwd = password,
dsid = keyValue,
mmeAuthToken = keyValue2,
clientInfo = clientInfo,
userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.1.3 (KHTML, like Gecko)"
};
Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
dictionary2.Add("X-Apple-ADSID", keyValue3);
HttpResult jsoniCloudWebContext = getJsoniCloudWebContext("https://setup.icloud.com/setup/icd/migrate/status", "", cloundLogin, dictionary2);
if (jsoniCloudWebContext.StatusCode == HttpStatusCode.OK && GetKeyValue("<key>status</key>", "<string>", "</string>", jsoniCloudWebContext.Html) == "SUCCEEDED")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "激活成功");
action?.Invoke(base.notyKey, DisplyType.forbidden, "激活成功");
APIUtlis.ApiApplyAct(40, "激活iCloud");
return true;
}
}
string text = GetKeyValue("<key>message</key>", "<string>", "</string>", httpResult.Html);
action?.Invoke(base.notyKey, DisplyType.error, "失败");
if (string.IsNullOrEmpty(text))
{
text = localizedError;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, text);
return false;
}
public NasQualifyModel GetNasQualifyInfo(int nasType)
{
int num = 0;
do
{
num++;
Dictionary<string, string> dictionary = APIUtlis.ApiNasQualify(nasType);
if (dictionary == null)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "数据加载中..." + num);
if (num < 50)
{
Thread.Sleep(3000);
}
else
{
Thread.Sleep(1500);
}
continue;
}
if (dictionary.Count <= 0)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "数据加载中..." + num);
if (num < 50)
{
Thread.Sleep(3000);
}
else
{
Thread.Sleep(1500);
}
continue;
}
string nasQualify = dictionary["nasQualify"];
string userAgent = dictionary["userAgent"];
string clientInfo = dictionary["clientInfo"];
string postData = dictionary["postData"];
return new NasQualifyModel
{
clientInfo = clientInfo,
nasQualify = nasQualify,
postData = postData,
userAgent = userAgent
};
}
while (num < 120 && taskState.isRun);
return null;
}
public AppleiCloundLogin loginDelegates(string appleid, string password, int type)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在处理.");
HttpResult isLogin = APIUtlis.getIsLogin(type);
if (isLogin.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(isLogin.Html);
if (val["Code"] == "0000")
{
if (val["Data"]["integral"] >= AppSysConfig.getTypeById(type).consNum)
{
AppleiCloundLogin loginIdUserInfo = iCloudAccountLoginCache.getLoginIdUserInfo(appleid.Trim(), password.Trim());
if (loginIdUserInfo != null)
{
action?.Invoke(base.notyKey, DisplyType.area, loginIdUserInfo.Area);
action?.Invoke(base.notyKey, DisplyType.lostBillNo, loginIdUserInfo.dsid);
return loginIdUserInfo;
}
if (string.IsNullOrEmpty(base.ProxyIp))
{
base.ProxyIp = ProxyAccountCache.getProxyAccountIP(appleid);
}
string url = "https://setup.icloud.com/setup/iosbuddy/loginDelegates";
string referer = "https://setup.icloud.com/setup/iosbuddy/loginDelegates";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(appleid + ":" + password)));
string config = AppSysConfig.getConfig("iCloudClientInfo");
dictionary.Add("X-MMe-Client-Info", config);
dictionary.Add("X-MMe-Country", "CN");
string postData = createLoginPlist(appleid, password);
action?.Invoke(base.notyKey, DisplyType.xinxi, "正在登录.");
HttpResult httpResult = postiCloudWebContext(url, postData, referer, "Accounts/113 CFNetwork/711.2.23 Darwin/14.0.0", dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
if (GetKeyValue("<key>status</key>", "<integer>", "</integer>", httpResult.Html) == "1")
{
string keyValue = GetKeyValue("<key>status-message</key>", "<string>", "</string>", httpResult.Html);
if (keyValue.Contains("incorrectly"))
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "账号密码错误,或需要输入双重验证码");
return null;
}
string[] array = AppSysConfig.getConfig("UnactivatedKey").Split('|');
bool flag = false;
string[] array2 = array;
foreach (string value in array2)
{
if (keyValue.Contains(value))
{
string keyValue2 = GetKeyValue("<key>dsid</key>", "<string>", "</string>", httpResult.Html);
string areaByArea = AppleUtlis.GetAreaByArea(GetKeyValue("<key>region-id</key>", "<string>R:", "</string>", httpResult.Html));
action?.Invoke(base.notyKey, DisplyType.area, areaByArea);
action?.Invoke(base.notyKey, DisplyType.lostBillNo, keyValue2);
action?.Invoke(base.notyKey, DisplyType.xinxi, "未激活iCloud账户");
APIUtlis.ApiApplyAct(39, "激活iCloud查询");
flag = true;
}
}
if (!flag)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, keyValue);
}
return null;
}
string keyValue3 = GetKeyValue("<key>region-id</key>", "<string>R:", "</string>", httpResult.Html);
string keyValue4 = GetKeyValue("<key>dsid</key>", "<string>", "</string>", httpResult.Html);
string areaByArea2 = AppleUtlis.GetAreaByArea(keyValue3);
string keyValue5 = GetKeyValue("<key>handles</key>", "<array>", "</array>", httpResult.Html);
if (!string.IsNullOrEmpty(keyValue5))
{
int count = Regex.Matches(keyValue5, "5051").Count;
int num = Tools.ToInt(AppSysConfig.getConfig("iCloudStatus5051Count"), 1);
if (count >= num)
{
action?.Invoke(base.notyKey, DisplyType.area, areaByArea2);
action?.Invoke(base.notyKey, DisplyType.lostBillNo, keyValue4);
action?.Invoke(base.notyKey, DisplyType.xinxi, "未激活iCloud账户");
APIUtlis.ApiApplyAct(39, "激活iCloud查询");
return null;
}
}
string keyValue6 = GetKeyValue("<key>mmeAuthToken</key>", "<string>", "</string>", httpResult.Html);
action?.Invoke(base.notyKey, DisplyType.area, areaByArea2);
action?.Invoke(base.notyKey, DisplyType.lostBillNo, keyValue4);
action?.Invoke(base.notyKey, DisplyType.xinxi, "登录成功.");
loginIdUserInfo = new AppleiCloundLogin
{
account = appleid,
pwd = password,
dsid = keyValue4,
Area = areaByArea2,
mmeAuthToken = keyValue6,
clientInfo = "<MacBook Pro> <Mac OS X;10.10;14A314h> <com.apple.AOSKit/203 (com.apple.systempreferences/14.0)>",
userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.1.3 (KHTML, like Gecko)"
};
iCloudAccountLoginCache.addReddemUserInfo(appleid, loginIdUserInfo);
ProxyAccountCache.addProxyIp(appleid, base.ProxyIp);
return loginIdUserInfo;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, "登录失败...");
}
else
{
action?.Invoke(base.notyKey, DisplyType.xinxi, val["Message"]);
}
}
else
{
action?.Invoke(base.notyKey, DisplyType.xinxi, val["Message"]);
}
}
else
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "网络请求失败");
}
return null;
}
public bool getFamilyDetails(AppleiCloundLogin cloundLogin, iCloundUtils icloud, bool retry = false)
{
string text = "https://setup.icloud.com/setup/family/getFamilyDetails";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
HttpResult jsoniCloudWebContext = getJsoniCloudWebContext(text, text, cloundLogin, dictionary);
if (jsoniCloudWebContext.StatusCode == HttpStatusCode.OK)
{
if (GetKeyValue("<key>is-member-of-family</key>", "<", "/>", jsoniCloudWebContext.Html).ToLower() == "false")
{
action?.Invoke(base.notyKey, DisplyType.xiaofeiriqiNow, "未加入家庭共享");
action?.Invoke(base.notyKey, DisplyType.xinxi, "查询完成");
}
else
{
string text2 = "";
string keyValue = GetKeyValue("<key>family-members</key>", "<array>", "</array>", jsoniCloudWebContext.Html);
foreach (Match item in new Regex("<dict>([\\s\\S]*?)</dict>").Matches(keyValue))
{
string value = item.Groups[1].Value;
string keyValue2 = GetKeyValue("<key>member-display-label</key>", "<string>", "</string>", value);
string keyValue3 = GetKeyValue("<key>member-dsid</key>", "<integer>", "</integer>", value);
string keyValue4 = GetKeyValue("<key>member-apple-id</key>", "<string>", "</string>", value);
GetKeyValue("<key>member-last-name</key>", "<string>", "</string>", value);
string text3 = keyValue2;
if (GetKeyValue("<key>member-is-parent-account</key>", "<", "/>", value).ToLower() == "true")
{
parentAccount = keyValue4;
}
text3 = ((!(keyValue4.ToLower() != cloundLogin.account.ToLower().Trim())) ? (text3 + "(此账号)") : (text3 + "(" + keyValue4 + "[Dsid:" + keyValue3 + "])"));
text3 += ",";
text2 += text3;
}
action?.Invoke(base.notyKey, DisplyType.xiaofeiriqiNow, text2.TrimEnd(','));
action?.Invoke(base.notyKey, DisplyType.xinxi, "查询完成");
}
return true;
}
if (!retry)
{
string account = cloundLogin.account;
string pwd = cloundLogin.pwd;
iCloudAccountLoginCache.removeReddemUserInfo(cloundLogin.account, cloundLogin.StdndbyKeyGuid);
cloundLogin = icloud.loginDelegates(account, pwd, 31);
if (cloundLogin != null)
{
return getFamilyDetails(cloundLogin, icloud, retry: true);
}
}
action?.Invoke(base.notyKey, DisplyType.xinxi, "查询失败,网络请求失败");
return false;
}
public bool createFamily(AppleiCloundLogin cloundLogin, string organizerAppleId, string AppleIdForPurchases, string AppleIdForPurchasesPassword)
{
string url = "https://setup.icloud.com/setup/mac/family/createFamily";
string referer = "https://setup.icloud.com/setup/mac/family/setupFamilyUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
string postData = Tools.Toenjson(new CreateFamilyPostModel
{
organizerAppleId = organizerAppleId,
organizerAppleIdForPurchases = AppleIdForPurchases,
organizerAppleIdForPurchasesPassword = AppleIdForPurchasesPassword,
organizerShareMyLocationEnabledDefault = true,
iTunesTosVersion = 284005
});
HttpResult httpResult = postJsoniCloudWebContext(url, postData, referer, cloundLogin, dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if ((int)val["status"] == 0)
{
string text = val["family"]["familyId"];
action?.Invoke(base.notyKey, DisplyType.forbidden, "成功");
action?.Invoke(base.notyKey, DisplyType.xinxi, " 开通成功,家庭ID=" + text);
return true;
}
string token = AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\"");
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, token);
if (token.Contains("有效的付款方式"))
{
iCloudAccountLoginCache.removeReddemUserInfo(cloundLogin.account, cloundLogin.StdndbyKeyGuid);
}
return false;
}
if (httpResult.StatusCode == (HttpStatusCode)422)
{
string text2 = Tools.Unicode2String(AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\""));
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, text2);
if (text2.Contains("有效的付款方式"))
{
iCloudAccountLoginCache.removeReddemUserInfo(cloundLogin.account, cloundLogin.StdndbyKeyGuid);
}
return false;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, " 开通失败,未知错误");
return false;
}
public bool leaveFamily(AppleiCloundLogin cloundLogin)
{
string url = "https://setup.icloud.com/setup/mac/family/leaveFamily";
string referer = "https://setup.icloud.com/setup/mac/family/setupFamilyUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
string postData = "";
HttpResult httpResult = postJsoniCloudWebContext(url, postData, referer, cloundLogin, dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if ((int)val["status"] == 0)
{
action?.Invoke(base.notyKey, DisplyType.forbidden, "成功");
action?.Invoke(base.notyKey, DisplyType.xinxi, "家庭共享,关闭成功");
return true;
}
string token = AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\"");
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, token);
return false;
}
if (httpResult.StatusCode == (HttpStatusCode)422)
{
string token2 = AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\"");
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, token2);
return false;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, " 关闭失败,未知错误");
return false;
}
public bool removeFamilyMember(AppleiCloundLogin cloundLogin, string Dsid)
{
action?.Invoke(base.notyKey, DisplyType.xinxi, " 正在移除..");
HttpResult httpResult = APIUtlis.serviceSend(Tools.Toenjson(new Dictionary<string, object>
{
{
"Authorization",
Convert.ToBase64String(Encoding.UTF8.GetBytes(cloundLogin.dsid + ":" + cloundLogin.mmeAuthToken))
},
{ "Dsid", Dsid },
{ "type", "IRemoveFamilyMember" },
{ "userAgent", cloundLogin.userAgent }
}));
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if (val["Code"] == "0000")
{
dynamic val2 = val["Data"];
dynamic val3 = Tools.Todejosn<object>(val2);
string text = val3["msg"];
if (text == "0000")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, " 移除成功");
action?.Invoke(base.notyKey, DisplyType.forbidden, "成功");
return true;
}
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, text);
return false;
}
}
action?.Invoke(base.notyKey, DisplyType.xinxi, "请求错误");
return false;
}
public bool addFamilyMember(AppleiCloundLogin cloundLogin, string appleId, string password, string verificationToken)
{
string url = "https://setup.icloud.com/setup/mac/family/addFamilyMember";
string referer = "https://setup.icloud.com/setup/mac/family/setupFamilyUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
string postData = Tools.Toenjson(new AddFamilyMemberPostModel
{
appleId = appleId,
password = password,
appleIdForPurchases = appleId,
shareMyLocationEnabledDefault = true,
shareMyPurchasesEnabledDefault = true,
verificationToken = verificationToken,
preferredAppleId = appleId
});
action?.Invoke(base.notyKey, DisplyType.xinxi, " 正在添加成员.");
HttpResult httpResult = postJsoniCloudWebContext(url, postData, referer, cloundLogin, dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if ((int)val["status"] == 0)
{
object[] obj = val["familyMembers"];
string text = "";
object[] array = obj;
foreach (dynamic val2 in array)
{
if (((string)val2["appleId"]).ToLower() == appleId.ToLower())
{
text = val2["dsid"];
break;
}
}
action?.Invoke(base.notyKey, DisplyType.forbidden, "成功");
action?.Invoke(base.notyKey, DisplyType.xinxi, "添加成功,成员dsid" + text);
return true;
}
string text2 = Tools.Unicode2String(AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\""));
action?.Invoke(base.notyKey, DisplyType.error, "失败");
action?.Invoke(base.notyKey, DisplyType.xinxi, "失败:" + text2);
if (text2.Contains("有效的付款方式"))
{
iCloudAccountLoginCache.removeReddemUserInfo(cloundLogin.account, cloundLogin.StdndbyKeyGuid);
}
return false;
}
if (httpResult.StatusCode == (HttpStatusCode)422)
{
string text3 = Tools.Unicode2String(AppleNetworkBase.GetToken(httpResult.Html, "status-message\":\"", "\""));
action?.Invoke(base.notyKey, DisplyType.xinxi, text3);
action?.Invoke(base.notyKey, DisplyType.error, "失败");
if (text3.Contains("有效的付款方式"))
{
iCloudAccountLoginCache.removeReddemUserInfo(cloundLogin.account, cloundLogin.StdndbyKeyGuid);
}
return false;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, " 添加失败,未知错误");
return false;
}
public iCloudVerifyCVVModel getiTunesAccountPaymentInfo(AppleiCloundLogin cloundLogin)
{
string url = "https://setup.icloud.com/setup/mac/family/getiTunesAccountPaymentInfo";
string referer = "https://setup.icloud.com/setup/mac/family/addFamilyMemberUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
string postData = Tools.Toenjson(new getiTunesAccountPaymentInfoPostModel
{
organizerDSID = cloundLogin.dsid,
userAction = "ADDING_FAMILY_MEMBER",
sendSMS = true
});
action?.Invoke(base.notyKey, DisplyType.xinxi, " 查询付款信息..");
HttpResult httpResult = postJsoniCloudWebContext(url, postData, referer, cloundLogin, dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
dynamic val = Tools.Todejosn<object>(httpResult.Html);
if ((int)val["status"] == 0)
{
string text = val["creditCardType"];
if (text == "无")
{
action?.Invoke(base.notyKey, DisplyType.xinxi, "账号没有支付方式");
return null;
}
string creditCardLastFourDigits = val["creditCardLastFourDigits"];
string verificationType = val["verificationType"];
string billingType = val["billingType"];
return new iCloudVerifyCVVModel
{
billingType = billingType,
creditCardId = text,
creditCardLastFourDigits = creditCardLastFourDigits,
verificationType = verificationType
};
}
string token = AppleNetworkBase.GetToken(httpResult.Html, "title\":\"", "\"");
action?.Invoke(base.notyKey, DisplyType.xinxi, token);
return null;
}
if (httpResult.StatusCode == (HttpStatusCode)422)
{
string arg = Tools.Unicode2String(AppleNetworkBase.GetToken(httpResult.Html, "title\":\"", "\""));
action?.Invoke(base.notyKey, DisplyType.xinxi, arg);
return null;
}
action?.Invoke(base.notyKey, DisplyType.xinxi, " 付款信息查询失败,未知错误");
return null;
}
public string verifyCVV(AppleiCloundLogin cloundLogin, iCloudVerifyCVVModel cVVModel)
{
string url = "https://setup.icloud.com/setup/mac/family/verifyCVV";
string referer = "https://setup.icloud.com/setup/mac/family/setupFamilyUI";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("X-MMe-LoggedIn-AppleID", cloundLogin.account);
string postData = Tools.Toenjson(cVVModel);
action?.Invoke(base.notyKey, DisplyType.xinxi, " 验证安全码..");
HttpResult httpResult = postJsoniCloudWebContext(url, postData, referer, cloundLogin, dictionary);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
string token = AppleNetworkBase.GetToken(httpResult.Html, "verificationToken\":\"", "\"");
if (string.IsNullOrEmpty(token))
{
Action<string, DisplyType, string> obj = action;
if (obj == null)
{
return token;
}
obj(base.notyKey, DisplyType.xinxi, "验证付款方式失败");
}
return token;
}
if (httpResult.StatusCode == (HttpStatusCode)422)
{
string arg = Tools.Unicode2String(AppleNetworkBase.GetToken(httpResult.Html, "title\":\"", "\""));
action?.Invoke(base.notyKey, DisplyType.xinxi, arg);
}
return "";
}
private string createAppleIdTermsPlist(string appleId, string applePwd)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n");
stringBuilder.Append("\t\t<key>apple-id</key>\n\t\t<string>" + appleId + "</string>\n");
stringBuilder.Append("\t\t<key>password</key>\n\t\t<string>" + applePwd + "</string>\n");
stringBuilder.Append("</dict>\n</plist>");
return stringBuilder.ToString();
}
private string createSmsAccountRepair(string securityCode, string session)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n");
stringBuilder.Append("\t\t<key>security-code</key>\n\t\t<string>" + securityCode + "</string>\n");
stringBuilder.Append("\t<key>serverInfo</key>\n\t<dict>\n\t\t<key>session</key>\n\t\t<string>" + session + "</string>\n\t</dict>\n");
stringBuilder.Append("</dict>\n</plist>");
return stringBuilder.ToString();
}
private string createActionPlist(string appleId, string applePwd, string newClientid)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n");
stringBuilder.Append("\t<key>protocolVersion</key>\n\t<string>1.0</string>\n");
stringBuilder.Append("\t<key>userInfo</key>\n\t<dict>\n\t\t<key>client-id</key>\n\t\t<string>" + newClientid + "</string>\n\t\t<key>language</key>\n\t\t<string>zh-Hans</string>\n\t\t<key>timezone</key>\n\t\t<string>Asia/Chongqing</string>\n\t</dict>\n");
stringBuilder.Append("</dict>\n</plist>");
return stringBuilder.ToString();
}
private string createLoginPlist(string appleId, string applePwd)
{
string text = "348F2E20-CED5-41EA-BE2E-F589028EA985";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n\t<dict>\n");
stringBuilder.Append("\t\t<key>apple-id</key>\n\t\t<string>" + appleId + "</string>\n");
stringBuilder.Append("\t\t<key>client-id</key>\n\t\t<string>" + text + "</string>\n");
stringBuilder.Append("\t\t<key>delegates</key>\n\t\t<dict><key>com.apple.gamecenter</key>\n<dict/>\n<key>com.apple.mobileme</key>\n<dict/>\n<key>com.apple.private.ids</key>\n<dict>\n<key>protocol-version</key>\n<string>4</string>\n</dict> </dict>\n");
stringBuilder.Append("\t\t<key>password</key>\n\t\t<string>" + applePwd + "</string>\n");
stringBuilder.Append("\t</dict>\n</plist>");
return stringBuilder.ToString();
}
public HttpResult getJsoniCloudWebContext(string url, string referer, AppleiCloundLogin cloundLogin, Dictionary<string, string> hander)
{
if (cloundLogin == null)
{
throw new Exception("没有登录状态");
}
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "get",
Timeout = 30000,
ReadWriteTimeout = 30000,
UserAgent = cloundLogin.userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/json; charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
hander.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(cloundLogin.dsid + ":" + cloundLogin.mmeAuthToken)));
hander.Add("X-Mme-Client-Info", cloundLogin.clientInfo);
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(httpReuslt.Cookie);
return httpReuslt;
}
public HttpResult postiCloudWebContext(string url, string postData, string referer, string userAgent, Dictionary<string, string> hander)
{
HttpItem httpItem = new HttpItem
{
URL = url,
Method = "post",
Timeout = 30000,
ReadWriteTimeout = 30000,
UserAgent = userAgent,
Cookie = listCookie.toFonmtCookie(),
ContentType = "application/x-apple-plist; Charset=UTF-8",
Accept = "*/*",
Referer = referer,
ProtocolVersion = HttpVersion.Version11,
KeepAlive = true,
Postdata = postData,
PostDataType = PostDataType.String,
ResultType = ResultType.String,
WebProxy = WebRequest.DefaultWebProxy
};
if (hander != null)
{
foreach (KeyValuePair<string, string> item in hander)
{
httpItem.Header.Add(item.Key, item.Value);
}
}
addHander(httpItem);
HttpResult httpReuslt = GetHttpReuslt(httpItem);
addCookle(httpReuslt.Cookie);
return httpReuslt;
}
protected void addCookle(string cookies)
{
if (cookies == null || string.IsNullOrEmpty(cookies.Trim()))
{
return;
}
foreach (CookieItem item in HttpCookieHelper.GetCookieList(cookies))
{
if (item.Key == "Max-Age" || item.Key == "Path" || item.Key == "Expires" || item.Key == "domain" || item.Key == "Domain" || item.Key == "path")
{
continue;
}
CookieItem cookieItem = listCookie.Where((CookieItem c) => c.Key == item.Key).FirstOrDefault();
if (cookieItem == null)
{
if (!string.IsNullOrEmpty(item.Value.Trim()))
{
listCookie.Add(item);
}
}
else if (!string.IsNullOrEmpty(item.Value.Trim()))
{
cookieItem.Value = item.Value.Trim();
}
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,584 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FormAuthBalance : BaseForm
{
private IContainer components;
private GroupBox groupBox71;
private CheckBox ckAuthBalenceVpn;
private Label labAuthBalenceCount;
private Label label108;
private Label label109;
private GroupBox groupBox69;
private DoubleBufferListView lvAuthBalence;
private ColumnHeader columnHeader127;
private ColumnHeader columnHeader129;
private ColumnHeader columnHeader130;
private ColumnHeader columnHeader131;
private ColumnHeader columnHeader132;
private ColumnHeader columnHeader133;
private ColumnHeader columnHeader136;
private ColumnHeader columnHeader134;
private ColumnHeader columnHeader135;
private GroupBox groupBox70;
private Label label106;
private Label label107;
private TextBox textBox15;
private GroupBox groupBox72;
private Label labAuthBalanceLvCount;
private Label label111;
private Button btnAuthBalanceClear;
private Button btnAuthBalanceLog;
private Button btnAuthBalenceInput;
private Button btnAuthBalanceExprt;
private Button btnAuthBalanceStart;
public FormAuthBalance()
: base("密保查询余额", QueryAuthBalanceTask.Instance)
{
InitializeComponent();
}
private void btnAuthBalenceInput_Click(object sender, EventArgs e)
{
FromInputAcount fromInputAcount = new FromInputAcount();
fromInputAcount.tipMssage = textBox15.Text;
fromInputAcount.isOpenSysVpn = ckAuthBalenceVpn.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> list = AppleUtlis.accountInput(fromInputAcount.StrInput, new string[5] { "appleId", "appleQt1", "appleQt2", "appleQt3", "applePwd" });
lvAuthBalence.ListViewItemSorter = new ListViewItemComparer(0, 1);
lvAuthBalence.Sort();
int num = 0;
if (lvAuthBalence.Items.Count > 0 && int.TryParse(lvAuthBalence.Items[lvAuthBalence.Items.Count - 1].SubItems[0].Text, out var result))
{
num = result;
}
List<ListViewItem> list2 = new List<ListViewItem>();
foreach (AppleAcount item in list)
{
if (!string.IsNullOrEmpty(item.appleQt1) && !string.IsNullOrEmpty(item.appleQt2) && !string.IsNullOrEmpty(item.appleQt3))
{
num++;
ListViewItem listViewItem = new ListViewItem(num.ToString());
listViewItem.SubItems.Add(item.appleId);
listViewItem.SubItems.Add(item.applePwd);
listViewItem.SubItems.Add(string.IsNullOrEmpty(item.appleQt1) ? "-" : item.appleQt1);
listViewItem.SubItems.Add(string.IsNullOrEmpty(item.appleQt2) ? "-" : item.appleQt2);
listViewItem.SubItems.Add(string.IsNullOrEmpty(item.appleQt3) ? "-" : item.appleQt3);
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
listViewItem.UseItemStyleForSubItems = false;
listViewItem.Tag = item.lvItemGuid;
list2.Add(listViewItem);
}
}
lvAuthBalence.Items.AddRange(list2.ToArray());
}
labAuthBalanceLvCount.Text = string.Concat(lvAuthBalence.Items.Count);
}
private void btnAuthBalanceLog_Click(object sender, EventArgs e)
{
FromDBDataQuery fromDBDataQuery = new FromDBDataQuery();
fromDBDataQuery.sqlTitle = new Dictionary<string, string>
{
{ "value1", "账号|120" },
{ "value2", "密码|100" },
{ "value3", "问题1|60" },
{ "value4", "问题2|60" },
{ "value5", "问题3|60" },
{ "value6", "国家|80" },
{ "value7", "余额|100" },
{ "value8", "信息|150" }
};
fromDBDataQuery.type = "authBalance";
fromDBDataQuery.typeName = "Apple密保查余额记录";
fromDBDataQuery.Show();
}
private void btnAuthBalanceExprt_Click(object sender, EventArgs e)
{
ExperList(lvAuthBalence);
}
private void btnAuthBalanceClear_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
lvAuthBalence.Items.Clear();
}
labAuthBalanceLvCount.Text = string.Concat(lvAuthBalence.Items.Count);
}
private void FormAuthBalance_Load(object sender, EventArgs e)
{
labAuthBalenceCount.Text = AppSysConfig.getTypeById(22).consNum.ToString();
ckAuthBalenceVpn.Checked = ((ConfigUtlis.getConfigValue("ckAuthBalenceVpn") == "True") ? true : false);
base.startBtn = btnAuthBalanceStart;
base.labCout = labAuthBalanceLvCount;
base.listData = lvAuthBalence;
InitLv(lvAuthBalence);
BindMenuStrip(addTwoFactor: false, null, shouItems: true);
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (QueryAuthBalanceTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in lvAuthBalence.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text,
appleQt1 = selectedItem.SubItems[3].Text,
appleQt2 = selectedItem.SubItems[4].Text,
appleQt3 = selectedItem.SubItems[5].Text,
guidTag = (selectedItem.Tag as string)
});
}
TaskRunAuthBalanceQuery(list);
}
private void btnAuthBalanceStart_Click(object sender, EventArgs e)
{
if (!QueryAuthBalanceTask.Instance.isRun && !QueryAuthBalanceTask.Instance.TaskIsRun)
{
List<AppleAcount> apples = (from ListViewItem c in lvAuthBalence.Items
where c.SubItems[7].Text == "-"
select new AppleAcount
{
appleId = c.SubItems[1].Text,
applePwd = c.SubItems[2].Text,
appleQt1 = c.SubItems[3].Text,
appleQt2 = c.SubItems[4].Text,
appleQt3 = c.SubItems[5].Text,
guidTag = (c.Tag as string)
}).ToList();
TaskRunAuthBalanceQuery(apples);
return;
}
QueryAuthBalanceTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
btnAuthBalanceStart.Text = "正在停止";
btnAuthBalanceStart.ForeColor = Color.Red;
});
}
}
public void TaskRunAuthBalanceQuery(List<AppleAcount> apples)
{
int id = 22;
int count = apples.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(22).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
return;
}
ConfigUtlis.saveConfigKey("ckAuthBalenceVpn", ckAuthBalenceVpn.Checked.ToString());
QueryAuthBalanceTask.Instance.AppleQueryAuthBalanceTask(2, ckAuthBalenceVpn.Checked, apples, delegate
{
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
btnAuthBalanceStart.Enabled = true;
btnAuthBalanceStart.Text = "停止";
btnAuthBalanceStart.ForeColor = Color.Red;
});
}
}, delegate
{
Dictionary<string, object> postData = new Dictionary<string, object>
{
{
"token",
AppSysConfig.userToken
},
{ "type", 2 }
};
new ApiNetReq().doPost(postData, "ApiProxyIp");
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
btnAuthBalanceStart.Text = "开始执行";
btnAuthBalanceStart.ForeColor = Color.Green;
});
}
}, delegate(string guidTag)
{
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
ListViewItem listViewItem = (from ListViewItem c in lvAuthBalence.Items
where c.Tag.ToString() == guidTag
select c).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "authBalance" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{
"value1",
listViewItem.SubItems[1].Text
},
{
"value2",
listViewItem.SubItems[2].Text
},
{
"value3",
listViewItem.SubItems[3].Text
},
{
"value4",
listViewItem.SubItems[4].Text
},
{
"value5",
listViewItem.SubItems[5].Text
},
{
"value6",
listViewItem.SubItems[6].Text
},
{
"value7",
listViewItem.SubItems[7].Text
},
{
"value8",
listViewItem.SubItems[8].Text
}
});
}
});
}
}, delegate(string guidTag, DisplyType ditype, string distReust)
{
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
IEnumerable<ListViewItem> enumerable = from ListViewItem c in lvAuthBalence.Items
where c.Tag.ToString() == guidTag
select c;
new Font(Font, FontStyle.Bold);
foreach (ListViewItem item in enumerable)
{
switch (ditype)
{
case DisplyType.area:
item.SubItems[6].Text = distReust;
break;
case DisplyType.xinxi:
item.SubItems[8].Text = distReust;
break;
case DisplyType.balance:
item.SubItems[7].Text = distReust;
break;
case DisplyType.chongzhi:
item.SubItems[7].Text = distReust;
item.SubItems[6].Text = distReust;
break;
}
}
});
}
});
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.groupBox71 = new System.Windows.Forms.GroupBox();
this.ckAuthBalenceVpn = new System.Windows.Forms.CheckBox();
this.labAuthBalenceCount = new System.Windows.Forms.Label();
this.label108 = new System.Windows.Forms.Label();
this.label109 = new System.Windows.Forms.Label();
this.groupBox69 = new System.Windows.Forms.GroupBox();
this.lvAuthBalence = new AppleBatch_June.Views.DoubleBufferListView();
this.columnHeader127 = new System.Windows.Forms.ColumnHeader();
this.columnHeader129 = new System.Windows.Forms.ColumnHeader();
this.columnHeader130 = new System.Windows.Forms.ColumnHeader();
this.columnHeader131 = new System.Windows.Forms.ColumnHeader();
this.columnHeader132 = new System.Windows.Forms.ColumnHeader();
this.columnHeader133 = new System.Windows.Forms.ColumnHeader();
this.columnHeader136 = new System.Windows.Forms.ColumnHeader();
this.columnHeader134 = new System.Windows.Forms.ColumnHeader();
this.columnHeader135 = new System.Windows.Forms.ColumnHeader();
this.groupBox70 = new System.Windows.Forms.GroupBox();
this.label106 = new System.Windows.Forms.Label();
this.label107 = new System.Windows.Forms.Label();
this.textBox15 = new System.Windows.Forms.TextBox();
this.groupBox72 = new System.Windows.Forms.GroupBox();
this.labAuthBalanceLvCount = new System.Windows.Forms.Label();
this.label111 = new System.Windows.Forms.Label();
this.btnAuthBalanceClear = new System.Windows.Forms.Button();
this.btnAuthBalanceLog = new System.Windows.Forms.Button();
this.btnAuthBalenceInput = new System.Windows.Forms.Button();
this.btnAuthBalanceExprt = new System.Windows.Forms.Button();
this.btnAuthBalanceStart = new System.Windows.Forms.Button();
this.groupBox71.SuspendLayout();
this.groupBox69.SuspendLayout();
this.groupBox70.SuspendLayout();
this.groupBox72.SuspendLayout();
base.SuspendLayout();
this.groupBox71.Controls.Add(this.ckAuthBalenceVpn);
this.groupBox71.Controls.Add(this.labAuthBalenceCount);
this.groupBox71.Controls.Add(this.label108);
this.groupBox71.Controls.Add(this.label109);
this.groupBox71.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox71.Location = new System.Drawing.Point(427, 18);
this.groupBox71.Name = "groupBox71";
this.groupBox71.Size = new System.Drawing.Size(275, 124);
this.groupBox71.TabIndex = 23;
this.groupBox71.TabStop = false;
this.groupBox71.Text = "功能说明";
this.ckAuthBalenceVpn.AutoSize = true;
this.ckAuthBalenceVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckAuthBalenceVpn.ForeColor = System.Drawing.Color.Red;
this.ckAuthBalenceVpn.Location = new System.Drawing.Point(18, 84);
this.ckAuthBalenceVpn.Name = "ckAuthBalenceVpn";
this.ckAuthBalenceVpn.Size = new System.Drawing.Size(111, 21);
this.ckAuthBalenceVpn.TabIndex = 10;
this.ckAuthBalenceVpn.Text = "使用随机IP代理";
this.ckAuthBalenceVpn.UseVisualStyleBackColor = true;
this.labAuthBalenceCount.AutoSize = true;
this.labAuthBalenceCount.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labAuthBalenceCount.ForeColor = System.Drawing.Color.Crimson;
this.labAuthBalenceCount.Location = new System.Drawing.Point(103, 52);
this.labAuthBalenceCount.Name = "labAuthBalenceCount";
this.labAuthBalenceCount.Size = new System.Drawing.Size(18, 19);
this.labAuthBalenceCount.TabIndex = 2;
this.labAuthBalenceCount.Text = "0";
this.label108.AutoSize = true;
this.label108.Location = new System.Drawing.Point(15, 54);
this.label108.Name = "label108";
this.label108.Size = new System.Drawing.Size(92, 17);
this.label108.TabIndex = 1;
this.label108.Text = "查询消耗点数:";
this.label109.AutoSize = true;
this.label109.Location = new System.Drawing.Point(15, 25);
this.label109.Name = "label109";
this.label109.Size = new System.Drawing.Size(168, 17);
this.label109.TabIndex = 0;
this.label109.Text = "可查询双禁,锁定 账号的余额";
this.groupBox69.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
this.groupBox69.Controls.Add(this.lvAuthBalence);
this.groupBox69.Location = new System.Drawing.Point(15, 161);
this.groupBox69.Name = "groupBox69";
this.groupBox69.Size = new System.Drawing.Size(1031, 428);
this.groupBox69.TabIndex = 22;
this.groupBox69.TabStop = false;
this.groupBox69.Text = "Apple账号列表";
this.lvAuthBalence.Columns.AddRange(new System.Windows.Forms.ColumnHeader[9] { this.columnHeader127, this.columnHeader129, this.columnHeader130, this.columnHeader131, this.columnHeader132, this.columnHeader133, this.columnHeader136, this.columnHeader134, this.columnHeader135 });
this.lvAuthBalence.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvAuthBalence.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.lvAuthBalence.FullRowSelect = true;
this.lvAuthBalence.HideSelection = false;
this.lvAuthBalence.Location = new System.Drawing.Point(3, 17);
this.lvAuthBalence.Name = "lvAuthBalence";
this.lvAuthBalence.Size = new System.Drawing.Size(1025, 408);
this.lvAuthBalence.TabIndex = 0;
this.lvAuthBalence.UseCompatibleStateImageBehavior = false;
this.lvAuthBalence.View = System.Windows.Forms.View.Details;
this.columnHeader127.Text = "序号";
this.columnHeader129.Text = "账号";
this.columnHeader129.Width = 200;
this.columnHeader130.Text = "密码";
this.columnHeader130.Width = 150;
this.columnHeader131.Text = "问题1";
this.columnHeader131.Width = 70;
this.columnHeader132.Text = "问题2";
this.columnHeader132.Width = 80;
this.columnHeader133.Text = "问题3";
this.columnHeader133.Width = 80;
this.columnHeader136.Text = "国家";
this.columnHeader136.Width = 80;
this.columnHeader134.Text = "余额";
this.columnHeader134.Width = 100;
this.columnHeader135.Text = "信息";
this.columnHeader135.Width = 200;
this.groupBox70.Controls.Add(this.label106);
this.groupBox70.Controls.Add(this.label107);
this.groupBox70.Controls.Add(this.textBox15);
this.groupBox70.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox70.Location = new System.Drawing.Point(708, 18);
this.groupBox70.Name = "groupBox70";
this.groupBox70.Size = new System.Drawing.Size(338, 130);
this.groupBox70.TabIndex = 21;
this.groupBox70.TabStop = false;
this.groupBox70.Text = "操作说明";
this.label106.AutoSize = true;
this.label106.Location = new System.Drawing.Point(8, 80);
this.label106.Name = "label106";
this.label106.Size = new System.Drawing.Size(259, 17);
this.label106.TabIndex = 8;
this.label106.Text = "如遇多次失败一般是IP被封请开启随机代理";
this.label107.AutoSize = true;
this.label107.Location = new System.Drawing.Point(6, 25);
this.label107.Name = "label107";
this.label107.Size = new System.Drawing.Size(80, 17);
this.label107.TabIndex = 7;
this.label107.Text = "账号导入格式";
this.textBox15.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox15.Location = new System.Drawing.Point(12, 48);
this.textBox15.Name = "textBox15";
this.textBox15.ReadOnly = true;
this.textBox15.Size = new System.Drawing.Size(302, 23);
this.textBox15.TabIndex = 6;
this.textBox15.Text = "xxx@xx.com----密码-答案1-答案2-答案3";
this.groupBox72.Controls.Add(this.labAuthBalanceLvCount);
this.groupBox72.Controls.Add(this.label111);
this.groupBox72.Controls.Add(this.btnAuthBalanceClear);
this.groupBox72.Controls.Add(this.btnAuthBalanceLog);
this.groupBox72.Controls.Add(this.btnAuthBalenceInput);
this.groupBox72.Controls.Add(this.btnAuthBalanceExprt);
this.groupBox72.Controls.Add(this.btnAuthBalanceStart);
this.groupBox72.Location = new System.Drawing.Point(15, 18);
this.groupBox72.Name = "groupBox72";
this.groupBox72.Size = new System.Drawing.Size(406, 130);
this.groupBox72.TabIndex = 20;
this.groupBox72.TabStop = false;
this.groupBox72.Text = "操作";
this.labAuthBalanceLvCount.AutoSize = true;
this.labAuthBalanceLvCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labAuthBalanceLvCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labAuthBalanceLvCount.Location = new System.Drawing.Point(255, 15);
this.labAuthBalanceLvCount.Name = "labAuthBalanceLvCount";
this.labAuthBalanceLvCount.Size = new System.Drawing.Size(15, 17);
this.labAuthBalanceLvCount.TabIndex = 7;
this.labAuthBalanceLvCount.Text = "0";
this.label111.AutoSize = true;
this.label111.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label111.Location = new System.Drawing.Point(152, 16);
this.label111.Name = "label111";
this.label111.Size = new System.Drawing.Size(95, 17);
this.label111.TabIndex = 6;
this.label111.Text = "列表中账号数量:";
this.btnAuthBalanceClear.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAuthBalanceClear.Location = new System.Drawing.Point(298, 75);
this.btnAuthBalanceClear.Name = "btnAuthBalanceClear";
this.btnAuthBalanceClear.Size = new System.Drawing.Size(96, 23);
this.btnAuthBalanceClear.TabIndex = 5;
this.btnAuthBalanceClear.Text = "清空账号列表";
this.btnAuthBalanceClear.UseVisualStyleBackColor = true;
this.btnAuthBalanceClear.Click += new System.EventHandler(btnAuthBalanceClear_Click);
this.btnAuthBalanceLog.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAuthBalanceLog.Location = new System.Drawing.Point(152, 42);
this.btnAuthBalanceLog.Name = "btnAuthBalanceLog";
this.btnAuthBalanceLog.Size = new System.Drawing.Size(140, 23);
this.btnAuthBalanceLog.TabIndex = 4;
this.btnAuthBalanceLog.Text = "余额查询记录";
this.btnAuthBalanceLog.UseVisualStyleBackColor = true;
this.btnAuthBalanceLog.Click += new System.EventHandler(btnAuthBalanceLog_Click);
this.btnAuthBalenceInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAuthBalenceInput.Location = new System.Drawing.Point(152, 76);
this.btnAuthBalenceInput.Name = "btnAuthBalenceInput";
this.btnAuthBalenceInput.Size = new System.Drawing.Size(140, 23);
this.btnAuthBalenceInput.TabIndex = 3;
this.btnAuthBalenceInput.Text = "账号输入";
this.btnAuthBalenceInput.UseVisualStyleBackColor = true;
this.btnAuthBalenceInput.Click += new System.EventHandler(btnAuthBalenceInput_Click);
this.btnAuthBalanceExprt.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAuthBalanceExprt.Location = new System.Drawing.Point(298, 42);
this.btnAuthBalanceExprt.Name = "btnAuthBalanceExprt";
this.btnAuthBalanceExprt.Size = new System.Drawing.Size(96, 23);
this.btnAuthBalanceExprt.TabIndex = 2;
this.btnAuthBalanceExprt.Text = "导出账号";
this.btnAuthBalanceExprt.UseVisualStyleBackColor = true;
this.btnAuthBalanceExprt.Click += new System.EventHandler(btnAuthBalanceExprt_Click);
this.btnAuthBalanceStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnAuthBalanceStart.ForeColor = System.Drawing.Color.Green;
this.btnAuthBalanceStart.Location = new System.Drawing.Point(18, 33);
this.btnAuthBalanceStart.Name = "btnAuthBalanceStart";
this.btnAuthBalanceStart.Size = new System.Drawing.Size(110, 65);
this.btnAuthBalanceStart.TabIndex = 1;
this.btnAuthBalanceStart.Text = "开始执行";
this.btnAuthBalanceStart.UseVisualStyleBackColor = true;
this.btnAuthBalanceStart.Click += new System.EventHandler(btnAuthBalanceStart_Click);
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(1058, 603);
base.Controls.Add(this.groupBox71);
base.Controls.Add(this.groupBox69);
base.Controls.Add(this.groupBox70);
base.Controls.Add(this.groupBox72);
base.MaximizeBox = false;
base.Name = "FormAuthBalance";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Apple 密保查余额";
base.Load += new System.EventHandler(FormAuthBalance_Load);
this.groupBox71.ResumeLayout(false);
this.groupBox71.PerformLayout();
this.groupBox69.ResumeLayout(false);
this.groupBox70.ResumeLayout(false);
this.groupBox70.PerformLayout();
this.groupBox72.ResumeLayout(false);
this.groupBox72.PerformLayout();
base.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AppleBatch_June.Forms
{
public class FormEditListViewHander : Form
{
private IContainer components;
private LinkLabel linkLabel1;
public bool isAstrict { get; set; } = true;
public ListView lvData { get; set; }
public FormEditListViewHander()
{
InitializeComponent();
}
private void FormEditListViewHander_Load(object sender, EventArgs e)
{
if (lvData != null)
{
initHander(lvData);
}
}
public void initHander(ListView lvData)
{
int num = 20;
int num2 = 20;
int num3 = 0;
foreach (ColumnHeader column in lvData.Columns)
{
_ = column.Text;
addCkeckBox(num, num2, column);
num += 100;
num3++;
if (num3 == 5)
{
num = 20;
num2 += 40;
num3 = 0;
}
}
}
private void addCkeckBox(int pi, int y, ColumnHeader item)
{
string text = item.Text;
bool @checked = false;
if (item.Width > 0)
{
@checked = true;
}
CheckBox checkBox = new CheckBox();
checkBox.AutoSize = true;
checkBox.Font = new Font("微软雅黑", 10f, FontStyle.Regular, GraphicsUnit.Point, 134);
if (isAstrict && (text.Contains("序号") || text == "信息" || text.Contains("返回信息")))
{
checkBox.Enabled = false;
}
checkBox.Location = new Point(pi, y);
checkBox.Size = new Size(70, 24);
checkBox.TabIndex = 0;
checkBox.Checked = @checked;
checkBox.Text = text;
checkBox.Tag = item;
checkBox.UseVisualStyleBackColor = true;
checkBox.CheckedChanged += radioButton1_CheckedChanged;
base.Controls.Add(checkBox);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (!(sender is CheckBox))
{
return;
}
CheckBox checkBox = sender as CheckBox;
if (checkBox.Tag is ColumnHeader columnHeader)
{
int result;
if (!checkBox.Checked)
{
columnHeader.Tag = columnHeader.Width;
columnHeader.Width = 0;
}
else if (columnHeader.Tag != null && int.TryParse(columnHeader.Tag.ToString(), out result))
{
columnHeader.Width = result;
}
else
{
columnHeader.Width = 100;
}
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
foreach (object control in base.Controls)
{
if (control is CheckBox && control is CheckBox)
{
(control as CheckBox).Checked = true;
}
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
base.SuspendLayout();
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(520, 117);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(53, 12);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "全部显示";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(linkLabel1_LinkClicked);
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(585, 138);
base.Controls.Add(this.linkLabel1);
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "FormEditListViewHander";
base.ShowIcon = false;
base.ShowInTaskbar = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "编辑显示列";
base.Load += new System.EventHandler(FormEditListViewHander_Load);
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,585 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FromAddRemoveFamilyMember : BaseForm
{
private IContainer components;
private GroupBox groupBox9;
private TextBox textBox2;
private CheckBox ckAddRemoveFamilyMember;
private Label labAddRemoveFamilyMemberInter;
private Label label10;
private Label label13;
private GroupBox groupBox10;
private Label labAddRemoveFamilyMemberCount;
private Label label16;
private Button btnAddRemoveFamilyMemberClre;
private Button btnAddRemoveFamilyMemberLog;
private Button btnAddRemoveFamilyMembernput;
private Button btnAddRemoveFamilyMemberExper;
private Button btnAddRemoveFamilyMemberStart;
private GroupBox groupBox12;
private DoubleBufferListView listAddRemoveFamilyMember;
private ColumnHeader columnHeader8;
private ColumnHeader columnHeader9;
private ColumnHeader columnHeader10;
private ColumnHeader columnHeader3;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader14;
private Label label2;
private TextBox textBox1;
private Label label1;
private ColumnHeader columnHeader4;
private ColumnHeader columnHeader2;
public FromAddRemoveFamilyMember()
: base("添加或移除家庭成员", AddRemoveFamilyMemberTask.Instance)
{
InitializeComponent();
}
private void FromAddRemoveFamilyMember_Load(object sender, EventArgs e)
{
base.listData = listAddRemoveFamilyMember;
base.labCout = labAddRemoveFamilyMemberCount;
base.startBtn = btnAddRemoveFamilyMemberStart;
labAddRemoveFamilyMemberInter.Text = AppSysConfig.getTypeById(31).consNum.ToString();
ckAddRemoveFamilyMember.Checked = ((ConfigUtlis.getConfigValue("ckAddRemoveFamilyMember") == "True") ? true : false);
InitLv(base.listData);
BindMenuStrip(addTwoFactor: true);
}
private void btnAddRemoveFamilyMembernput_Click(object sender, EventArgs e)
{
FromInputAcount fromInputAcount = new FromInputAcount();
fromInputAcount.tipMssage = textBox2.Text;
fromInputAcount.isOpenSysVpn = ckAddRemoveFamilyMember.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> list = AppleUtlis.accountInput(fromInputAcount.StrInput, null, removePwd: false, isdeWeight: false);
int num = 0;
base.listData.ListViewItemSorter = new ListViewItemComparer(0, 1);
base.listData.Sort();
if (base.listData.Items.Count > 0 && int.TryParse(base.listData.Items[base.listData.Items.Count - 1].SubItems[0].Text, out var result))
{
num = result;
}
foreach (AppleAcount item in list)
{
num++;
ListViewItem listViewItem = new ListViewItem(num.ToString());
listViewItem.Tag = item.lvItemGuid;
listViewItem.UseItemStyleForSubItems = false;
listViewItem.SubItems.Add(item.appleId);
listViewItem.SubItems.Add(item.applePwd);
if (!string.IsNullOrEmpty(item.appleQt1))
{
if (!string.IsNullOrEmpty(item.overflow))
{
try
{
string obj = item.sourceInputData.Substring(item.sourceInputData.IndexOf(item.appleId) + item.appleId.Length).TrimStart('-');
List<AppleAcount> list2 = AppleUtlis.accountInput(obj.Substring(obj.IndexOf(item.applePwd) + item.applePwd.Length).TrimStart('-'));
if (list2.Count == 1)
{
listViewItem.SubItems.Add(list2[0].appleId.Trim());
listViewItem.SubItems.Add(list2[0].applePwd.Trim());
listViewItem.SubItems.Add(list2[0].overflow);
goto IL_0296;
}
}
catch (Exception)
{
}
continue;
}
listViewItem.SubItems.Add(item.appleQt1);
listViewItem.SubItems.Add(item.appleQt2);
listViewItem.SubItems.Add(item.appleQt3);
}
else
{
listViewItem.SubItems.Add(item.overflow);
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("del");
}
goto IL_0296;
IL_0296:
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
base.listData.Items.Add(listViewItem);
}
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnAddRemoveFamilyMemberStart_Click(object sender, EventArgs e)
{
if (!AddRemoveFamilyMemberTask.Instance.isRun && !AddRemoveFamilyMemberTask.Instance.TaskIsRun)
{
List<AppleAcount> lvItems = (from ListViewItem c in base.listData.Items
where c.SubItems[6].Text == "-"
select new AppleAcount
{
lvItemGuid = c.Tag.ToString(),
appleId = c.SubItems[1].Text,
applePwd = c.SubItems[2].Text,
newAppleId = c.SubItems[3].Text,
newApplePopPwd = c.SubItems[4].Text,
overflow = c.SubItems[5].Text
}).ToList();
RearTaskRun(lvItems);
return;
}
AddRemoveFamilyMemberTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
base.startBtn.Text = "正在停止";
base.startBtn.ForeColor = Color.Red;
});
}
}
private void RearTaskRun(List<AppleAcount> lvItems)
{
int id = 31;
int count = lvItems.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(31).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
}
else
{
ConfigUtlis.saveConfigKey("ckAddRemoveFamilyMember", ckAddRemoveFamilyMember.Checked.ToString());
AddRemoveFamilyMemberTask.Instance.ExecuteAddRemoveFamilyMember(2, ckAddRemoveFamilyMember.Checked, lvItems, base.startAct, base.endTakAct, sucessAct, _action);
}
}
public void sucessAct(string lvItemGuid)
{
UpdataUi(delegate
{
ListViewItem listViewItem = (from ListViewItem c in base.listData.Items
where c.Tag.ToString() == lvItemGuid
select c).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "addRemoveFamily" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{
"value1",
listViewItem.SubItems[1].Text
},
{
"value2",
listViewItem.SubItems[2].Text
},
{
"value3",
listViewItem.SubItems[3].Text
},
{
"value4",
listViewItem.SubItems[4].Text
},
{
"value5",
listViewItem.SubItems[5].Text
},
{
"value6",
listViewItem.SubItems[6].Text
},
{
"value7",
listViewItem.SubItems[7].Text
}
});
}
});
}
public void _action(string lvItemGuid, DisplyType type, string reust)
{
UpdataUi(delegate
{
IEnumerable<ListViewItem> enumerable = from ListViewItem c in base.listData.Items
where c.Tag.ToString() == lvItemGuid
select c;
Font font = new Font(Font, FontStyle.Bold);
foreach (ListViewItem item in enumerable)
{
switch (type)
{
case DisplyType.forbidden:
item.SubItems[6].Text = reust;
item.SubItems[6].Font = font;
item.SubItems[6].ForeColor = Color.Green;
break;
case DisplyType.xinxi:
item.SubItems[7].Text = reust;
break;
case DisplyType.error:
item.SubItems[6].Text = reust;
item.SubItems[6].Font = font;
item.SubItems[6].ForeColor = Color.Red;
break;
case DisplyType.chongzhi:
item.SubItems[6].Text = reust;
item.SubItems[6].ForeColor = Color.Black;
break;
}
}
});
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (AddRemoveFamilyMemberTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
lvItemGuid = selectedItem.Tag.ToString(),
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text,
newAppleId = selectedItem.SubItems[3].Text,
newApplePopPwd = selectedItem.SubItems[4].Text,
overflow = selectedItem.SubItems[5].Text
});
}
RearTaskRun(list);
}
public override void TwoFactorItem_over_Click(string reust)
{
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
lvItemGuid = selectedItem.Tag.ToString(),
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text + reust,
newAppleId = selectedItem.SubItems[3].Text,
newApplePopPwd = selectedItem.SubItems[4].Text,
overflow = selectedItem.SubItems[5].Text
});
}
RearTaskRun(list);
}
private void btnAddRemoveFamilyMemberClre_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
base.listData.Items.Clear();
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnAddRemoveFamilyMemberExper_Click(object sender, EventArgs e)
{
ExperList(base.listData);
}
private void btnAddRemoveFamilyMemberLog_Click(object sender, EventArgs e)
{
FromDBDataQuery fromDBDataQuery = new FromDBDataQuery();
fromDBDataQuery.sqlTitle = new Dictionary<string, string>
{
{ "value1", "账号|150" },
{ "value2", "密码|100" },
{ "value3", "成员账号|100" },
{ "value4", "成员密码|100" },
{ "value5", "类型/安全吗|80" },
{ "value6", "状态|60" },
{ "value7", "信息|150" }
};
fromDBDataQuery.type = "addRemoveFamily";
fromDBDataQuery.typeName = "添加或删除家庭成员记录";
fromDBDataQuery.Show();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.ckAddRemoveFamilyMember = new System.Windows.Forms.CheckBox();
this.labAddRemoveFamilyMemberInter = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.labAddRemoveFamilyMemberCount = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnAddRemoveFamilyMemberClre = new System.Windows.Forms.Button();
this.btnAddRemoveFamilyMemberLog = new System.Windows.Forms.Button();
this.btnAddRemoveFamilyMembernput = new System.Windows.Forms.Button();
this.btnAddRemoveFamilyMemberExper = new System.Windows.Forms.Button();
this.btnAddRemoveFamilyMemberStart = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.listAddRemoveFamilyMember = new AppleBatch_June.Views.DoubleBufferListView();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader14 = new System.Windows.Forms.ColumnHeader();
this.groupBox9.SuspendLayout();
this.groupBox10.SuspendLayout();
this.groupBox12.SuspendLayout();
base.SuspendLayout();
this.groupBox9.Controls.Add(this.label2);
this.groupBox9.Controls.Add(this.textBox1);
this.groupBox9.Controls.Add(this.label1);
this.groupBox9.Controls.Add(this.textBox2);
this.groupBox9.Controls.Add(this.ckAddRemoveFamilyMember);
this.groupBox9.Controls.Add(this.labAddRemoveFamilyMemberInter);
this.groupBox9.Controls.Add(this.label10);
this.groupBox9.Controls.Add(this.label13);
this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox9.Location = new System.Drawing.Point(445, 12);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(520, 126);
this.groupBox9.TabIndex = 23;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "添加或者移除家庭成员 功能说明";
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(145, 99);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 17);
this.label2.TabIndex = 14;
this.label2.Text = "移除成员格式";
this.textBox1.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox1.Location = new System.Drawing.Point(233, 97);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(271, 23);
this.textBox1.TabIndex = 13;
this.textBox1.Text = "组织者账号----密码--家庭成员的Dsid";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(146, 71);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 17);
this.label1.TabIndex = 12;
this.label1.Text = "添加成员格式";
this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox2.Location = new System.Drawing.Point(234, 68);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(271, 23);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "组织者账号----密码--成员账号--密码--安全码\r\n";
this.ckAddRemoveFamilyMember.AutoSize = true;
this.ckAddRemoveFamilyMember.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckAddRemoveFamilyMember.ForeColor = System.Drawing.Color.Red;
this.ckAddRemoveFamilyMember.Location = new System.Drawing.Point(18, 97);
this.ckAddRemoveFamilyMember.Name = "ckAddRemoveFamilyMember";
this.ckAddRemoveFamilyMember.Size = new System.Drawing.Size(111, 21);
this.ckAddRemoveFamilyMember.TabIndex = 10;
this.ckAddRemoveFamilyMember.Text = "使用随机IP代理";
this.ckAddRemoveFamilyMember.UseVisualStyleBackColor = true;
this.labAddRemoveFamilyMemberInter.AutoSize = true;
this.labAddRemoveFamilyMemberInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labAddRemoveFamilyMemberInter.ForeColor = System.Drawing.Color.Crimson;
this.labAddRemoveFamilyMemberInter.Location = new System.Drawing.Point(103, 71);
this.labAddRemoveFamilyMemberInter.Name = "labAddRemoveFamilyMemberInter";
this.labAddRemoveFamilyMemberInter.Size = new System.Drawing.Size(18, 19);
this.labAddRemoveFamilyMemberInter.TabIndex = 2;
this.labAddRemoveFamilyMemberInter.Text = "0";
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(15, 73);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(92, 17);
this.label10.TabIndex = 1;
this.label10.Text = "查询消耗点数:";
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(11, 22);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(502, 34);
this.label13.TabIndex = 0;
this.label13.Text = "需要组织者账号并且拥有支付方式的安全码才能添加成员移除家庭成员需要成员的Dsid。\r\n 该功能不支持多线程运行,仅支持单线程运行。";
this.groupBox10.Controls.Add(this.labAddRemoveFamilyMemberCount);
this.groupBox10.Controls.Add(this.label16);
this.groupBox10.Controls.Add(this.btnAddRemoveFamilyMemberClre);
this.groupBox10.Controls.Add(this.btnAddRemoveFamilyMemberLog);
this.groupBox10.Controls.Add(this.btnAddRemoveFamilyMembernput);
this.groupBox10.Controls.Add(this.btnAddRemoveFamilyMemberExper);
this.groupBox10.Controls.Add(this.btnAddRemoveFamilyMemberStart);
this.groupBox10.Location = new System.Drawing.Point(12, 12);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(427, 126);
this.groupBox10.TabIndex = 22;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "操作";
this.labAddRemoveFamilyMemberCount.AutoSize = true;
this.labAddRemoveFamilyMemberCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labAddRemoveFamilyMemberCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labAddRemoveFamilyMemberCount.Location = new System.Drawing.Point(282, 15);
this.labAddRemoveFamilyMemberCount.Name = "labAddRemoveFamilyMemberCount";
this.labAddRemoveFamilyMemberCount.Size = new System.Drawing.Size(15, 17);
this.labAddRemoveFamilyMemberCount.TabIndex = 7;
this.labAddRemoveFamilyMemberCount.Text = "0";
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label16.Location = new System.Drawing.Point(179, 16);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(95, 17);
this.label16.TabIndex = 6;
this.label16.Text = "列表中账号数量:";
this.btnAddRemoveFamilyMemberClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAddRemoveFamilyMemberClre.Location = new System.Drawing.Point(325, 75);
this.btnAddRemoveFamilyMemberClre.Name = "btnAddRemoveFamilyMemberClre";
this.btnAddRemoveFamilyMemberClre.Size = new System.Drawing.Size(96, 23);
this.btnAddRemoveFamilyMemberClre.TabIndex = 5;
this.btnAddRemoveFamilyMemberClre.Text = "清空账号列表";
this.btnAddRemoveFamilyMemberClre.UseVisualStyleBackColor = true;
this.btnAddRemoveFamilyMemberClre.Click += new System.EventHandler(btnAddRemoveFamilyMemberClre_Click);
this.btnAddRemoveFamilyMemberLog.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAddRemoveFamilyMemberLog.Location = new System.Drawing.Point(179, 42);
this.btnAddRemoveFamilyMemberLog.Name = "btnAddRemoveFamilyMemberLog";
this.btnAddRemoveFamilyMemberLog.Size = new System.Drawing.Size(140, 23);
this.btnAddRemoveFamilyMemberLog.TabIndex = 4;
this.btnAddRemoveFamilyMemberLog.Text = "家庭成员管理记录";
this.btnAddRemoveFamilyMemberLog.UseVisualStyleBackColor = true;
this.btnAddRemoveFamilyMemberLog.Click += new System.EventHandler(btnAddRemoveFamilyMemberLog_Click);
this.btnAddRemoveFamilyMembernput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAddRemoveFamilyMembernput.Location = new System.Drawing.Point(179, 76);
this.btnAddRemoveFamilyMembernput.Name = "btnAddRemoveFamilyMembernput";
this.btnAddRemoveFamilyMembernput.Size = new System.Drawing.Size(140, 23);
this.btnAddRemoveFamilyMembernput.TabIndex = 3;
this.btnAddRemoveFamilyMembernput.Text = "账号输入";
this.btnAddRemoveFamilyMembernput.UseVisualStyleBackColor = true;
this.btnAddRemoveFamilyMembernput.Click += new System.EventHandler(btnAddRemoveFamilyMembernput_Click);
this.btnAddRemoveFamilyMemberExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnAddRemoveFamilyMemberExper.Location = new System.Drawing.Point(325, 42);
this.btnAddRemoveFamilyMemberExper.Name = "btnAddRemoveFamilyMemberExper";
this.btnAddRemoveFamilyMemberExper.Size = new System.Drawing.Size(96, 23);
this.btnAddRemoveFamilyMemberExper.TabIndex = 2;
this.btnAddRemoveFamilyMemberExper.Text = "导出账号";
this.btnAddRemoveFamilyMemberExper.UseVisualStyleBackColor = true;
this.btnAddRemoveFamilyMemberExper.Click += new System.EventHandler(btnAddRemoveFamilyMemberExper_Click);
this.btnAddRemoveFamilyMemberStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnAddRemoveFamilyMemberStart.ForeColor = System.Drawing.Color.Green;
this.btnAddRemoveFamilyMemberStart.Location = new System.Drawing.Point(18, 33);
this.btnAddRemoveFamilyMemberStart.Name = "btnAddRemoveFamilyMemberStart";
this.btnAddRemoveFamilyMemberStart.Size = new System.Drawing.Size(110, 65);
this.btnAddRemoveFamilyMemberStart.TabIndex = 1;
this.btnAddRemoveFamilyMemberStart.Text = "开始执行";
this.btnAddRemoveFamilyMemberStart.UseVisualStyleBackColor = true;
this.btnAddRemoveFamilyMemberStart.Click += new System.EventHandler(btnAddRemoveFamilyMemberStart_Click);
this.groupBox12.Controls.Add(this.listAddRemoveFamilyMember);
this.groupBox12.Location = new System.Drawing.Point(9, 144);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(956, 408);
this.groupBox12.TabIndex = 21;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "iCloud账号列表";
this.listAddRemoveFamilyMember.Columns.AddRange(new System.Windows.Forms.ColumnHeader[8] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader4, this.columnHeader2, this.columnHeader3, this.columnHeader1, this.columnHeader14 });
this.listAddRemoveFamilyMember.Dock = System.Windows.Forms.DockStyle.Fill;
this.listAddRemoveFamilyMember.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.listAddRemoveFamilyMember.FullRowSelect = true;
this.listAddRemoveFamilyMember.HideSelection = false;
this.listAddRemoveFamilyMember.Location = new System.Drawing.Point(3, 17);
this.listAddRemoveFamilyMember.Name = "listAddRemoveFamilyMember";
this.listAddRemoveFamilyMember.Size = new System.Drawing.Size(950, 388);
this.listAddRemoveFamilyMember.TabIndex = 0;
this.listAddRemoveFamilyMember.UseCompatibleStateImageBehavior = false;
this.listAddRemoveFamilyMember.View = System.Windows.Forms.View.Details;
this.columnHeader8.Text = "序号";
this.columnHeader9.Text = "账号";
this.columnHeader9.Width = 150;
this.columnHeader10.Text = "密码";
this.columnHeader10.Width = 100;
this.columnHeader4.Text = "成员账号";
this.columnHeader4.Width = 150;
this.columnHeader2.Text = "成员密码";
this.columnHeader2.Width = 100;
this.columnHeader3.Text = "类型/安全码";
this.columnHeader3.Width = 80;
this.columnHeader1.Text = "状态";
this.columnHeader14.Text = "信息";
this.columnHeader14.Width = 230;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(977, 567);
base.Controls.Add(this.groupBox9);
base.Controls.Add(this.groupBox10);
base.Controls.Add(this.groupBox12);
base.MaximizeBox = false;
base.Name = "FromAddRemoveFamilyMember";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "添加或者移除家庭成员";
base.Load += new System.EventHandler(FromAddRemoveFamilyMember_Load);
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.groupBox12.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,544 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FromCreateFamily : BaseForm
{
private IContainer components;
private GroupBox groupBox9;
private TextBox textBox2;
private CheckBox ckCreateFamilyVpn;
private Label labCreateFamilyInter;
private Label label10;
private Label label13;
private GroupBox groupBox10;
private Label labCreateFamilyCount;
private Label label16;
private Button btnLiteClre;
private Button btnCreateFamilyQuery;
private Button btnCreateFamilyInput;
private Button btnCreateFamilyExper;
private Button btnCreateFamilyStart;
private GroupBox groupBox12;
private DoubleBufferListView listCreateFamily;
private ColumnHeader columnHeader8;
private ColumnHeader columnHeader9;
private ColumnHeader columnHeader10;
private ColumnHeader columnHeader2;
private ColumnHeader columnHeader11;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader14;
public FromCreateFamily()
: base("开通家庭共享", CreateFamilyTask.Instance)
{
InitializeComponent();
}
private void btnCreateFamilyInput_Click(object sender, EventArgs e)
{
FromInputAcount fromInputAcount = new FromInputAcount();
fromInputAcount.tipMssage = textBox2.Text;
fromInputAcount.isOpenSysVpn = ckCreateFamilyVpn.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> list = AppleUtlis.accountInput(fromInputAcount.StrInput);
int num = 0;
base.listData.ListViewItemSorter = new ListViewItemComparer(0, 1);
base.listData.Sort();
if (base.listData.Items.Count > 0 && int.TryParse(base.listData.Items[base.listData.Items.Count - 1].SubItems[0].Text, out var result))
{
num = result;
}
foreach (AppleAcount item in list)
{
num++;
ListViewItem listViewItem = new ListViewItem(num.ToString());
listViewItem.UseItemStyleForSubItems = false;
listViewItem.SubItems.Add(item.appleId);
listViewItem.SubItems.Add(item.applePwd);
if (item.overflow.Split('-').Length == 2)
{
listViewItem.SubItems.Add(item.overflow.Split('-')[0].Trim());
listViewItem.SubItems.Add(item.overflow.Split('-')[1].Trim());
}
else
{
if (item.overflow.Split('-').Length <= 2 || !string.IsNullOrEmpty(item.appleQt1))
{
try
{
string obj = item.sourceInputData.Substring(item.sourceInputData.IndexOf(item.appleId) + item.appleId.Length).TrimStart('-');
List<AppleAcount> list2 = AppleUtlis.accountInput(obj.Substring(obj.IndexOf(item.applePwd) + item.applePwd.Length).TrimStart('-'));
if (list2.Count == 1)
{
listViewItem.SubItems.Add(list2[0].appleId.Trim());
listViewItem.SubItems.Add(list2[0].applePwd.Trim());
goto IL_02cb;
}
}
catch (Exception)
{
}
continue;
}
try
{
int num2 = item.overflow.LastIndexOf('-');
string text = item.overflow.Substring(0, num2);
string text2 = item.overflow.Substring(num2 + 1);
listViewItem.SubItems.Add(text);
listViewItem.SubItems.Add(text2);
}
catch (Exception)
{
continue;
}
}
goto IL_02cb;
IL_02cb:
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
base.listData.Items.Add(listViewItem);
}
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void FromCreateFamily_Load(object sender, EventArgs e)
{
base.listData = listCreateFamily;
base.labCout = labCreateFamilyCount;
base.startBtn = btnCreateFamilyStart;
labCreateFamilyInter.Text = AppSysConfig.getTypeById(32).consNum.ToString();
ckCreateFamilyVpn.Checked = ((ConfigUtlis.getConfigValue("ckCreateFamilyVpn") == "True") ? true : false);
InitLv(base.listData);
BindMenuStrip(addTwoFactor: true);
}
private void btnCreateFamilyStart_Click(object sender, EventArgs e)
{
if (!CreateFamilyTask.Instance.isRun && !CreateFamilyTask.Instance.TaskIsRun)
{
List<AppleAcount> lvItems = (from ListViewItem c in base.listData.Items
where c.SubItems[5].Text == "-"
select new AppleAcount
{
appleId = c.SubItems[1].Text,
applePwd = c.SubItems[2].Text,
newAppleId = c.SubItems[3].Text,
newApplePopPwd = c.SubItems[4].Text
}).ToList();
RearTaskRun(lvItems);
return;
}
CreateFamilyTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
base.startBtn.Text = "正在停止";
base.startBtn.ForeColor = Color.Red;
});
}
}
private void RearTaskRun(List<AppleAcount> lvItems)
{
int id = 32;
int count = lvItems.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(32).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
}
else
{
ConfigUtlis.saveConfigKey("ckCreateFamilyVpn", ckCreateFamilyVpn.Checked.ToString());
CreateFamilyTask.Instance.ExecuteCreateFamily(2, ckCreateFamilyVpn.Checked, lvItems, base.startAct, base.endTakAct, sucessAct, _action);
}
}
public void sucessAct(string AppleId)
{
UpdataUi(delegate
{
ListViewItem listViewItem = (from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == AppleId
select c).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "createFamily" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{
"value1",
listViewItem.SubItems[1].Text
},
{
"value2",
listViewItem.SubItems[2].Text
},
{
"value3",
listViewItem.SubItems[3].Text
},
{
"value4",
listViewItem.SubItems[4].Text
},
{
"value5",
listViewItem.SubItems[5].Text
},
{
"value6",
listViewItem.SubItems[6].Text
}
});
}
});
}
public void _action(string key, DisplyType type, string reust)
{
UpdataUi(delegate
{
IEnumerable<ListViewItem> enumerable = from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == key
select c;
Font font = new Font(Font, FontStyle.Bold);
foreach (ListViewItem item in enumerable)
{
switch (type)
{
case DisplyType.forbidden:
item.SubItems[5].Text = reust;
item.SubItems[5].Font = font;
item.SubItems[5].ForeColor = Color.Green;
break;
case DisplyType.xinxi:
item.SubItems[6].Text = reust;
break;
case DisplyType.error:
item.SubItems[5].Text = reust;
item.SubItems[5].Font = font;
item.SubItems[5].ForeColor = Color.Red;
break;
case DisplyType.chongzhi:
item.SubItems[5].Text = reust;
item.SubItems[5].ForeColor = Color.Black;
break;
}
}
});
}
private void btnLiteClre_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
base.listData.Items.Clear();
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnCreateFamilyExper_Click(object sender, EventArgs e)
{
ExperList(base.listData);
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (CreateFamilyTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text,
newAppleId = selectedItem.SubItems[3].Text,
newApplePopPwd = selectedItem.SubItems[4].Text
});
}
RearTaskRun(list);
}
public override void TwoFactorItem_over_Click(string reust)
{
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text + reust,
newAppleId = selectedItem.SubItems[3].Text,
newApplePopPwd = selectedItem.SubItems[4].Text
});
}
RearTaskRun(list);
}
private void btnCreateFamilyQuery_Click(object sender, EventArgs e)
{
FromDBDataQuery fromDBDataQuery = new FromDBDataQuery();
fromDBDataQuery.sqlTitle = new Dictionary<string, string>
{
{ "value1", "账号|180" },
{ "value2", "密码|100" },
{ "value3", "付款账号|180" },
{ "value4", "付款密码|100" },
{ "value5", "状态|100" },
{ "value6", "信息|150" }
};
fromDBDataQuery.type = "createFamily";
fromDBDataQuery.typeName = "开通家庭共享记录";
fromDBDataQuery.Show();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.ckCreateFamilyVpn = new System.Windows.Forms.CheckBox();
this.labCreateFamilyInter = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.labCreateFamilyCount = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnLiteClre = new System.Windows.Forms.Button();
this.btnCreateFamilyQuery = new System.Windows.Forms.Button();
this.btnCreateFamilyInput = new System.Windows.Forms.Button();
this.btnCreateFamilyExper = new System.Windows.Forms.Button();
this.btnCreateFamilyStart = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.listCreateFamily = new AppleBatch_June.Views.DoubleBufferListView();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader11 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader14 = new System.Windows.Forms.ColumnHeader();
this.groupBox9.SuspendLayout();
this.groupBox10.SuspendLayout();
this.groupBox12.SuspendLayout();
base.SuspendLayout();
this.groupBox9.Controls.Add(this.textBox2);
this.groupBox9.Controls.Add(this.ckCreateFamilyVpn);
this.groupBox9.Controls.Add(this.labCreateFamilyInter);
this.groupBox9.Controls.Add(this.label10);
this.groupBox9.Controls.Add(this.label13);
this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox9.Location = new System.Drawing.Point(455, 12);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(510, 126);
this.groupBox9.TabIndex = 17;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "开通家庭共享 功能说明";
this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox2.Location = new System.Drawing.Point(150, 80);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(324, 23);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "xxx@xx.com----密码--付款AppleID账号--付款密码";
this.ckCreateFamilyVpn.AutoSize = true;
this.ckCreateFamilyVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckCreateFamilyVpn.ForeColor = System.Drawing.Color.Red;
this.ckCreateFamilyVpn.Location = new System.Drawing.Point(18, 84);
this.ckCreateFamilyVpn.Name = "ckCreateFamilyVpn";
this.ckCreateFamilyVpn.Size = new System.Drawing.Size(111, 21);
this.ckCreateFamilyVpn.TabIndex = 10;
this.ckCreateFamilyVpn.Text = "使用随机IP代理";
this.ckCreateFamilyVpn.UseVisualStyleBackColor = true;
this.labCreateFamilyInter.AutoSize = true;
this.labCreateFamilyInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labCreateFamilyInter.ForeColor = System.Drawing.Color.Crimson;
this.labCreateFamilyInter.Location = new System.Drawing.Point(103, 60);
this.labCreateFamilyInter.Name = "labCreateFamilyInter";
this.labCreateFamilyInter.Size = new System.Drawing.Size(18, 19);
this.labCreateFamilyInter.TabIndex = 2;
this.labCreateFamilyInter.Text = "0";
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(15, 62);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(92, 17);
this.label10.TabIndex = 1;
this.label10.Text = "查询消耗点数:";
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(4, 31);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(500, 17);
this.label13.TabIndex = 0;
this.label13.Text = "开通家庭共享需要主账号绑定付款方式或者拥有付款方式的账号,付款账号可以是组织者账号\r\n";
this.groupBox10.Controls.Add(this.labCreateFamilyCount);
this.groupBox10.Controls.Add(this.label16);
this.groupBox10.Controls.Add(this.btnLiteClre);
this.groupBox10.Controls.Add(this.btnCreateFamilyQuery);
this.groupBox10.Controls.Add(this.btnCreateFamilyInput);
this.groupBox10.Controls.Add(this.btnCreateFamilyExper);
this.groupBox10.Controls.Add(this.btnCreateFamilyStart);
this.groupBox10.Location = new System.Drawing.Point(12, 12);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(437, 126);
this.groupBox10.TabIndex = 16;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "操作";
this.labCreateFamilyCount.AutoSize = true;
this.labCreateFamilyCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labCreateFamilyCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labCreateFamilyCount.Location = new System.Drawing.Point(282, 15);
this.labCreateFamilyCount.Name = "labCreateFamilyCount";
this.labCreateFamilyCount.Size = new System.Drawing.Size(15, 17);
this.labCreateFamilyCount.TabIndex = 7;
this.labCreateFamilyCount.Text = "0";
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label16.Location = new System.Drawing.Point(179, 16);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(95, 17);
this.label16.TabIndex = 6;
this.label16.Text = "列表中账号数量:";
this.btnLiteClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLiteClre.Location = new System.Drawing.Point(325, 75);
this.btnLiteClre.Name = "btnLiteClre";
this.btnLiteClre.Size = new System.Drawing.Size(96, 23);
this.btnLiteClre.TabIndex = 5;
this.btnLiteClre.Text = "清空账号列表";
this.btnLiteClre.UseVisualStyleBackColor = true;
this.btnLiteClre.Click += new System.EventHandler(btnLiteClre_Click);
this.btnCreateFamilyQuery.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnCreateFamilyQuery.Location = new System.Drawing.Point(179, 42);
this.btnCreateFamilyQuery.Name = "btnCreateFamilyQuery";
this.btnCreateFamilyQuery.Size = new System.Drawing.Size(140, 23);
this.btnCreateFamilyQuery.TabIndex = 4;
this.btnCreateFamilyQuery.Text = "开通家庭共享记录";
this.btnCreateFamilyQuery.UseVisualStyleBackColor = true;
this.btnCreateFamilyQuery.Click += new System.EventHandler(btnCreateFamilyQuery_Click);
this.btnCreateFamilyInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnCreateFamilyInput.Location = new System.Drawing.Point(179, 76);
this.btnCreateFamilyInput.Name = "btnCreateFamilyInput";
this.btnCreateFamilyInput.Size = new System.Drawing.Size(140, 23);
this.btnCreateFamilyInput.TabIndex = 3;
this.btnCreateFamilyInput.Text = "账号输入";
this.btnCreateFamilyInput.UseVisualStyleBackColor = true;
this.btnCreateFamilyInput.Click += new System.EventHandler(btnCreateFamilyInput_Click);
this.btnCreateFamilyExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnCreateFamilyExper.Location = new System.Drawing.Point(325, 42);
this.btnCreateFamilyExper.Name = "btnCreateFamilyExper";
this.btnCreateFamilyExper.Size = new System.Drawing.Size(96, 23);
this.btnCreateFamilyExper.TabIndex = 2;
this.btnCreateFamilyExper.Text = "导出账号";
this.btnCreateFamilyExper.UseVisualStyleBackColor = true;
this.btnCreateFamilyExper.Click += new System.EventHandler(btnCreateFamilyExper_Click);
this.btnCreateFamilyStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnCreateFamilyStart.ForeColor = System.Drawing.Color.Green;
this.btnCreateFamilyStart.Location = new System.Drawing.Point(18, 33);
this.btnCreateFamilyStart.Name = "btnCreateFamilyStart";
this.btnCreateFamilyStart.Size = new System.Drawing.Size(110, 65);
this.btnCreateFamilyStart.TabIndex = 1;
this.btnCreateFamilyStart.Text = "开始执行";
this.btnCreateFamilyStart.UseVisualStyleBackColor = true;
this.btnCreateFamilyStart.Click += new System.EventHandler(btnCreateFamilyStart_Click);
this.groupBox12.Controls.Add(this.listCreateFamily);
this.groupBox12.Location = new System.Drawing.Point(9, 144);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(956, 408);
this.groupBox12.TabIndex = 15;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "iCloud账号列表";
this.listCreateFamily.Columns.AddRange(new System.Windows.Forms.ColumnHeader[7] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader2, this.columnHeader11, this.columnHeader1, this.columnHeader14 });
this.listCreateFamily.Dock = System.Windows.Forms.DockStyle.Fill;
this.listCreateFamily.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.listCreateFamily.FullRowSelect = true;
this.listCreateFamily.HideSelection = false;
this.listCreateFamily.Location = new System.Drawing.Point(3, 17);
this.listCreateFamily.Name = "listCreateFamily";
this.listCreateFamily.Size = new System.Drawing.Size(950, 388);
this.listCreateFamily.TabIndex = 0;
this.listCreateFamily.UseCompatibleStateImageBehavior = false;
this.listCreateFamily.View = System.Windows.Forms.View.Details;
this.columnHeader8.Text = "序号";
this.columnHeader9.Text = "账号";
this.columnHeader9.Width = 150;
this.columnHeader10.Text = "密码";
this.columnHeader10.Width = 100;
this.columnHeader2.Text = "付款账号";
this.columnHeader2.Width = 150;
this.columnHeader11.Text = "付款密码";
this.columnHeader11.Width = 100;
this.columnHeader1.Text = "状态";
this.columnHeader1.Width = 80;
this.columnHeader14.Text = "信息";
this.columnHeader14.Width = 250;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(975, 565);
base.Controls.Add(this.groupBox9);
base.Controls.Add(this.groupBox10);
base.Controls.Add(this.groupBox12);
base.MaximizeBox = false;
base.Name = "FromCreateFamily";
base.ShowIcon = false;
this.Text = "开通家庭共享";
base.Load += new System.EventHandler(FromCreateFamily_Load);
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.groupBox12.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,494 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FromLeaveFamily : BaseForm
{
private IContainer components;
private GroupBox groupBox9;
private TextBox textBox2;
private CheckBox ckLeaveFamilyVpn;
private Label labLeaveFamilyInter;
private Label label10;
private Label label13;
private GroupBox groupBox10;
private Label labLeaveFamilyCount;
private Label label16;
private Button btnLiteClre;
private Button btnLeaveFamilyQuery;
private Button btnLeaveFamilyInput;
private Button btnLeaveFamilyExper;
private Button btnLeaveFamilyStart;
private GroupBox groupBox12;
private DoubleBufferListView listLeaveFamily;
private ColumnHeader columnHeader8;
private ColumnHeader columnHeader9;
private ColumnHeader columnHeader10;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader14;
private ColumnHeader columnHeader3;
public FromLeaveFamily()
: base("关闭家庭共享", LeaveFamilyTask.Instance)
{
InitializeComponent();
}
private void FromLeaveFamily_Load(object sender, EventArgs e)
{
base.listData = listLeaveFamily;
base.labCout = labLeaveFamilyCount;
base.startBtn = btnLeaveFamilyStart;
labLeaveFamilyInter.Text = AppSysConfig.getTypeById(30).consNum.ToString();
ckLeaveFamilyVpn.Checked = ((ConfigUtlis.getConfigValue("ckLeaveFamilyVpn") == "True") ? true : false);
InitLv(base.listData);
BindMenuStrip(addTwoFactor: true);
}
private void btnLeaveFamilyStart_Click(object sender, EventArgs e)
{
if (!LeaveFamilyTask.Instance.isRun && !LeaveFamilyTask.Instance.TaskIsRun)
{
List<AppleAcount> lvItems = (from ListViewItem c in base.listData.Items
where c.SubItems[3].Text == "-"
select new AppleAcount
{
appleId = c.SubItems[1].Text,
applePwd = c.SubItems[2].Text
}).ToList();
RearTaskRun(lvItems);
return;
}
LeaveFamilyTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
base.startBtn.Text = "正在停止";
base.startBtn.ForeColor = Color.Red;
});
}
}
private void RearTaskRun(List<AppleAcount> lvItems)
{
int id = 30;
int count = lvItems.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(30).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
}
else
{
ConfigUtlis.saveConfigKey("ckLeaveFamilyVpn", ckLeaveFamilyVpn.Checked.ToString());
LeaveFamilyTask.Instance.ExecuteLeaveFamily(2, ckLeaveFamilyVpn.Checked, lvItems, base.startAct, base.endTakAct, sucessAct, _action);
}
}
public void sucessAct(string AppleId)
{
UpdataUi(delegate
{
ListViewItem listViewItem = (from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == AppleId
select c).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "leaveFamily" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{
"value1",
listViewItem.SubItems[1].Text
},
{
"value2",
listViewItem.SubItems[2].Text
},
{
"value3",
listViewItem.SubItems[3].Text
},
{
"value4",
listViewItem.SubItems[4].Text
},
{
"value5",
listViewItem.SubItems[5].Text
}
});
}
});
}
public void _action(string key, DisplyType type, string reust)
{
UpdataUi(delegate
{
IEnumerable<ListViewItem> enumerable = from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == key
select c;
Font font = new Font(Font, FontStyle.Bold);
foreach (ListViewItem item in enumerable)
{
switch (type)
{
case DisplyType.forbidden:
item.SubItems[4].Text = reust;
item.SubItems[4].Font = font;
item.SubItems[4].ForeColor = Color.Green;
break;
case DisplyType.xinxi:
item.SubItems[5].Text = reust;
break;
case DisplyType.error:
item.SubItems[4].Text = reust;
item.SubItems[4].Font = font;
item.SubItems[4].ForeColor = Color.Red;
break;
case DisplyType.chongzhi:
item.SubItems[3].Text = reust;
item.SubItems[5].Text = reust;
item.SubItems[5].ForeColor = Color.Black;
break;
case DisplyType.area:
item.SubItems[3].Text = reust;
break;
}
}
});
}
private void btnLeaveFamilyInput_Click(object sender, EventArgs e)
{
FromInputAcount fromInputAcount = new FromInputAcount();
fromInputAcount.tipMssage = textBox2.Text;
fromInputAcount.isOpenSysVpn = ckLeaveFamilyVpn.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> list = AppleUtlis.accountInput(fromInputAcount.StrInput);
int num = 0;
base.listData.ListViewItemSorter = new ListViewItemComparer(0, 1);
base.listData.Sort();
if (base.listData.Items.Count > 0 && int.TryParse(base.listData.Items[base.listData.Items.Count - 1].SubItems[0].Text, out var result))
{
num = result;
}
foreach (AppleAcount item in list)
{
num++;
ListViewItem listViewItem = new ListViewItem(num.ToString());
listViewItem.UseItemStyleForSubItems = false;
listViewItem.SubItems.Add(item.appleId);
listViewItem.SubItems.Add(item.applePwd);
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
base.listData.Items.Add(listViewItem);
}
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnLiteClre_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
base.listData.Items.Clear();
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnLeaveFamilyExper_Click(object sender, EventArgs e)
{
ExperList(base.listData);
}
public override void TwoFactorItem_over_Click(string reust)
{
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text + reust
});
}
RearTaskRun(list);
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (LeaveFamilyTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text
});
}
RearTaskRun(list);
}
private void btnLeaveFamilyQuery_Click(object sender, EventArgs e)
{
FromDBDataQuery fromDBDataQuery = new FromDBDataQuery();
fromDBDataQuery.sqlTitle = new Dictionary<string, string>
{
{ "value1", "账号|180" },
{ "value2", "密码|100" },
{ "value3", "国家|80" },
{ "value4", "状态|100" },
{ "value5", "信息|150" }
};
fromDBDataQuery.type = "leaveFamily";
fromDBDataQuery.typeName = "关闭家庭共享记录";
fromDBDataQuery.Show();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.ckLeaveFamilyVpn = new System.Windows.Forms.CheckBox();
this.labLeaveFamilyInter = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.labLeaveFamilyCount = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnLiteClre = new System.Windows.Forms.Button();
this.btnLeaveFamilyQuery = new System.Windows.Forms.Button();
this.btnLeaveFamilyInput = new System.Windows.Forms.Button();
this.btnLeaveFamilyExper = new System.Windows.Forms.Button();
this.btnLeaveFamilyStart = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.listLeaveFamily = new AppleBatch_June.Views.DoubleBufferListView();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader14 = new System.Windows.Forms.ColumnHeader();
this.groupBox9.SuspendLayout();
this.groupBox10.SuspendLayout();
this.groupBox12.SuspendLayout();
base.SuspendLayout();
this.groupBox9.Controls.Add(this.textBox2);
this.groupBox9.Controls.Add(this.ckLeaveFamilyVpn);
this.groupBox9.Controls.Add(this.labLeaveFamilyInter);
this.groupBox9.Controls.Add(this.label10);
this.groupBox9.Controls.Add(this.label13);
this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox9.Location = new System.Drawing.Point(455, 12);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(510, 126);
this.groupBox9.TabIndex = 20;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "关闭家庭共享 功能说明";
this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox2.Location = new System.Drawing.Point(151, 81);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(324, 23);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "导入格式xxx@xx.com----密码";
this.ckLeaveFamilyVpn.AutoSize = true;
this.ckLeaveFamilyVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckLeaveFamilyVpn.ForeColor = System.Drawing.Color.Red;
this.ckLeaveFamilyVpn.Location = new System.Drawing.Point(18, 87);
this.ckLeaveFamilyVpn.Name = "ckLeaveFamilyVpn";
this.ckLeaveFamilyVpn.Size = new System.Drawing.Size(111, 21);
this.ckLeaveFamilyVpn.TabIndex = 10;
this.ckLeaveFamilyVpn.Text = "使用随机IP代理";
this.ckLeaveFamilyVpn.UseVisualStyleBackColor = true;
this.labLeaveFamilyInter.AutoSize = true;
this.labLeaveFamilyInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labLeaveFamilyInter.ForeColor = System.Drawing.Color.Crimson;
this.labLeaveFamilyInter.Location = new System.Drawing.Point(103, 60);
this.labLeaveFamilyInter.Name = "labLeaveFamilyInter";
this.labLeaveFamilyInter.Size = new System.Drawing.Size(18, 19);
this.labLeaveFamilyInter.TabIndex = 2;
this.labLeaveFamilyInter.Text = "0";
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(15, 62);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(92, 17);
this.label10.TabIndex = 1;
this.label10.Text = "查询消耗点数:";
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(15, 28);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(416, 17);
this.label13.TabIndex = 0;
this.label13.Text = "如果是组织者关闭家庭共享,则解散整个家庭共享,如果是成员,则退出家庭";
this.groupBox10.Controls.Add(this.labLeaveFamilyCount);
this.groupBox10.Controls.Add(this.label16);
this.groupBox10.Controls.Add(this.btnLiteClre);
this.groupBox10.Controls.Add(this.btnLeaveFamilyQuery);
this.groupBox10.Controls.Add(this.btnLeaveFamilyInput);
this.groupBox10.Controls.Add(this.btnLeaveFamilyExper);
this.groupBox10.Controls.Add(this.btnLeaveFamilyStart);
this.groupBox10.Location = new System.Drawing.Point(12, 12);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(437, 126);
this.groupBox10.TabIndex = 19;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "操作";
this.labLeaveFamilyCount.AutoSize = true;
this.labLeaveFamilyCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labLeaveFamilyCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labLeaveFamilyCount.Location = new System.Drawing.Point(282, 15);
this.labLeaveFamilyCount.Name = "labLeaveFamilyCount";
this.labLeaveFamilyCount.Size = new System.Drawing.Size(15, 17);
this.labLeaveFamilyCount.TabIndex = 7;
this.labLeaveFamilyCount.Text = "0";
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label16.Location = new System.Drawing.Point(179, 16);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(95, 17);
this.label16.TabIndex = 6;
this.label16.Text = "列表中账号数量:";
this.btnLiteClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLiteClre.Location = new System.Drawing.Point(325, 75);
this.btnLiteClre.Name = "btnLiteClre";
this.btnLiteClre.Size = new System.Drawing.Size(96, 23);
this.btnLiteClre.TabIndex = 5;
this.btnLiteClre.Text = "清空账号列表";
this.btnLiteClre.UseVisualStyleBackColor = true;
this.btnLiteClre.Click += new System.EventHandler(btnLiteClre_Click);
this.btnLeaveFamilyQuery.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyQuery.Location = new System.Drawing.Point(179, 42);
this.btnLeaveFamilyQuery.Name = "btnLeaveFamilyQuery";
this.btnLeaveFamilyQuery.Size = new System.Drawing.Size(140, 23);
this.btnLeaveFamilyQuery.TabIndex = 4;
this.btnLeaveFamilyQuery.Text = "关闭家庭共享记录";
this.btnLeaveFamilyQuery.UseVisualStyleBackColor = true;
this.btnLeaveFamilyQuery.Click += new System.EventHandler(btnLeaveFamilyQuery_Click);
this.btnLeaveFamilyInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyInput.Location = new System.Drawing.Point(179, 76);
this.btnLeaveFamilyInput.Name = "btnLeaveFamilyInput";
this.btnLeaveFamilyInput.Size = new System.Drawing.Size(140, 23);
this.btnLeaveFamilyInput.TabIndex = 3;
this.btnLeaveFamilyInput.Text = "账号输入";
this.btnLeaveFamilyInput.UseVisualStyleBackColor = true;
this.btnLeaveFamilyInput.Click += new System.EventHandler(btnLeaveFamilyInput_Click);
this.btnLeaveFamilyExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyExper.Location = new System.Drawing.Point(325, 42);
this.btnLeaveFamilyExper.Name = "btnLeaveFamilyExper";
this.btnLeaveFamilyExper.Size = new System.Drawing.Size(96, 23);
this.btnLeaveFamilyExper.TabIndex = 2;
this.btnLeaveFamilyExper.Text = "导出账号";
this.btnLeaveFamilyExper.UseVisualStyleBackColor = true;
this.btnLeaveFamilyExper.Click += new System.EventHandler(btnLeaveFamilyExper_Click);
this.btnLeaveFamilyStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyStart.ForeColor = System.Drawing.Color.Green;
this.btnLeaveFamilyStart.Location = new System.Drawing.Point(18, 33);
this.btnLeaveFamilyStart.Name = "btnLeaveFamilyStart";
this.btnLeaveFamilyStart.Size = new System.Drawing.Size(110, 65);
this.btnLeaveFamilyStart.TabIndex = 1;
this.btnLeaveFamilyStart.Text = "开始执行";
this.btnLeaveFamilyStart.UseVisualStyleBackColor = true;
this.btnLeaveFamilyStart.Click += new System.EventHandler(btnLeaveFamilyStart_Click);
this.groupBox12.Controls.Add(this.listLeaveFamily);
this.groupBox12.Location = new System.Drawing.Point(9, 144);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(956, 408);
this.groupBox12.TabIndex = 18;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "iCloud账号列表";
this.listLeaveFamily.Columns.AddRange(new System.Windows.Forms.ColumnHeader[6] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader3, this.columnHeader1, this.columnHeader14 });
this.listLeaveFamily.Dock = System.Windows.Forms.DockStyle.Fill;
this.listLeaveFamily.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.listLeaveFamily.FullRowSelect = true;
this.listLeaveFamily.HideSelection = false;
this.listLeaveFamily.Location = new System.Drawing.Point(3, 17);
this.listLeaveFamily.Name = "listLeaveFamily";
this.listLeaveFamily.Size = new System.Drawing.Size(950, 388);
this.listLeaveFamily.TabIndex = 0;
this.listLeaveFamily.UseCompatibleStateImageBehavior = false;
this.listLeaveFamily.View = System.Windows.Forms.View.Details;
this.columnHeader8.Text = "序号";
this.columnHeader9.Text = "账号";
this.columnHeader9.Width = 150;
this.columnHeader10.Text = "密码";
this.columnHeader10.Width = 100;
this.columnHeader3.Text = "国家";
this.columnHeader3.Width = 100;
this.columnHeader1.Text = "状态";
this.columnHeader1.Width = 100;
this.columnHeader14.Text = "信息";
this.columnHeader14.Width = 350;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(977, 561);
base.Controls.Add(this.groupBox9);
base.Controls.Add(this.groupBox10);
base.Controls.Add(this.groupBox12);
base.MaximizeBox = false;
base.Name = "FromLeaveFamily";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "关闭家庭共享";
base.Load += new System.EventHandler(FromLeaveFamily_Load);
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.groupBox12.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,555 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.Domain;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FromOvercheck : BaseForm
{
private IContainer components;
private GroupBox groupBox9;
private TextBox textBox2;
private CheckBox ckOvercheckVpn;
private Label labOvercheckInter;
private Label label10;
private Label label13;
private GroupBox groupBox10;
private Label labOvercheckCount;
private Label label16;
private Button btnOvercheckLiteClre;
private Button btnOvercheckQuery;
private Button btnOvercheckInput;
private Button btnOvercheckExper;
private Button btnOvercheckStart;
private GroupBox groupBox12;
private DoubleBufferListView listOvercheck;
private ColumnHeader columnHeader8;
private ColumnHeader columnHeader9;
private ColumnHeader columnHeader10;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader14;
private ColumnHeader columnHeader3;
private Label label1;
private ComboBox ComCountrySelectList;
private Label label63;
public FromOvercheck()
: base("AppStore检查", OvercheckTask.Instance)
{
InitializeComponent();
}
private void FromLeaveFamily_Load(object sender, EventArgs e)
{
base.listData = listOvercheck;
base.labCout = labOvercheckCount;
base.startBtn = btnOvercheckStart;
labOvercheckInter.Text = AppSysConfig.getTypeById(41).consNum.ToString();
label13.Text = label13.Text.Replace("{0}", AppSysConfig.getTypeById(42).consNum.ToString());
ckOvercheckVpn.Checked = ((ConfigUtlis.getConfigValue("ckOvercheckVpn") == "True") ? true : false);
InitLv(base.listData);
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem
{
Text = "设置显示列",
Size = new Size(124, 22)
};
toolStripMenuItem.Click += base.ShouItemsIndex_Click;
BindMenuStrip(addTwoFactor: true, new ToolStripMenuItem[1] { toolStripMenuItem });
ComCountrySelectList.DisplayMember = "name";
ComCountrySelectList.ValueMember = "Id";
List<NationalList> mation = new NationalData().getMation();
mation.Insert(0, new NationalList
{
Id = "-",
name = "请选择",
payment = null
});
ComCountrySelectList.DataSource = mation;
}
private void btnLeaveFamilyStart_Click(object sender, EventArgs e)
{
if (!OvercheckTask.Instance.isRun && !OvercheckTask.Instance.TaskIsRun)
{
List<AppleAcount> lvItems = (from ListViewItem c in base.listData.Items
where c.SubItems[3].Text == "-"
select new AppleAcount
{
appleId = c.SubItems[1].Text,
applePwd = c.SubItems[2].Text
}).ToList();
RearTaskRun(lvItems);
return;
}
OvercheckTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
base.startBtn.Text = "正在停止";
base.startBtn.ForeColor = Color.Red;
});
}
}
private void RearTaskRun(List<AppleAcount> lvItems)
{
int id = 41;
int count = lvItems.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(41).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
return;
}
ConfigUtlis.saveConfigKey("ckOvercheckVpn", ckOvercheckVpn.Checked.ToString());
NationalList nationalList = ComCountrySelectList.SelectedItem as NationalList;
PaymentInfo payment = null;
if (nationalList != null)
{
payment = nationalList.payment;
}
btnOvercheckStart.Tag = base.listData.Items.Cast<ListViewItem>().ToList();
OvercheckTask.Instance.ExecuteLeaveFamily(2, ckOvercheckVpn.Checked, lvItems, payment, base.startAct, base.endTakAct, sucessAct, _action);
}
public void sucessAct(string AppleId)
{
UpdataUi(delegate
{
if (btnOvercheckStart.Tag == null)
{
btnOvercheckStart.Tag = base.listData.Items.Cast<ListViewItem>().ToList();
}
ListViewItem listViewItem = (btnOvercheckStart.Tag as List<ListViewItem>).Where((ListViewItem c) => c.SubItems[1].Text == AppleId).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "overcheck" },
{
"addTime",
Tools.GenerateTimeStamp().ToString()
},
{
"value1",
listViewItem.SubItems[1].Text
},
{
"value2",
listViewItem.SubItems[2].Text
},
{
"value3",
listViewItem.SubItems[3].Text
},
{
"value4",
listViewItem.SubItems[4].Text
},
{
"value5",
listViewItem.SubItems[5].Text
}
});
}
});
}
public void _action(string key, DisplyType type, string reust)
{
UpdataUi(delegate
{
if (btnOvercheckStart.Tag == null)
{
btnOvercheckStart.Tag = base.listData.Items.Cast<ListViewItem>().ToList();
}
IEnumerable<ListViewItem> enumerable = (btnOvercheckStart.Tag as List<ListViewItem>).Where((ListViewItem c) => c.SubItems[1].Text == key);
Font font = new Font(Font, FontStyle.Bold);
foreach (ListViewItem item in enumerable)
{
switch (type)
{
case DisplyType.forbidden:
item.SubItems[4].Text = reust;
item.SubItems[4].Font = font;
item.SubItems[4].ForeColor = Color.Green;
break;
case DisplyType.xinxi:
item.SubItems[5].Text = reust;
break;
case DisplyType.error:
item.SubItems[4].Text = reust;
item.SubItems[4].Font = font;
item.SubItems[4].ForeColor = Color.Red;
break;
case DisplyType.chongzhi:
item.SubItems[3].Text = reust;
item.SubItems[4].Text = reust;
item.SubItems[4].Text = reust;
item.SubItems[4].ForeColor = Color.Black;
break;
case DisplyType.area:
item.SubItems[3].Text = reust;
break;
}
}
});
}
private void btnLeaveFamilyInput_Click(object sender, EventArgs e)
{
FromInputAcount fromInputAcount = new FromInputAcount();
fromInputAcount.tipMssage = textBox2.Text;
fromInputAcount.isOpenSysVpn = ckOvercheckVpn.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> list = AppleUtlis.accountInput(fromInputAcount.StrInput);
int num = 0;
base.listData.ListViewItemSorter = new ListViewItemComparer(0, 1);
base.listData.Sort();
if (base.listData.Items.Count > 0 && int.TryParse(base.listData.Items[base.listData.Items.Count - 1].SubItems[0].Text, out var result))
{
num = result;
}
List<ListViewItem> list2 = new List<ListViewItem>();
foreach (AppleAcount item in list)
{
num++;
ListViewItem listViewItem = new ListViewItem(num.ToString());
listViewItem.UseItemStyleForSubItems = false;
listViewItem.SubItems.Add(item.appleId);
listViewItem.SubItems.Add(item.applePwd);
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
listViewItem.SubItems.Add("-");
list2.Add(listViewItem);
}
base.listData.Items.AddRange(list2.ToArray());
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnLiteClre_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
base.listData.Items.Clear();
}
base.labCout.Text = string.Concat(base.listData.Items.Count);
}
private void btnLeaveFamilyExper_Click(object sender, EventArgs e)
{
ExperList(base.listData);
}
public override void TwoFactorItem_over_Click(string reust)
{
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text,
isDoubleModl = true,
DoublePwd = reust
});
}
RearTaskRun(list);
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (OvercheckTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text
});
}
RearTaskRun(list);
}
private void btnLeaveFamilyQuery_Click(object sender, EventArgs e)
{
FromDBDataQuery fromDBDataQuery = new FromDBDataQuery();
fromDBDataQuery.sqlTitle = new Dictionary<string, string>
{
{ "value1", "账号|180" },
{ "value2", "密码|100" },
{ "value3", "国家|80" },
{ "value4", "状态|100" },
{ "value5", "信息|150" }
};
fromDBDataQuery.type = "overcheck";
fromDBDataQuery.typeName = "AppStore过检记录";
fromDBDataQuery.Show();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.ComCountrySelectList = new System.Windows.Forms.ComboBox();
this.label63 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.ckOvercheckVpn = new System.Windows.Forms.CheckBox();
this.labOvercheckInter = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.labOvercheckCount = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnOvercheckLiteClre = new System.Windows.Forms.Button();
this.btnOvercheckQuery = new System.Windows.Forms.Button();
this.btnOvercheckInput = new System.Windows.Forms.Button();
this.btnOvercheckExper = new System.Windows.Forms.Button();
this.btnOvercheckStart = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.listOvercheck = new AppleBatch_June.Views.DoubleBufferListView();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader14 = new System.Windows.Forms.ColumnHeader();
this.groupBox9.SuspendLayout();
this.groupBox10.SuspendLayout();
this.groupBox12.SuspendLayout();
base.SuspendLayout();
this.groupBox9.Controls.Add(this.ComCountrySelectList);
this.groupBox9.Controls.Add(this.label63);
this.groupBox9.Controls.Add(this.label1);
this.groupBox9.Controls.Add(this.textBox2);
this.groupBox9.Controls.Add(this.ckOvercheckVpn);
this.groupBox9.Controls.Add(this.labOvercheckInter);
this.groupBox9.Controls.Add(this.label10);
this.groupBox9.Controls.Add(this.label13);
this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox9.Location = new System.Drawing.Point(455, 12);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(510, 126);
this.groupBox9.TabIndex = 20;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "AppStore检查 功能说明";
this.ComCountrySelectList.FormattingEnabled = true;
this.ComCountrySelectList.Location = new System.Drawing.Point(99, 55);
this.ComCountrySelectList.Name = "ComCountrySelectList";
this.ComCountrySelectList.Size = new System.Drawing.Size(158, 25);
this.ComCountrySelectList.TabIndex = 14;
this.label63.AutoSize = true;
this.label63.Location = new System.Drawing.Point(13, 59);
this.label63.Name = "label63";
this.label63.Size = new System.Drawing.Size(80, 17);
this.label63.TabIndex = 13;
this.label63.Text = "指定过检国家";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(271, 59);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(188, 17);
this.label1.TabIndex = 12;
this.label1.Text = "不指定国家则使用账号默认的国家";
this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox2.Location = new System.Drawing.Point(265, 91);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(238, 23);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "导入格式xxx@xx.com----密码";
this.ckOvercheckVpn.AutoSize = true;
this.ckOvercheckVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckOvercheckVpn.ForeColor = System.Drawing.Color.Red;
this.ckOvercheckVpn.Location = new System.Drawing.Point(18, 95);
this.ckOvercheckVpn.Name = "ckOvercheckVpn";
this.ckOvercheckVpn.Size = new System.Drawing.Size(111, 21);
this.ckOvercheckVpn.TabIndex = 10;
this.ckOvercheckVpn.Text = "使用随机IP代理";
this.ckOvercheckVpn.UseVisualStyleBackColor = true;
this.labOvercheckInter.AutoSize = true;
this.labOvercheckInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labOvercheckInter.ForeColor = System.Drawing.Color.Crimson;
this.labOvercheckInter.Location = new System.Drawing.Point(223, 96);
this.labOvercheckInter.Name = "labOvercheckInter";
this.labOvercheckInter.Size = new System.Drawing.Size(18, 19);
this.labOvercheckInter.TabIndex = 2;
this.labOvercheckInter.Text = "0";
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(135, 97);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(92, 17);
this.label10.TabIndex = 1;
this.label10.Text = "查询消耗点数:";
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(10, 27);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(475, 17);
this.label13.TabIndex = 0;
this.label13.Text = "启用之后可以正常使用 AppStore 和 iTunes 功能,无需过检账号和需要补资料扣 {0} 点\r\n";
this.groupBox10.Controls.Add(this.labOvercheckCount);
this.groupBox10.Controls.Add(this.label16);
this.groupBox10.Controls.Add(this.btnOvercheckLiteClre);
this.groupBox10.Controls.Add(this.btnOvercheckQuery);
this.groupBox10.Controls.Add(this.btnOvercheckInput);
this.groupBox10.Controls.Add(this.btnOvercheckExper);
this.groupBox10.Controls.Add(this.btnOvercheckStart);
this.groupBox10.Location = new System.Drawing.Point(12, 12);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(437, 126);
this.groupBox10.TabIndex = 19;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "操作";
this.labOvercheckCount.AutoSize = true;
this.labOvercheckCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labOvercheckCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labOvercheckCount.Location = new System.Drawing.Point(282, 15);
this.labOvercheckCount.Name = "labOvercheckCount";
this.labOvercheckCount.Size = new System.Drawing.Size(15, 17);
this.labOvercheckCount.TabIndex = 7;
this.labOvercheckCount.Text = "0";
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label16.Location = new System.Drawing.Point(179, 16);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(95, 17);
this.label16.TabIndex = 6;
this.label16.Text = "列表中账号数量:";
this.btnOvercheckLiteClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnOvercheckLiteClre.Location = new System.Drawing.Point(325, 75);
this.btnOvercheckLiteClre.Name = "btnOvercheckLiteClre";
this.btnOvercheckLiteClre.Size = new System.Drawing.Size(96, 23);
this.btnOvercheckLiteClre.TabIndex = 5;
this.btnOvercheckLiteClre.Text = "清空账号列表";
this.btnOvercheckLiteClre.UseVisualStyleBackColor = true;
this.btnOvercheckLiteClre.Click += new System.EventHandler(btnLiteClre_Click);
this.btnOvercheckQuery.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnOvercheckQuery.Location = new System.Drawing.Point(179, 42);
this.btnOvercheckQuery.Name = "btnOvercheckQuery";
this.btnOvercheckQuery.Size = new System.Drawing.Size(140, 23);
this.btnOvercheckQuery.TabIndex = 4;
this.btnOvercheckQuery.Text = "账号过检记录";
this.btnOvercheckQuery.UseVisualStyleBackColor = true;
this.btnOvercheckQuery.Click += new System.EventHandler(btnLeaveFamilyQuery_Click);
this.btnOvercheckInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnOvercheckInput.Location = new System.Drawing.Point(179, 76);
this.btnOvercheckInput.Name = "btnOvercheckInput";
this.btnOvercheckInput.Size = new System.Drawing.Size(140, 23);
this.btnOvercheckInput.TabIndex = 3;
this.btnOvercheckInput.Text = "账号输入";
this.btnOvercheckInput.UseVisualStyleBackColor = true;
this.btnOvercheckInput.Click += new System.EventHandler(btnLeaveFamilyInput_Click);
this.btnOvercheckExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnOvercheckExper.Location = new System.Drawing.Point(325, 42);
this.btnOvercheckExper.Name = "btnOvercheckExper";
this.btnOvercheckExper.Size = new System.Drawing.Size(96, 23);
this.btnOvercheckExper.TabIndex = 2;
this.btnOvercheckExper.Text = "导出账号";
this.btnOvercheckExper.UseVisualStyleBackColor = true;
this.btnOvercheckExper.Click += new System.EventHandler(btnLeaveFamilyExper_Click);
this.btnOvercheckStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnOvercheckStart.ForeColor = System.Drawing.Color.Green;
this.btnOvercheckStart.Location = new System.Drawing.Point(18, 33);
this.btnOvercheckStart.Name = "btnOvercheckStart";
this.btnOvercheckStart.Size = new System.Drawing.Size(110, 65);
this.btnOvercheckStart.TabIndex = 1;
this.btnOvercheckStart.Text = "开始执行";
this.btnOvercheckStart.UseVisualStyleBackColor = true;
this.btnOvercheckStart.Click += new System.EventHandler(btnLeaveFamilyStart_Click);
this.groupBox12.Controls.Add(this.listOvercheck);
this.groupBox12.Location = new System.Drawing.Point(9, 144);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(956, 408);
this.groupBox12.TabIndex = 18;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "Apple账号列表";
this.listOvercheck.Columns.AddRange(new System.Windows.Forms.ColumnHeader[6] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader3, this.columnHeader1, this.columnHeader14 });
this.listOvercheck.Dock = System.Windows.Forms.DockStyle.Fill;
this.listOvercheck.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.listOvercheck.FullRowSelect = true;
this.listOvercheck.HideSelection = false;
this.listOvercheck.Location = new System.Drawing.Point(3, 17);
this.listOvercheck.Name = "listOvercheck";
this.listOvercheck.Size = new System.Drawing.Size(950, 388);
this.listOvercheck.TabIndex = 0;
this.listOvercheck.UseCompatibleStateImageBehavior = false;
this.listOvercheck.View = System.Windows.Forms.View.Details;
this.columnHeader8.Text = "序号";
this.columnHeader9.Text = "账号";
this.columnHeader9.Width = 150;
this.columnHeader10.Text = "密码";
this.columnHeader10.Width = 100;
this.columnHeader3.Text = "国家";
this.columnHeader3.Width = 100;
this.columnHeader1.Text = "状态";
this.columnHeader1.Width = 100;
this.columnHeader14.Text = "信息";
this.columnHeader14.Width = 350;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(977, 561);
base.Controls.Add(this.groupBox9);
base.Controls.Add(this.groupBox10);
base.Controls.Add(this.groupBox12);
base.MaximizeBox = false;
base.Name = "FromOvercheck";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AppStore 检查-过检";
base.Load += new System.EventHandler(FromLeaveFamily_Load);
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.groupBox12.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
namespace AppleBatch_June.Interfaces
{
public interface IAccountDisabled
{
bool accountCheck(string account, string pwd, string notityKey);
}
}

View File

@@ -0,0 +1,43 @@
using System;
using AppleBatch_June.AppleWebServace;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
namespace AppleBatch_June.Interfaces
{
public class WebAccountDisabled : IAccountDisabled
{
private Action<string, DisplyType, string> action;
private Action<string, DisplyType, string> applyAtion;
private bool _openVpn;
public ITaskRunState taskState;
public WebAccountDisabled(bool openVpn, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, ITaskRunState _taskState)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
_openVpn = openVpn;
action = _action;
applyAtion = _applyAtion;
}
public bool accountCheck(string account, string pwd, string notityKey)
{
if (AppSysConfig.webProtocolS2k)
{
return new AppleReportaproblemWeb(_openVpn, action, applyAtion, taskState)
{
ProxyIp = ProxyAccountCache.getProxyAccountIP(account)
}.checkDisable(account, pwd, notityKey);
}
AppleManageWebUtlis appleManageWebUtlis = new AppleManageWebUtlis(action, applyAtion, taskState);
appleManageWebUtlis.ProxyIp = ProxyAccountCache.getProxyAccountIP(account);
bool result = appleManageWebUtlis.checkDisable(_openVpn, account, pwd, notityKey);
appleManageWebUtlis.reportSingOut();
return result;
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Utils;
namespace AppleBatch_June.Interfaces
{
public class iTunesAccountDisabled : IAccountDisabled
{
private Action<string, DisplyType, string> action;
private Action<string, DisplyType, string> applyAtion;
public ITaskRunState taskState;
private bool openVpn { get; set; }
public iTunesAccountDisabled(bool _openVpn, Action<string, DisplyType, string> _action, Action<string, DisplyType, string> _applyAtion, ITaskRunState _taskState)
{
taskState = _taskState ?? throw new Exception("任务运行状态不能是空的");
openVpn = _openVpn;
action = _action;
applyAtion = _applyAtion;
}
public bool accountCheck(string account, string pwd, string notityKey)
{
ItunesUtlis itunesUtlis = new ItunesUtlis(taskState, notityKey, action, openVpn);
string msgReust = "";
if (string.IsNullOrEmpty(itunesUtlis.ProxyIp))
{
itunesUtlis.ProxyIp = ProxyAccountCache.getProxyAccountIP(account);
}
AppleItunesLogin appleItunesLogin = null;
appleItunesLogin = ((!AppSysConfig.iTunesisRemoteLogin) ? itunesUtlis.appleLogin(account, pwd, 1, ref msgReust, out var _) : itunesUtlis.remoteAppleLogin(account, pwd, ref msgReust));
if (appleItunesLogin == null)
{
action?.Invoke(notityKey, DisplyType.xinxi, msgReust);
return false;
}
action?.Invoke(notityKey, DisplyType.area, appleItunesLogin.Area.ToString());
action?.Invoke(notityKey, DisplyType.xinxi, "登录完成,正在检测");
DisplyState displyState = ((!(appleItunesLogin.isDisabledAccount.ToLower() == "true")) ? DisplyState.None : DisplyState.Disply);
action?.Invoke(notityKey, DisplyType.xinxi, "查询完成");
switch (displyState)
{
default:
return false;
case DisplyState.Disply:
applyAtion?.Invoke(notityKey, DisplyType.forbidden, "禁用");
return true;
case DisplyState.None:
applyAtion?.Invoke(notityKey, DisplyType.normal, "正常");
return true;
case DisplyState.Unknown:
action?.Invoke(notityKey, DisplyType.xinxi, "未知异常,请重新检测");
return true;
}
}
}
}

View File

@@ -0,0 +1,38 @@
namespace AppleBatch_June.Login
{
public enum iTunesDownloadErrorState
{
AgeMustLarge17Charge = 10,
AgeMustLarge17Free = 9,
AppleIdDisable = 18,
CannotPurchase = 11,
CannotVerification = 16,
Charge = 5,
ChargeMoney2AppleID = 23,
CreditBalanceHasExpired = 26,
FailedAuthorize = 12,
GetMoreDownloadItemOverTime = 24,
iTunesAskThreeQuestions = 25,
iTunesCannotAnalyseVersion = 8,
iTunesLowVersion = 7,
LoginException = 6,
LoginInOtherStore = 14,
LoginiTunesDisable = 21,
LoginiTunesVertify = 20,
NeedSecurityCode = 19,
NeedToLogin = 15,
Nomal = -2,
NotBindingCredit = 17,
NotContainItemId = 3,
NotLogin = 2,
Purchased = 13,
SecurityChanging = 22,
Succeed = 1,
UnKnow = 0,
Waiting = -1,
WebCannotAnalyse = 4,
Supplyhasbeenstopped = 28,
Downloaded = 27,
BeenLocked = -9999
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Net;
namespace AppleBatch_June.Login
{
public class iTunesUserInfo
{
private DateTime dateTime_0 = DateTime.Now;
private Dictionary<string, string> waitingDownloadMedataDict = new Dictionary<string, string>();
public iTunesDownloadErrorState State;
public string siv = string.Empty;
public CookieContainer PcookieContainer = new CookieContainer();
public string Area { get; set; } = string.Empty;
public string Balance { get; set; }
public string Boundary { get; set; }
public string Credit { get; set; }
public string Dsid { get; set; }
public string Guid { get; set; }
public bool IsAreaChanged { get; set; }
public string Country { get; set; }
public string Kbsync { get; set; }
public string MachineName { get; set; }
public string Password { get; set; }
public string PasswordToken { get; set; }
public string PlistContent { get; set; } = string.Empty;
public string PurchedMedata { get; set; } = string.Empty;
public string ServerId { get; set; } = "20";
public string StoredDescrption { get; set; } = string.Empty;
public string UserAgent { get; set; }
public int UserId { get; set; }
public string UserName { get; set; }
public string PRH { get; set; }
public Dictionary<string, string> WaitingDownloadMedataDict
{
get
{
try
{
if (DateTime.Now.Subtract(dateTime_0).TotalHours > 48.0)
{
waitingDownloadMedataDict.Clear();
}
}
catch
{
}
return waitingDownloadMedataDict;
}
set
{
dateTime_0 = DateTime.Now;
waitingDownloadMedataDict = value;
}
}
}
}

View File

@@ -0,0 +1,29 @@
using System;
using AppleBatch_June.SMS;
namespace AppleBatch_June.Model
{
public class ActiotiCloudConfig
{
public Func<string, int, string> actGetCode;
public bool isOpenAuthAction { get; set; }
public ISms smsService { get; set; }
public string smsCountry { get; set; } = "CN";
public int getSmsMsgMaxCount { get; set; } = 30;
public string ActivaNewPwd { get; set; } = "";
public string ActivaStandbyPwd { get; set; } = "";
public int openNumber { get; set; } = 5;
}
}

View File

@@ -0,0 +1,19 @@
namespace AppleBatch_June.Model
{
public class AddFamilyMemberPostModel
{
public string appleId { get; set; }
public string password { get; set; }
public string appleIdForPurchases { get; set; }
public bool shareMyLocationEnabledDefault { get; set; }
public bool shareMyPurchasesEnabledDefault { get; set; }
public string verificationToken { get; set; }
public string preferredAppleId { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace AppleBatch_June.Model
{
public class AddPaymentCardType
{
public string cardType { get; set; }
public string cardName { get; set; }
public int status { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace AppleBatch_June.Model
{
public class AothQuestions
{
public class Question
{
public int id { get; set; }
public string question { get; set; }
public int number { get; set; }
public string answer { get; set; }
}
public Question[] questions { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
namespace AppleBatch_June.Model
{
public class AppleChangeItem
{
public string newPwd { get; set; }
public string newQt1 { get; set; }
public string newQt2 { get; set; }
public string newQt3 { get; set; }
public string newshengri { get; set; }
public string newGuojia { get; set; }
public PaymentInfo pay { get; set; }
public string editAddrs { get; set; }
public bool isDeleteDevice { get; set; }
public bool isUnlinkFamily { get; set; }
public bool isRemoveRescueEmail { get; set; }
public string countryCode { get; set; } = "";
public string mode { get; set; } = "";
public bool CreatePin { get; set; }
public bool ckShippingAddress { get; set; }
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
namespace AppleBatch_June.Model
{
public class AppleItunesLogin
{
public string timeCheck = DateTime.Now.ToString("yyMMddHHmm");
public int timeCheckCount;
private string areaName;
private string kbsync;
public string reddemQts { get; set; } = "";
public string account { get; set; }
public string pwd { get; set; }
public string msg { get; set; }
public string StdndbyKeyGuid { get; set; } = "";
public DateTime LoginTime { get; set; } = DateTime.Now;
public string Balance { get; set; }
public string UserAgent { get; set; }
public string Area
{
get
{
return areaName;
}
set
{
areaName = AppleUtlis.GetAreaByArea(value);
AreaCode = AppleUtlis.GetCountryCodeByArea(value);
}
}
public string AreaCode { get; private set; }
public Dictionary<string, string> cookis { get; set; }
public string xtoken { get; set; }
public string dsis { get; set; }
public string ServerId { get; set; }
public string software { get; set; }
public string isDisabledAccount { get; set; }
public string extension { get; set; } = "";
public string oldUserAgent { get; set; } = "";
public string Guid { get; set; }
public int serverIndex { get; set; } = -1;
public string nextServerId { get; set; } = "0";
public string proxyIp { get; set; } = "";
public string Kbsync
{
get
{
string text = "";
for (int i = 0; i < kbsync.Length; i++)
{
if (i % 68 == 0)
{
text += "\n";
}
text += kbsync[i];
}
return kbsync;
}
set
{
kbsync = value;
}
}
}
}

View File

@@ -0,0 +1,43 @@
using System.Net;
namespace AppleBatch_June.Model
{
public class AppleUserInfo
{
public CookieContainer PcookieContainer = new CookieContainer();
private string userAgent;
public string AppleId { get; set; }
public string ApplePwd { get; set; }
public string AppleQt1 { get; set; }
public string AppleQt2 { get; set; }
public string AppleQt3 { get; set; }
public string UserAgent
{
get
{
if (!string.IsNullOrEmpty(userAgent))
{
return userAgent;
}
userAgent = AppleUtlis.getAppleWenUserAgent();
return userAgent;
}
set
{
userAgent = value;
}
}
public string Birthday { get; set; }
public string Area { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,31 @@
using System;
namespace AppleBatch_June.Model
{
public class AppleiCloundLogin
{
public string timeCheck = DateTime.Now.ToString("yyMMddHHmm");
public int timeCheckCount;
public string StdndbyKeyGuid { get; set; } = "";
public DateTime LoginTime { get; } = DateTime.Now;
public string account { get; set; }
public string pwd { get; set; }
public string dsid { get; set; }
public string mmeAuthToken { get; set; }
public string userAgent { get; set; }
public string clientInfo { get; set; }
public string Area { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
namespace AppleBatch_June.Model
{
public class AreaRequestModel
{
public int state { get; set; }
public string msg { get; set; } = "";
public string balance { get; set; } = "";
public string Area { get; set; } = "";
public string isDisabledAccount { get; set; } = "";
public string extension { get; set; } = "";
public string ServerId { get; set; } = "";
public AreaRequestModel Init(int _state, string _msg)
{
state = _state;
msg = _msg;
return this;
}
}
}

View File

@@ -0,0 +1,18 @@
namespace AppleBatch_June.Model
{
public class AvailableSecurityQuestions
{
public class Availablesecurityquestion
{
public int id { get; set; }
public string question { get; set; }
public int number { get; set; }
public bool userDefined { get; set; }
}
public Availablesecurityquestion[][] availableSecurityQuestions { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace AppleBatch_June.Model
{
public class BaseModel
{
public string Code { get; set; }
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace AppleBatch_June.Model
{
public class ConfigModel : BaseModel
{
public Data Data { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
namespace AppleBatch_June.Model
{
public class CountryCodeModel
{
public string name { get; set; }
public string area { get; set; }
public string description { get; set; }
public string code { get; set; }
public string id { get; set; }
public string displayName { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace AppleBatch_June.Model
{
public class CreateFamilyPostModel
{
public string organizerAppleId { get; set; }
public string organizerAppleIdForPurchases { get; set; }
public string organizerAppleIdForPurchasesPassword { get; set; }
public bool organizerShareMyLocationEnabledDefault { get; set; }
public int iTunesTosVersion { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace AppleBatch_June.Model
{
public class Data
{
public Listtype[] listTypes { get; set; }
public Listconfig[] listConfig { get; set; }
}
}

View File

@@ -0,0 +1,349 @@
namespace AppleBatch_June.Model
{
public class DeleteDeviceReust
{
public class Removeddevice
{
public string listImageLocation { get; set; }
public string listImageLocation2x { get; set; }
public string listImageLocation3x { get; set; }
public string infoboxImageLocation { get; set; }
public string infoboxImageLocation2x { get; set; }
public string infoboxImageLocation3x { get; set; }
public bool currentDevice { get; set; }
public bool removalPending { get; set; }
public string deviceDetailHttpMethod { get; set; }
public string deviceDetailUri { get; set; }
public Dateformatter dateFormatter { get; set; }
public Timeformatter timeFormatter { get; set; }
public bool iCloudDevice { get; set; }
public bool applePayCardRemovalPending { get; set; }
public bool suppressChangePasswordLink { get; set; }
public bool showBackupStatus { get; set; }
public bool showSerialNumber { get; set; }
public bool allowRemoval { get; set; }
public bool fmipCapable { get; set; }
public bool backupCapable { get; set; }
public string os { get; set; }
public bool trustedDevice { get; set; }
public string osAndVersion { get; set; }
public bool accountSupportsVerificationCodes { get; set; }
public bool supportsVerificationCodes { get; set; }
public bool pushDevice { get; set; }
public bool hasApplePayCards { get; set; }
public bool hasActiveSurfAccount { get; set; }
public string deviceClass { get; set; }
public bool primary { get; set; }
public bool fmipEnabled { get; set; }
public bool secondary { get; set; }
public string modelName { get; set; }
public string osVersion { get; set; }
public bool untrusted { get; set; }
public string name { get; set; }
public string id { get; set; }
public string type { get; set; }
}
public class Dateformatter
{
public string locale { get; set; }
public Decimalstyle decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone zone { get; set; }
public Chronology chronology { get; set; }
}
public class Decimalstyle
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules rules { get; set; }
}
public class Rules
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Timeformatter
{
public string locale { get; set; }
public Decimalstyle1 decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone1 zone { get; set; }
}
public class Decimalstyle1
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone1
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules1 rules { get; set; }
}
public class Rules1
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Device
{
public string listImageLocation { get; set; }
public string listImageLocation2x { get; set; }
public string listImageLocation3x { get; set; }
public string infoboxImageLocation { get; set; }
public string infoboxImageLocation2x { get; set; }
public string infoboxImageLocation3x { get; set; }
public bool currentDevice { get; set; }
public bool removalPending { get; set; }
public string deviceDetailHttpMethod { get; set; }
public string deviceDetailUri { get; set; }
public Dateformatter1 dateFormatter { get; set; }
public Timeformatter1 timeFormatter { get; set; }
public bool iCloudDevice { get; set; }
public bool applePayCardRemovalPending { get; set; }
public bool suppressChangePasswordLink { get; set; }
public bool showBackupStatus { get; set; }
public bool showSerialNumber { get; set; }
public bool allowRemoval { get; set; }
public bool fmipCapable { get; set; }
public bool backupCapable { get; set; }
public string os { get; set; }
public bool trustedDevice { get; set; }
public string osAndVersion { get; set; }
public bool accountSupportsVerificationCodes { get; set; }
public bool supportsVerificationCodes { get; set; }
public bool pushDevice { get; set; }
public bool hasApplePayCards { get; set; }
public bool hasActiveSurfAccount { get; set; }
public string deviceClass { get; set; }
public bool primary { get; set; }
public bool fmipEnabled { get; set; }
public bool secondary { get; set; }
public string modelName { get; set; }
public string osVersion { get; set; }
public bool untrusted { get; set; }
public string name { get; set; }
public string id { get; set; }
public string type { get; set; }
}
public class Dateformatter1
{
public string locale { get; set; }
public Decimalstyle2 decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone2 zone { get; set; }
public Chronology1 chronology { get; set; }
}
public class Decimalstyle2
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone2
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules2 rules { get; set; }
}
public class Rules2
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology1
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Timeformatter1
{
public string locale { get; set; }
public Decimalstyle3 decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone3 zone { get; set; }
}
public class Decimalstyle3
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone3
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules3 rules { get; set; }
}
public class Rules3
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public Device[] devices { get; set; }
public string hsa2SignedInDevicesLink { get; set; }
public Removeddevice removedDevice { get; set; }
public bool suppressChangePasswordLink { get; set; }
}
}

View File

@@ -0,0 +1,96 @@
namespace AppleBatch_June.Model
{
public class DevicesInfo
{
public class Dateformatter
{
public string locale { get; set; }
public Decimalstyle decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone zone { get; set; }
public Chronology chronology { get; set; }
}
public class Decimalstyle
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules rules { get; set; }
}
public class Rules
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Timeformatter
{
public string locale { get; set; }
public Decimalstyle1 decimalStyle { get; set; }
public string resolverStyle { get; set; }
public Zone1 zone { get; set; }
}
public class Decimalstyle1
{
public string zeroDigit { get; set; }
public string positiveSign { get; set; }
public string negativeSign { get; set; }
public string decimalSeparator { get; set; }
}
public class Zone1
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules1 rules { get; set; }
}
public class Rules1
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public bool allowRemoval { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
namespace AppleBatch_June.Model
{
public enum DisplyType
{
newAccount,
mima,
qt1,
qt2,
qt3,
shengri,
guojia,
xinxi,
forbidden,
normal,
xiaofeiriqi,
xiaofeiriqiNow,
xiaofeijine,
lostBillNo,
area,
reddemLose,
reddemValid,
reddemUNlock,
gameSuccess,
gameFire,
gameCount,
chongzhi,
balance,
error,
init,
bindMoblie
}
}

View File

@@ -0,0 +1,48 @@
namespace AppleBatch_June.Model
{
public class FamilyMembers
{
public class Family
{
public string familyId { get; set; }
public string organizerDsid { get; set; }
}
public class Activefamilyservice
{
public string id { get; set; }
public string icon { get; set; }
public string displayLabel { get; set; }
public bool isSubscription { get; set; }
}
public class Familymember
{
public string dsid { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public string fullName { get; set; }
}
public string currentDsid { get; set; }
public string currentUserAppleId { get; set; }
public Activefamilyservice[] activeFamilyServices { get; set; }
public Family family { get; set; }
public Familymember[] familyMembers { get; set; }
public bool isLinkedToFamily { get; set; }
public bool isMemberOfFamily { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using System;
namespace AppleBatch_June.Model
{
public class GetIpProxyModel
{
public class ProxyModel
{
public string proxyIp { get; set; }
public DateTime expireTime { get; set; }
}
public string Code { get; set; }
public string Message { get; set; }
public ProxyModel[] Data { get; set; }
public int serverIndex { get; set; }
public string extend { get; set; }
public string authenUserInfo { get; set; }
public string platformName { get; set; }
}
}

View File

@@ -0,0 +1,123 @@
namespace AppleBatch_June.Model
{
public class GiftcardBalanceModel
{
public class Head
{
public int status { get; set; }
}
public class Body
{
public Meta meta { get; set; }
public Giftcardbalancecheck giftCardBalanceCheck { get; set; }
}
public class Meta
{
public string[] l { get; set; }
public H h { get; set; }
}
public class H
{
public string syntax { get; set; }
public string xaosmodelpage { get; set; }
public string modelVersion { get; set; }
public string xaosstk { get; set; }
}
public class Giftcardbalancecheck
{
public D d { get; set; }
public B b { get; set; }
public T t { get; set; }
}
public class D
{
public string buyUrl { get; set; }
public string maxAttemptReachedError { get; set; }
public string shopStoreUrl { get; set; }
public string checkBalanceUrl { get; set; }
public string balance { get; set; }
public bool localNavEnabled { get; set; }
public Localnav[] localNav { get; set; }
public bool showBalanceCheckResult { get; set; }
public bool maxAttemptReached { get; set; }
public string giftCardNumber { get; set; }
public string[] alertMessages { get; set; }
}
public class Localnav
{
public string url { get; set; }
public string label { get; set; }
public bool isDisabled { get; set; }
}
public class B
{
public Successcheck successCheck { get; set; }
}
public class Successcheck
{
public string id { get; set; }
public Event[] events { get; set; }
}
public class Event
{
public string on { get; set; }
public string metric { get; set; }
}
public class T
{
public Applycheckbalance applyCheckBalance { get; set; }
}
public class Applycheckbalance
{
public Microevent[] microEvents { get; set; }
}
public class Microevent
{
public string key { get; set; }
public string value { get; set; }
public string feature { get; set; }
}
public string xxs { get; set; } = "";
public Head head { get; set; }
public Body body { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
namespace AppleBatch_June.Model
{
internal class IdToHint
{
}
}

View File

@@ -0,0 +1,14 @@
namespace AppleBatch_June.Model
{
public class IforgotVerifyPhoneModel
{
public class Trustedphone
{
public string number { get; set; }
}
public Trustedphone[] trustedPhones { get; set; }
public bool recoverable { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace AppleBatch_June.Model
{
public class IntervalCartModel
{
public string code { get; set; }
public string time { get; set; }
public int state { get; set; }
public string redeemMsg { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AppleBatch_June.Model
{
public class IntervalIdModel
{
public string appleId { get; set; }
public string applePwd { get; set; }
public int state { get; set; }
public string msg { get; set; }
public List<IntervalCartModel> intervalCarts { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace AppleBatch_June.Model
{
public class IpInfoModel
{
public string ip { get; set; }
public string country { get; set; }
public string isp { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace AppleBatch_June.Model
{
public class Listconfig
{
public int id { get; set; }
public string code { get; set; }
public string name { get; set; }
public string value { get; set; }
public DateTime addTime { get; set; }
public int state { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace AppleBatch_June.Model
{
public class Listtype
{
public int id { get; set; }
public string code { get; set; }
public string name { get; set; }
public DateTime addTime { get; set; }
public int state { get; set; }
public int consNum { get; set; }
}
}

View File

@@ -0,0 +1,466 @@
namespace AppleBatch_June.Model
{
public class LoginAppleInfo
{
public class Person
{
public Reachableatoptions reachableAtOptions { get; set; }
public Primaryaddress primaryAddress { get; set; }
public Name name { get; set; }
}
public class Reachableatoptions
{
public Primaryemailaddress primaryEmailAddress { get; set; }
}
public class Contactinformationoptions
{
public Option[] options { get; set; }
}
public class Option
{
public string type { get; set; }
}
public class Appleid
{
public string name { get; set; }
public string formattedAccountName { get; set; }
public string accountName { get; set; }
public bool editable { get; set; }
public string obfuscatedAppleId { get; set; }
public string domain { get; set; }
}
public class Primaryemailaddress
{
public object createdDate { get; set; }
}
public class Vettingstatus
{
public string type { get; set; }
public Updateddate updatedDate { get; set; }
public bool vetted { get; set; }
public bool pending { get; set; }
public bool notVetted { get; set; }
}
public class Updateddate
{
public Offset offset { get; set; }
public Zone zone { get; set; }
public int hour { get; set; }
public int minute { get; set; }
public int second { get; set; }
public int nano { get; set; }
public int year { get; set; }
public string month { get; set; }
public int dayOfMonth { get; set; }
public string dayOfWeek { get; set; }
public int dayOfYear { get; set; }
public int monthValue { get; set; }
public Chronology chronology { get; set; }
}
public class Offset
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules rules { get; set; }
}
public class Rules
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Zone
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules1 rules { get; set; }
}
public class Rules1
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Createddate
{
public Offset1 offset { get; set; }
public Zone1 zone { get; set; }
public int hour { get; set; }
public int minute { get; set; }
public int second { get; set; }
public int nano { get; set; }
public int year { get; set; }
public string month { get; set; }
public int dayOfMonth { get; set; }
public string dayOfWeek { get; set; }
public int dayOfYear { get; set; }
public int monthValue { get; set; }
public Chronology1 chronology { get; set; }
}
public class Offset1
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules2 rules { get; set; }
}
public class Rules2
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Zone1
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules3 rules { get; set; }
}
public class Rules3
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology1
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Updatedate
{
public Offset2 offset { get; set; }
public Zone2 zone { get; set; }
public int hour { get; set; }
public int minute { get; set; }
public int second { get; set; }
public int nano { get; set; }
public int year { get; set; }
public string month { get; set; }
public int dayOfMonth { get; set; }
public string dayOfWeek { get; set; }
public int dayOfYear { get; set; }
public int monthValue { get; set; }
public Chronology2 chronology { get; set; }
}
public class Offset2
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules4 rules { get; set; }
}
public class Rules4
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Zone2
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules5 rules { get; set; }
}
public class Rules5
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology2
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Primaryaddress
{
public string countryName { get; set; }
}
public class Stateprovince
{
public string code { get; set; }
public string name { get; set; }
}
public class Stateprovince1
{
public string code { get; set; }
public string name { get; set; }
}
public class Primaryemailaddress1
{
public int id { get; set; }
public string type { get; set; }
public string address { get; set; }
public string addressPrefix { get; set; }
public string addressSuffix { get; set; }
public Vettingstatus1 vettingStatus { get; set; }
public bool vetted { get; set; }
public bool isEmailSameAsAccountName { get; set; }
}
public class Vettingstatus1
{
public string type { get; set; }
public Updateddate1 updatedDate { get; set; }
public bool vetted { get; set; }
public bool pending { get; set; }
public bool notVetted { get; set; }
}
public class Updateddate1
{
public Offset3 offset { get; set; }
public Zone3 zone { get; set; }
public int hour { get; set; }
public int minute { get; set; }
public int second { get; set; }
public int nano { get; set; }
public int year { get; set; }
public string month { get; set; }
public int dayOfMonth { get; set; }
public string dayOfWeek { get; set; }
public int dayOfYear { get; set; }
public int monthValue { get; set; }
public Chronology3 chronology { get; set; }
}
public class Offset3
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules6 rules { get; set; }
}
public class Rules6
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Zone3
{
public int totalSeconds { get; set; }
public string id { get; set; }
public Rules7 rules { get; set; }
}
public class Rules7
{
public bool fixedOffset { get; set; }
public object[] transitions { get; set; }
public object[] transitionRules { get; set; }
}
public class Chronology3
{
public string calendarType { get; set; }
public string id { get; set; }
}
public class Name
{
public bool middleNameRequired { get; set; }
public string middleName { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
}
public class Security
{
public string birthday { get; set; }
public string rescueEmail { get; set; } = "";
}
public class Passwordpolicy
{
}
public class Question
{
public int number { get; set; }
public string question { get; set; }
public int id { get; set; }
}
public class Preferences
{
public string preferredLanguage { get; set; }
public Marketingpreferences marketingPreferences { get; set; }
public Privacypreferences privacyPreferences { get; set; }
}
public class Marketingpreferences
{
public bool appleUpdates { get; set; }
public bool iTunesUpdates { get; set; }
public bool appleNews { get; set; }
public bool appleMusic { get; set; }
}
public class Privacypreferences
{
public bool allowDeviceDiagnosticsAndUsage { get; set; }
public bool allowShareThirdPartyDevelopers { get; set; }
public bool allowICloudDataAnalytics { get; set; }
}
public Person person { get; set; }
public Security security { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace AppleBatch_June.Model
{
public class LoginErrorModel
{
public class Serviceerror
{
public string code { get; set; }
public string message { get; set; }
}
public Serviceerror[] serviceErrors { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More