Refactor variable names for clarity and consistency across multiple task files; update encryption methods to use Aes instead of RijndaelManaged.

This commit is contained in:
danial
2025-11-10 17:59:37 +08:00
parent cb905409f8
commit 7203d57370
17 changed files with 36 additions and 41 deletions

View File

@@ -2,7 +2,8 @@
"permissions": {
"allow": [
"Bash(find:*)",
"Bash(dotnet build:*)"
"Bash(dotnet build:*)",
"Bash(dotnet publish:*)"
],
"deny": [],
"ask": []

View File

@@ -83,7 +83,7 @@ namespace AppleBatch_June.ExecuteTasks
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
string accountName = "";
bool flag = false;
bool _flag = false;
AppleChangeItem changeItem2 = new AppleChangeItem
{
newGuojia = changeItem.newGuojia,

View File

@@ -77,7 +77,7 @@ namespace AppleBatch_June.ExecuteTasks
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(14).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
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, "关闭双重认证");

View File

@@ -94,7 +94,7 @@ namespace AppleBatch_June.ExecuteTasks
ckShippingAddress = ckShippingAddress
};
string accountName = "";
bool flag = false;
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);

View File

@@ -25,7 +25,7 @@ namespace AppleBatch_June.ExecuteTasks
private int passGetGameByUrl(bool ckQueryMOdel, GetGameUtils itunes, string gameUrl, AppleItunesLogin itunesLogin)
{
int num = 0;
int _num = 0;
if (ckQueryMOdel)
{
return itunes.getNewGameByUrl3(gameUrl, itunesLogin);

View File

@@ -82,7 +82,7 @@ namespace AppleBatch_June.ExecuteTasks
countryCode = countryCode,
mode = mode
};
bool flag = false;
bool _flag = false;
if ((!AppSysConfig.webProtocolS2k) ? new AppleManageWebUtlis(_action, null, this).OpenAuthen(appleAcount, new AppleChangeItem
{
countryCode = countryCode,

View File

@@ -77,7 +77,7 @@ namespace AppleBatch_June.ExecuteTasks
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(22).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
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, "密保查询余额");

View File

@@ -78,7 +78,7 @@ namespace AppleBatch_June.ExecuteTasks
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(12).consNum)
{
_action?.Invoke(guidTag, DisplyType.chongzhi, "");
bool flag = false;
bool _flag = false;
if ((!(AppSysConfig.webProtocolS2k || checkApple)) ? new AppleManageWebUtlis(_action, null, this)
{
CheckAppleId = checkApple

View File

@@ -76,7 +76,7 @@ namespace AppleBatch_June.ExecuteTasks
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(22).consNum)
{
_action?.Invoke(appleAcount.appleId, DisplyType.chongzhi, "");
bool flag = false;
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, "商城余额查询");

View File

@@ -38,7 +38,7 @@ namespace AppleBatch_June.Utils
array2[i] = (byte)palinData[i];
}
int length = palinData.Length;
using (SHA1 sHA = new SHA1CryptoServiceProvider())
using (SHA1 sHA = SHA1.Create())
{
do
{

View File

@@ -9,6 +9,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ApplicationIcon>app.ico</ApplicationIcon>
<RootNamespace />
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.0" />

View File

@@ -11,13 +11,7 @@ namespace AppleBatch_June
byte[] bytes = Encoding.UTF8.GetBytes(key);
byte[] bytes2 = Encoding.UTF8.GetBytes(iv);
byte[] bytes3 = Encoding.UTF8.GetBytes(toEncrypt);
byte[] array = new RijndaelManaged
{
Key = bytes,
IV = bytes2,
Mode = CipherMode.CBC,
Padding = PaddingMode.Zeros
}.CreateEncryptor().TransformFinalBlock(bytes3, 0, bytes3.Length);
byte[] array = Aes.Create().CreateEncryptor(bytes, bytes2).TransformFinalBlock(bytes3, 0, bytes3.Length);
return Convert.ToBase64String(array, 0, array.Length);
}
@@ -26,12 +20,12 @@ namespace AppleBatch_June
byte[] bytes = Encoding.UTF8.GetBytes(key);
byte[] bytes2 = Encoding.UTF8.GetBytes(iv);
byte[] array = Convert.FromBase64String(toDecrypt);
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Key = bytes;
rijndaelManaged.IV = bytes2;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = rijndaelManaged.CreateDecryptor();
using Aes aes = Aes.Create();
aes.Key = bytes;
aes.IV = bytes2;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = aes.CreateDecryptor();
byte[] bytes3 = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
return Encoding.UTF8.GetString(bytes3);
}

View File

@@ -73,7 +73,7 @@ namespace AppleBatch_June
}
ServicePointManager.DefaultConnectionLimit = 512;
ServicePointManager.Expect100Continue = false;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = (object sender2, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) => true;
try
{

View File

@@ -310,12 +310,12 @@ namespace AppleBatch_June
}
}
}
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Key = array2[0];
rijndaelManaged.IV = array2[1];
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = rijndaelManaged.CreateDecryptor();
using Aes aes = Aes.Create();
aes.Key = array2[0];
aes.IV = array2[1];
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = aes.CreateDecryptor();
byte[] byList = cryptoTransform.TransformFinalBlock(array3, 0, array3.Length);
Array.Clear(array2[0], 0, array2[0].Length);
Array.Clear(array2[1], 0, array2[1].Length);
@@ -330,12 +330,12 @@ namespace AppleBatch_June
public byte[] Decrypt(byte[] toEncryptArray, byte[] keyArray, byte[] ivArray)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Key = keyArray;
rijndaelManaged.IV = ivArray;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = rijndaelManaged.CreateDecryptor();
using Aes aes = Aes.Create();
aes.Key = keyArray;
aes.IV = ivArray;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.Zeros;
using ICryptoTransform cryptoTransform = aes.CreateDecryptor();
return cryptoTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
}

View File

@@ -1582,7 +1582,7 @@ namespace AppleBatch_June
comLoadAccounts.MouseWheel += ComLoadAccounts_MouseWheel;
ThreadPool.SetMinThreads(Tools.getTaskSize(openVpn: true, 1000) * 2, 5);
Text = Text + " 当前版本:" + FormLogin.versions;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = (object sender2, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) => true;
foreach (TabPage tabPage in tabControl1.TabPages)
{

View File

@@ -611,14 +611,14 @@ namespace AppleBatch_June
public static DateTime GetTimeByTimeStamp(long unixTimeStamp)
{
return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(unixTimeStamp);
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1), TimeZoneInfo.Local).AddSeconds(unixTimeStamp);
}
public static DateTime GetTimeByJsTimeStamp(long unixTimeStamp)
{
try
{
return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds(unixTimeStamp);
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1), TimeZoneInfo.Local).AddMilliseconds(unixTimeStamp);
}
catch (Exception)
{
@@ -814,7 +814,7 @@ namespace AppleBatch_June
public static string EncodeBase64(byte[] source)
{
string text = "";
string _text = "";
try
{
return Convert.ToBase64String(source);

View File

@@ -487,7 +487,6 @@ namespace DotNet.Utilities
private byte[] GetByte()
{
byte[] array = null;
using MemoryStream memoryStream = new MemoryStream();
if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase))
{