iTunes 12.0 x64版本。QQ 9292 0 4200
private iTunesDownloadErrorState LoginApp(iTunesUserInfo appleAccountInfo_0)
{
iTunesDownloadErrorState succeed = iTunesDownloadErrorState.Succeed;
Dictionary<object, object> objPlist = new Dictionary<object, object>();
objPlist.Add("appleId", appleAccountInfo_0.UserName);
objPlist.Add("attempt", "1");
objPlist.Add("createSession", true);
objPlist.Add("guid", appleAccountInfo_0.Guid);
objPlist.Add("machineName", appleAccountInfo_0.MachineName);
objPlist.Add("password", appleAccountInfo_0.Password);
objPlist.Add("why", "signIn");
string s = tool.CreatePlistString(objPlist);
Label_0084:
appleAccountInfo_0.IsAreaChanged = false;
DateTime now = DateTime.Now;
while (DateTime.Now.Subtract(now).TotalSeconds < 120.0)
{
try
{
string str5 = string.Format("4caK9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6H3i4K6N6n7x3q4)9%4c8q4)9J5k6r3u0#2P5g2)9J5k6h3W2@1N6h3&6W2M7#2)9J5k6h3q4H3M7r3I4W2i4K6u0W2j5$3!0E0i4K6u0r3g2$3g2T1e0$3u0B7k6h3y4@1M7#2)9J5c8V1#2K9c8X3W2F1j5h3&6U0k6g2)9J5k6i4N6G2j5g2)9J5c8Y4N6S2i4K6u0r3j5i4g2@1K9r3g2F1N6r3W2U0j5i4c8W2", appleAccountInfo_0.ServerId);
string str6 = string.Format("c82K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6A6N6s2g2F1k6i4y4Q4x3X3g2S2M7s2m8D9k6g2)9J5k6h3y4G2L8g2)9J5c8W2N6W2j5V1!0T1K9X3g2U0N6s2y4Q4x3V1k6y4h3W2y4@1L8%4u0W2i4K6u0W2N6$3!0S2i4K6u0r3N6$3q4Q4x3V1k6$3K9h3g2%4c8%4u0G2N6i4m8A6L8X3N6Q4x3@1k6U0j5#2)9K6c8q4)9%4b7U0m8Q4y4@1c8Q4x3U0k6S2L8i4m8Q4x3@1u0E0N6q4)9K6c8o6R3`.", GetAreaByDescription(appleAccountInfo_0.StoredDescrption));
byte[] bytes = Encoding.UTF8.GetBytes(s);
string str7 = string.Empty;
if (NewLogin)
{
str7 = Convert.ToBase64String(this.GetSignsapsetupcertbyte(appleAccountInfo_0.StoredDescrption, bytes));
}
HttpWebRequest request = this.SetiTunesHtppHeaders(str5, bytes, str6, appleAccountInfo_0.StoredDescrption, str7,appleAccountInfo_0);
request.ContentType = "application/x-apple-plist";
string str8 = "";
string str9 = this.GetiTunesHtpp(request, ref str8, appleAccountInfo_0);
if (!string.IsNullOrEmpty(str9) && (str8 == ""))
{
//if (!appleAccountInfo_0.IsAreaChanged)
{
appleAccountInfo_0.PlistContent = str9;
}
request = null;
break;
}
appleAccountInfo_0.ServerId = this.GetServerId(str8);
request = null;
}
catch (Exception exception)
{
}
continue;
}
//if (appleAccountInfo_0.IsAreaChanged)
{
// goto Label_0084;
}
if (appleAccountInfo_0.PlistContent.Length == 0)
{
succeed = iTunesDownloadErrorState.WebCannotAnalyse;
}
else
{
//MessageBox.Show(appleAccountInfo_0.PlistContent);
string str3 = this.GetKeyValue("<key>failureType</key>", "<string>", "</string>", appleAccountInfo_0.PlistContent);
string str2 = this.GetKeyValue("<key>customerMessage</key>", "<string>", "</string>", appleAccountInfo_0.PlistContent);
if ((str2.Length <= 0) && (str3.Length <= 0))
{
if (str2.Length > 0)
{
if (str2.Contains("cfcK9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6A6k6X3!0J5k6$3!0@1i4K6u0W2j5i4m8H3L8r3g2Q4x3X3g2U0L8$3@1`."))
{
succeed = iTunesDownloadErrorState.LoginiTunesDisable;
}
else
{
succeed = iTunesDownloadErrorState.UnKnow;
}
}
//您的 Apple ID 或密码输入有误
else if ((str3.Length == 0) && (str2.Length == 0))
{
string str4 = this.GetKeyValue("<key>message</key>", "<string>", "</string>", appleAccountInfo_0.PlistContent);
if ((str4.Length > 0) && str4.StartsWith("This Apple ID is only valid for purchases"))
{
succeed = iTunesDownloadErrorState.LoginInOtherStore;
Nt.LoggerService.ULogger.Debug(appleAccountInfo_0.PlistContent);
}
}
}
else if (appleAccountInfo_0.PlistContent.IndexOf("或密码输入有误") > 0 || appleAccountInfo_0.PlistContent.IndexOf("Your Apple ID or password was entered incorrectly") > 0)
{
succeed = iTunesDownloadErrorState.LoginException;
//写放数据
/*
if (_errorLogin.InsertDbLogin(new errorLoginUser { userName = appleAccountInfo_0.UserName, pwd = appleAccountInfo_0.Password }) > 0)
{
Nt.LoggerService.ULogger.Debug(string.Format("********用户:{0}, 登录或密码错误, 数据已经写入数据库********", appleAccountInfo_0.UserName));
}
else
{
Nt.LoggerService.ULogger.Debug(string.Format("********用户:{0}, 登录或密码错误, 数据未写入数据库!********", appleAccountInfo_0.UserName));
}
*/
}
else if (appleAccountInfo_0.PlistContent.IndexOf("您的帐户已被禁用") > 0 && appleAccountInfo_0.PlistContent.IndexOf("以重新设置您的帐户") > 0)
{
succeed = iTunesDownloadErrorState.NeedSecurityCode;
}
else if (appleAccountInfo_0.PlistContent.IndexOf("您的帐户已被禁用") > 0)
{
succeed = iTunesDownloadErrorState.LoginiTunesDisable;
}
else if (appleAccountInfo_0.PlistContent.IndexOf("<key>failureType</key>") > 0)
{
succeed = iTunesDownloadErrorState.LoginiTunesDisable;
Nt.LoggerService.ULogger.Debug(appleAccountInfo_0.PlistContent);
}
else
{
succeed = iTunesDownloadErrorState.UnKnow;
}
}
return succeed;
}