mirror of
https://git.oceanpay.cc/danial/kami_itunes_june.git
synced 2025-12-18 22:31:24 +00:00
- 在.settings.local.json中添加dotnet clean命令权限 - 更新项目文件以启用不安全的二进制序列化和禁用平台兼容性警告 - 配置调试和发布模式的编译常量及优化选项 - 在解决方案文件中升级Visual Studio版本并添加多平台配置 - 移除FormLogin构造函数中的MessageBox调试代码 - 为过时的WebRequest、WebClient和ServicePointManager API添加编译警告抑制 - 简化异常处理逻辑并在Program.cs中改进启动流程 - 移除多个未使用的局部变量声明 - 添加launchSettings.json以支持开发环境配置 - 在表单构造函数中初始化components容器 - 优化网络请求超时设置并改善错误处理机制
981 lines
44 KiB
C#
981 lines
44 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Net;
|
||
using System.Net.Sockets;
|
||
using System.Security.Cryptography;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Web;
|
||
using Newtonsoft.Json;
|
||
using AppleBatch_June.Model;
|
||
using AppleBatch_June.Properties;
|
||
using DotNet.Utilities;
|
||
|
||
namespace AppleBatch_June
|
||
{
|
||
public static class Tools
|
||
{
|
||
private static string[] telStarts = "134,135,136,137,138,139,150,151,152,157,158,159,130,131,132,155,156,133,153,180,181,182,183,185,186,176,187,188,189,177,178".Split(',');
|
||
|
||
private static string[] nianfen = new string[19]
|
||
{
|
||
"78", "79", "80", "81", "82", "83", "84", "85", "86", "87",
|
||
"88", "89", "90", "91", "92", "77", "76", "75", "74"
|
||
};
|
||
|
||
private static string[] yuefen = new string[12]
|
||
{
|
||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
|
||
"11", "12"
|
||
};
|
||
|
||
private static string[] ri = new string[28]
|
||
{
|
||
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
|
||
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
|
||
"21", "22", "23", "24", "25", "26", "27", "28"
|
||
};
|
||
|
||
private static string[] Fcodes = new string[4] { "7ta44j1e3NlY5BSo9z4ofjb75PaK4Vpjt.gEngMQEjZr_WhXTA6FL.26y8GGEDd5ihORoVyFGh8cmvSuCKzIlnY6xljQlpRDBLraeL3Cb12qgXK_Pmtd0SHp815LyjaY2.rINj.rIN4WzcjftckcKyAd65hz74WySXvOxwawgCgIlNu1k.Nzl998tp7ppfAaZ6m1CdC5MQjGejuTDRNziCvTDfWlXqwpHkWgsFTpZHgfLMC7Afyz.sUAuyPBDovJn_b_GGEOpBSKxUC56MnGWpwoNSUC53ZXnN87gq1WvSTjPL6eJrJpyhpAI6.D_yg1wWF9kmFxTnx9MsFr93A6P4XuYLlric4w.Tf5.EKWG1JuJsjpVMZ90L5H6e4yMez7MJ5tFWNuVNNW5CfUXtStKjE4PIDxO9sPrsiMTKQnlLZnjxGfUhkY5BSp.5BNlan0Os5Apw.DiN\"", "8ta44j1e3NlY5BSo9z4ofjb75PaK4Vpjt.gEngMQEjZr_WhXTA6FL.26y8GGEDd5ihORoVyFGh8cmvSuCKzIlnY6xljQlpRDBLraeL3Cb13qgXK_Pmtd0SHp815LyjaY2.rINj.rIN4WzcjftckcKyAd65hz74WySXvOxwawgCgIlNu1k.Nzl998tp7ppfAaZ6m1CdC5MQjGejuTDRNziCvTDfWlXqwpHkWgsFTpZHgfLMC7Afyz.sUAuyPBDovJn_b_GGEOpBSKxUC56MnGWpwoNSUC53ZXnN87gq1WvSTjPL6eJrJpyhpAI6.D_yg1wWF9kmFxTnx9MsFr93A6P4XuYLlric4w.Tf5.EKWG1JuJsjpVMZ90L5H6e4yMez7MJ5tFWNuVNNW5CfUXtStKjE4PIDxO9sPrsiMTKQnlLZnjxGfUhkY5BSp.5BNlan0Os5Apw.DiN\"", "Fda44j1e3NlY5BSo9z4ofjb75PaK4Vpjt.gEngMQEjZrVglE4YcA.0Yz3ccbbJYMLgiPFU77qZoOSix5ezdstlYysrhsui65Whte..hb1fqgXK_Pmtd0SHp815LyjaY2.rINj.rIN4WzcjftckcKyAd65hz74WySXvOxwaw4a8sgS0N.BUs_43wuZPup_nH2t05oaYAhrcpMxE6DBUr5xj6KksoCjCF.4gsKTpZHgfLMC7Afyz.sUAuyPBDovJn_b_GGEOpBSKxUC56MnGWpwoNSUC53ZXnN87gq1WuV9aK7IFeIUfSHolk2dUf.j7J1gBZEMgzH_y3Cmd.1wcDhveKalRdQBWacOHWKU.6elV2pNJF_DJRbukAm4.f282p9KyNnw9Qe2ReF.j9ffSX3Sr4SO7EXvX8vW6QbU.g_RD9umFUor9bCerYUjJPSDUyFA2zG6jSfUXtStKjE4PIDxO9sPrsiMTKQnlLZnjxHfUhkY5DwQPcrXnYEs4ZGtsgEngMQEliIhgjTuIvljlLnU8zXVyxGdotxO9svuB5d_rec5J.lY5BqNAE.lTjV.C7E\"", "i8CUJ1FcYXxrFFnofRviYxwHkTLckR8vKuDP0YKBP5RN52hPD1YADqXmEwlrheu7P2WN1Nn66jJSWYChnxPiuziWMSB6oUVmDK.3YKNrGR4VX5Ghk43mFBESM01bBhKdDYFCa98TZZSTvC.GCVOjRlW25XiYJoga7SI.r47bxcDiknZ91mPhJcCU1D62ScAmutLSw_R7OporYqJK.YXZP.HWFpzez58LRSptR6F1LHJVqNxCwo3v5dNwcrD62oAIgSP61SvuJWE7hniuumkB2EFq4uGcv9.Y70rN.rBTuAcbPGFq9KEI4.GRDa28BJ_9Xh_gyKv2bGItegRpfSSaxiU9mPAPp2IbAS3jGauqRBiphOpY9EVlsRErDswYAWEYziiBdjZ4Ze9l_gTNcdFbZZllEEVPgLgxz9s.hexRgQBDIVrZPZyYGf_QzzyOD9QE.DorqUh.iqw\"" };
|
||
|
||
private static string[] UserAgents = new string[159]
|
||
{
|
||
"Mozilla/5.0 (iPhone 84; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 MQQBrowser/7.8.0 Mobile/14G60 Safari/8536.25 MttCustomUA/2 QBWebViewType/1 WKType/1", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.18 NetType/WIFI Language/en", "Mozilla/5.0 (iPhone 92; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 MQQBrowser/7.7.2 Mobile/14F89 Safari/8536.25 MttCustomUA/2 QBWebViewType/1 WKType/1", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0",
|
||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko", "Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36",
|
||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/6.1.6 Safari/537.78.2", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.39 (KHTML, like Gecko) Version/9.0 Safari/601.1.39", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko", "Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0", "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:39.0) Gecko/20100101 Firefox/39.0",
|
||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.4.10 (KHTML, like Gecko) Version/8.0.4 Safari/600.4.10", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12",
|
||
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:39.0) Gecko/20100101 Firefox/39.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/7.1.7 Safari/537.85.16", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.15 Safari/537.36",
|
||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.600 Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36 Vivaldi/1.0.233.3", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36",
|
||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36 Vivaldi/1.0.233.3", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1866.237 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.517 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36", "Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1464.0 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.90 Safari/537.36", "Mozilla/5.0 (X11; NetBSD) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36", "Mozilla/5.0 (X11; CrOS i686 3912.101.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36",
|
||
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.14 (KHTML, like Gecko) Chrome/24.0.1292.0 Safari/537.14", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13", "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1284.0 Safari/537.13", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.6 Safari/537.11", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.17 Safari/537.11", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"
|
||
};
|
||
|
||
public static string DToAny(this double DB, int Type)
|
||
{
|
||
string text = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||
string text2 = "";
|
||
string text3 = "";
|
||
long num = (long)DB;
|
||
double num2 = DB - (double)num;
|
||
if (num == 0L)
|
||
{
|
||
text2 = "0";
|
||
}
|
||
while (num != 0L)
|
||
{
|
||
text2 = text[(int)num % Type] + text2;
|
||
num /= Type;
|
||
}
|
||
for (int i = 0; i < 11; i++)
|
||
{
|
||
if (num2 == 0.0)
|
||
{
|
||
break;
|
||
}
|
||
text3 += text[(int)(num2 * (double)Type)];
|
||
num2 = num2 * (double)Type - (double)(int)(num2 * (double)Type);
|
||
}
|
||
if (text3 == "")
|
||
{
|
||
return text2;
|
||
}
|
||
return text2 + "." + text3;
|
||
}
|
||
|
||
public static string getRandomTel()
|
||
{
|
||
Random random = new Random();
|
||
random.Next(10, 1000);
|
||
int num = random.Next(0, telStarts.Length - 1);
|
||
string text = telStarts[num];
|
||
string text2 = (random.Next(100, 888) + 10000).ToString().Substring(1);
|
||
string text3 = (random.Next(1, 9100) + 10000).ToString().Substring(1);
|
||
return text + text2 + text3;
|
||
}
|
||
|
||
public static string GenerateRandomLetter(int Length)
|
||
{
|
||
char[] array = new char[52]
|
||
{
|
||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
|
||
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
||
'y', 'z'
|
||
};
|
||
string text = "";
|
||
int maxValue = array.Length;
|
||
Random random = new Random(Guid.NewGuid().GetHashCode());
|
||
for (int i = 0; i < Length; i++)
|
||
{
|
||
int num = random.Next(0, maxValue);
|
||
text += array[num];
|
||
}
|
||
return text;
|
||
}
|
||
|
||
public static string GetAddress()
|
||
{
|
||
string[] array = Resources.province.Split(',');
|
||
int num = new Random(Guid.NewGuid().GetHashCode()).Next(0, array.Length);
|
||
return array[num];
|
||
}
|
||
|
||
public static void AddOrUpdateObj(this Dictionary<string, object> suosou, string key, object value)
|
||
{
|
||
if (suosou.ContainsKey(key))
|
||
{
|
||
suosou[key] = value;
|
||
}
|
||
else
|
||
{
|
||
suosou.Add(key, value);
|
||
}
|
||
}
|
||
|
||
public static void AddOrUpdate(this Dictionary<string, string> suosou, string key, string value)
|
||
{
|
||
if (suosou.ContainsKey(key))
|
||
{
|
||
suosou[key] = value;
|
||
}
|
||
else
|
||
{
|
||
suosou.Add(key, value);
|
||
}
|
||
}
|
||
|
||
public static decimal ConverCurrency(string value)
|
||
{
|
||
try
|
||
{
|
||
Regex regex = new Regex("(\\p{Sc})?");
|
||
if (value == null)
|
||
{
|
||
value = "0";
|
||
}
|
||
if (!value.Contains(".") && !ContetCuure(value))
|
||
{
|
||
byte[] bytes = new byte[2] { 194, 160 };
|
||
string @string = Encoding.GetEncoding("UTF-8").GetString(bytes);
|
||
value = value.Replace(",", ".").Replace(' ', '-').Replace("-", "")
|
||
.Replace("\u00a0", "")
|
||
.Replace(@string, "");
|
||
}
|
||
else
|
||
{
|
||
value = value.Replace(",", "");
|
||
}
|
||
string text = Regex.Replace(value, "[^\\d.\\d]", "");
|
||
text = text.TrimStart('.');
|
||
if (Regex.IsMatch(text, "^[+-]?\\d*[.]?\\d*$"))
|
||
{
|
||
value.Replace(text, "").TrimStart().Trim()
|
||
.Contains("¥");
|
||
if (decimal.TryParse(regex.Replace(text, ""), out var result))
|
||
{
|
||
return result;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return 0m;
|
||
}
|
||
|
||
private static 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;
|
||
}
|
||
|
||
public static bool IsDomainAlive(string aDomain, int port, int aTimeoutSeconds = 1)
|
||
{
|
||
try
|
||
{
|
||
using TcpClient tcpClient = new TcpClient();
|
||
IAsyncResult asyncResult = tcpClient.BeginConnect(aDomain, port, null, null);
|
||
if (!asyncResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(aTimeoutSeconds)))
|
||
{
|
||
return false;
|
||
}
|
||
tcpClient.EndConnect(asyncResult);
|
||
return true;
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public static bool IsDomainAlive(string address, int aTimeoutSeconds = 1)
|
||
{
|
||
string[] array = address.Split(':');
|
||
if (array.Length >= 2)
|
||
{
|
||
return IsDomainAlive(array[0], ToInt(array[1], 8080), aTimeoutSeconds);
|
||
}
|
||
return true;
|
||
}
|
||
|
||
public static IpInfoModel GetIpinfo()
|
||
{
|
||
HttpHelper httpHelper = new HttpHelper();
|
||
HttpItem httpItem = new HttpItem
|
||
{
|
||
URL = "http://myip.top/",
|
||
Method = "GET",
|
||
Timeout = 20000,
|
||
ReadWriteTimeout = 20000
|
||
};
|
||
HttpResult html = httpHelper.GetHtml(httpItem);
|
||
if (html.StatusCode == HttpStatusCode.OK)
|
||
{
|
||
dynamic val = Todejosn<object>(html.Html);
|
||
string ip = val["ip"];
|
||
string text = val["country"];
|
||
string text2 = val["province"];
|
||
string isp = val["isp"];
|
||
return new IpInfoModel
|
||
{
|
||
ip = ip,
|
||
country = text + "," + text2,
|
||
isp = isp
|
||
};
|
||
}
|
||
httpItem.URL = "http://ip-api.com/json/?lang=zh-CN";
|
||
html = httpHelper.GetHtml(httpItem);
|
||
if (html.StatusCode == HttpStatusCode.OK)
|
||
{
|
||
dynamic val2 = Todejosn<object>(html.Html);
|
||
string ip2 = val2["query"];
|
||
string text3 = val2["country"];
|
||
if (text3.Contains("台湾") || text3.Contains("香港") || text3.Contains("澳门"))
|
||
{
|
||
text3 = "中国," + text3;
|
||
}
|
||
string text4 = val2["isp"];
|
||
if (text4.Contains("Chinanet"))
|
||
{
|
||
text4 = "电信";
|
||
}
|
||
if (text4.Contains("Unicom"))
|
||
{
|
||
text4 = "联通";
|
||
}
|
||
return new IpInfoModel
|
||
{
|
||
country = text3,
|
||
isp = text4,
|
||
ip = ip2
|
||
};
|
||
}
|
||
return null;
|
||
}
|
||
|
||
public static string Base64Encode(string source)
|
||
{
|
||
string empty = string.Empty;
|
||
byte[] bytes = Encoding.UTF8.GetBytes(source);
|
||
try
|
||
{
|
||
return Convert.ToBase64String(bytes);
|
||
}
|
||
catch
|
||
{
|
||
return source;
|
||
}
|
||
}
|
||
|
||
public static int getTaskSize(bool openVpn, int itemsCount)
|
||
{
|
||
int num = ToNetWorkInt(ConfigUtlis.getConfigValue("comNetworkConfig"), 0);
|
||
int num2 = ToInt(AppSysConfig.getConfig("ThredSizeDefault"), 2);
|
||
int num3 = ToInt(ConfigUtlis.getConfigValue("ThredSize"), 0);
|
||
if (!openVpn)
|
||
{
|
||
return num2;
|
||
}
|
||
if ((num == 1 || num == 2) && openVpn)
|
||
{
|
||
string[] array = AppSysConfig.getConfig("OtherProxyThredSize").Split('-');
|
||
if (int.TryParse(array[0].Trim(), out var result) && int.TryParse(array[1].Trim(), out var result2) && num3 >= result && num3 <= result2)
|
||
{
|
||
if (itemsCount < num3)
|
||
{
|
||
return itemsCount;
|
||
}
|
||
return num3;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (num3 == 0)
|
||
{
|
||
if (itemsCount < num2)
|
||
{
|
||
return itemsCount;
|
||
}
|
||
return num2;
|
||
}
|
||
string[] array2 = AppSysConfig.getConfig("SystemProxyThredSize").Split('-');
|
||
if (int.TryParse(array2[0].Trim(), out var result3) && int.TryParse(array2[1].Trim(), out var result4) && num3 >= result3 && num3 <= result4)
|
||
{
|
||
if (itemsCount < num3)
|
||
{
|
||
return itemsCount;
|
||
}
|
||
return num3;
|
||
}
|
||
}
|
||
return num2;
|
||
}
|
||
|
||
public static int ToNetWorkInt(string data, int dfvalue)
|
||
{
|
||
if (int.TryParse(data, out var result))
|
||
{
|
||
if (result > 3)
|
||
{
|
||
return dfvalue;
|
||
}
|
||
return result;
|
||
}
|
||
return dfvalue;
|
||
}
|
||
|
||
public static int ToInt(string data, int dfvalue)
|
||
{
|
||
if (int.TryParse(data, out var result))
|
||
{
|
||
return result;
|
||
}
|
||
return dfvalue;
|
||
}
|
||
|
||
public static string ToUrlDecode(string value)
|
||
{
|
||
return HttpUtility.UrlDecode(value);
|
||
}
|
||
|
||
public static string ToUrlEncode(string value)
|
||
{
|
||
return HttpUtility.UrlEncode(value);
|
||
}
|
||
|
||
public static void AddWebHander(this WebHeaderCollection collection, string key, string val)
|
||
{
|
||
if (collection.AllKeys.Contains(key))
|
||
{
|
||
collection[key] = val;
|
||
}
|
||
else
|
||
{
|
||
collection.Add(key, val);
|
||
}
|
||
}
|
||
|
||
public static string ToEscape(object @string)
|
||
{
|
||
string text = Convert.ToString(@string);
|
||
string text2 = "0123456789ABCDEF";
|
||
int length = text.Length;
|
||
StringBuilder stringBuilder = new StringBuilder(length * 2);
|
||
int num = -1;
|
||
while (++num < length)
|
||
{
|
||
char c = text[num];
|
||
int num2 = c;
|
||
if ((65 > num2 || num2 > 90) && (97 > num2 || num2 > 122) && (48 > num2 || num2 > 57))
|
||
{
|
||
switch (c)
|
||
{
|
||
default:
|
||
stringBuilder.Append('%');
|
||
if (num2 < 256)
|
||
{
|
||
stringBuilder.Append(text2[num2 / 16]);
|
||
c = text2[num2 % 16];
|
||
break;
|
||
}
|
||
stringBuilder.Append('u');
|
||
stringBuilder.Append(text2[(num2 >> 12) % 16]);
|
||
stringBuilder.Append(text2[(num2 >> 8) % 16]);
|
||
stringBuilder.Append(text2[(num2 >> 4) % 16]);
|
||
c = text2[num2 % 16];
|
||
break;
|
||
case '*':
|
||
case '+':
|
||
case '-':
|
||
case '.':
|
||
case '/':
|
||
case '@':
|
||
case '_':
|
||
break;
|
||
}
|
||
}
|
||
stringBuilder.Append(c);
|
||
}
|
||
return stringBuilder.ToString();
|
||
}
|
||
|
||
public static string ToUnescape(object @string)
|
||
{
|
||
string text = Convert.ToString(@string);
|
||
int length = text.Length;
|
||
StringBuilder stringBuilder = new StringBuilder(length);
|
||
int num = -1;
|
||
while (++num < length)
|
||
{
|
||
char c = text[num];
|
||
if (c == '%')
|
||
{
|
||
int num4;
|
||
int num5;
|
||
int num2;
|
||
int num3;
|
||
if (num + 5 < length && text[num + 1] == 'u' && (num2 = HexDigit(text[num + 2])) != -1 && (num3 = HexDigit(text[num + 3])) != -1 && (num4 = HexDigit(text[num + 4])) != -1 && (num5 = HexDigit(text[num + 5])) != -1)
|
||
{
|
||
c = (char)((num2 << 12) + (num3 << 8) + (num4 << 4) + num5);
|
||
num += 5;
|
||
}
|
||
else if (num + 2 < length && (num2 = HexDigit(text[num + 1])) != -1 && (num3 = HexDigit(text[num + 2])) != -1)
|
||
{
|
||
c = (char)((num2 << 4) + num3);
|
||
num += 2;
|
||
}
|
||
}
|
||
stringBuilder.Append(c);
|
||
}
|
||
return stringBuilder.ToString();
|
||
}
|
||
|
||
private static int HexDigit(char c)
|
||
{
|
||
if (c >= '0' && c <= '9')
|
||
{
|
||
return c - 48;
|
||
}
|
||
if (c >= 'A' && c <= 'F')
|
||
{
|
||
return 10 + c - 65;
|
||
}
|
||
if (c >= 'a' && c <= 'f')
|
||
{
|
||
return 10 + c - 97;
|
||
}
|
||
return -1;
|
||
}
|
||
|
||
public static T GetDynamic<T>(Dictionary<string, dynamic> dataSource, string key, T defaultData)
|
||
{
|
||
try
|
||
{
|
||
if (dataSource.ContainsKey(key))
|
||
{
|
||
return dataSource[key];
|
||
}
|
||
return defaultData;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return defaultData;
|
||
}
|
||
}
|
||
|
||
public static bool TryAddDic(this Dictionary<string, string> dataSource, string key, string value)
|
||
{
|
||
try
|
||
{
|
||
if (dataSource.ContainsKey(key))
|
||
{
|
||
dataSource[key] = value;
|
||
}
|
||
else
|
||
{
|
||
dataSource.Add(key, value);
|
||
}
|
||
return true;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public static string getDicVal(this Dictionary<string, string> dataSource, string key, string defaultData)
|
||
{
|
||
if (dataSource.ContainsKey(key))
|
||
{
|
||
return dataSource[key];
|
||
}
|
||
return defaultData;
|
||
}
|
||
|
||
public static T Todejosn<T>(string json)
|
||
{
|
||
try
|
||
{
|
||
if (!string.IsNullOrEmpty(json))
|
||
{
|
||
return JsonConvert.DeserializeObject<T>(json);
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return default(T);
|
||
}
|
||
|
||
public static string Toenjson(object data)
|
||
{
|
||
return JsonConvert.SerializeObject(data);
|
||
}
|
||
|
||
public static string Unicode2String(string source)
|
||
{
|
||
return new Regex("\\\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(source, (Match x) => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
|
||
}
|
||
|
||
public static string GetMD5_32(byte[] value)
|
||
{
|
||
if (value == null)
|
||
{
|
||
return "";
|
||
}
|
||
byte[] array = MD5.Create().ComputeHash(value);
|
||
StringBuilder stringBuilder = new StringBuilder();
|
||
for (int i = 0; i < array.Length; i++)
|
||
{
|
||
stringBuilder.Append(array[i].ToString("x2"));
|
||
}
|
||
return stringBuilder.ToString().ToLower();
|
||
}
|
||
|
||
public static string GetMD5_32(string value)
|
||
{
|
||
if (value == null)
|
||
{
|
||
value = "";
|
||
}
|
||
byte[] array = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(value));
|
||
StringBuilder stringBuilder = new StringBuilder();
|
||
for (int i = 0; i < array.Length; i++)
|
||
{
|
||
stringBuilder.Append(array[i].ToString("x2"));
|
||
}
|
||
return stringBuilder.ToString().ToLower();
|
||
}
|
||
|
||
public static long GenerateTimeStamp()
|
||
{
|
||
return Convert.ToInt64((DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
|
||
}
|
||
|
||
public static long GenerateTimeStamp(DateTime dt)
|
||
{
|
||
return Convert.ToInt64((dt.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
|
||
}
|
||
|
||
public static long GetTimestamp2()
|
||
{
|
||
return (long)(DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalMilliseconds;
|
||
}
|
||
|
||
public static DateTime GetTimeByTimeStamp(long unixTimeStamp)
|
||
{
|
||
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1), TimeZoneInfo.Local).AddSeconds(unixTimeStamp);
|
||
}
|
||
|
||
public static DateTime GetTimeByJsTimeStamp(long unixTimeStamp)
|
||
{
|
||
try
|
||
{
|
||
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1), TimeZoneInfo.Local).AddMilliseconds(unixTimeStamp);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return DateTime.Now;
|
||
}
|
||
}
|
||
|
||
public static string microtime()
|
||
{
|
||
return new Random().NextDouble().ToString().Substring(0, 8) + "00 " + GenerateTimeStamp();
|
||
}
|
||
|
||
public static string subEndstr(string result, int leng)
|
||
{
|
||
return result.Substring(result.Length - leng, leng);
|
||
}
|
||
|
||
public static byte[] DecodeBase64(Encoding encode, string result)
|
||
{
|
||
return Convert.FromBase64String(result);
|
||
}
|
||
|
||
public static byte[] DecodeBase64(string imgData)
|
||
{
|
||
string text = imgData.Trim().Replace("%", "").Replace(",", "")
|
||
.Replace(" ", "+");
|
||
if (text.Length % 4 > 0)
|
||
{
|
||
text = text.PadRight(text.Length + 4 - text.Length % 4, '=');
|
||
}
|
||
return DecodeBase64(Encoding.UTF8, text);
|
||
}
|
||
|
||
public static string a(string dstring, string keya, string keyb, bool operation, string key = "", int expiry = 0)
|
||
{
|
||
int num = 4;
|
||
key = GetMD5_32(key);
|
||
string text = (operation ? dstring.Substring(0, num) : subEndstr(GetMD5_32(microtime().ToString()), num));
|
||
string text2 = keya + GetMD5_32(keya + text);
|
||
int length = text2.Length;
|
||
dstring = (operation ? dstring : (((expiry != 0) ? (expiry + GenerateTimeStamp()).ToString() : "0").PadRight(10, '0') + GetMD5_32(dstring + keyb).Substring(0, 16) + dstring));
|
||
byte[] array = null;
|
||
if (operation)
|
||
{
|
||
array = DecodeBase64(dstring.Substring(num));
|
||
}
|
||
int num2 = (operation ? array.Length : dstring.Length);
|
||
byte[] array2 = new byte[num2];
|
||
int[] array3 = Enumerable.Range(0, 256).ToArray();
|
||
int[] array4 = new int[256];
|
||
for (int i = 0; i <= 255; i++)
|
||
{
|
||
array4[i] = text2[i % length];
|
||
}
|
||
int j = 0;
|
||
int num3 = 0;
|
||
for (; j < 256; j++)
|
||
{
|
||
num3 = (num3 + array3[j] + array4[j]) % 256;
|
||
int num4 = array3[j];
|
||
array3[j] = array3[num3];
|
||
array3[num3] = num4;
|
||
}
|
||
int k = 0;
|
||
int num5 = 0;
|
||
int num6 = 0;
|
||
for (; k < num2; k++)
|
||
{
|
||
num6 = (num6 + 1) % 256;
|
||
num5 = (num5 + array3[num6]) % 256;
|
||
int num7 = array3[num6];
|
||
array3[num6] = array3[num5];
|
||
array3[num5] = num7;
|
||
if (operation)
|
||
{
|
||
array2[k] = (byte)(array[k] ^ array3[(array3[num6] + array3[num5]) % 256]);
|
||
}
|
||
else
|
||
{
|
||
array2[k] = (byte)(dstring[k] ^ array3[(array3[num6] + array3[num5]) % 256]);
|
||
}
|
||
}
|
||
if (operation)
|
||
{
|
||
string @string = Encoding.UTF8.GetString(array2);
|
||
if (int.Parse(@string.Substring(0, 10)) != 0 && (long.Parse(@string.Substring(0, 10)) - GenerateTimeStamp() <= 0L || !(@string.Substring(10, 16) == GetMD5_32(@string.Substring(26) + keyb).Substring(0, 16))))
|
||
{
|
||
return "";
|
||
}
|
||
return @string.Substring(26);
|
||
}
|
||
return text + EncodeBase64(array2).Replace("=", "");
|
||
}
|
||
|
||
public static string GetRedomBarthdayStr()
|
||
{
|
||
Random random = new Random();
|
||
StringBuilder stringBuilder = new StringBuilder();
|
||
stringBuilder.Append("19");
|
||
stringBuilder.Append(nianfen[random.Next(nianfen.Length)]);
|
||
stringBuilder.Append("-");
|
||
Random random2 = new Random();
|
||
stringBuilder.Append(yuefen[random2.Next(yuefen.Length)]);
|
||
stringBuilder.Append("-");
|
||
Random random3 = new Random();
|
||
stringBuilder.Append(ri[random3.Next(ri.Length)]);
|
||
return stringBuilder.ToString();
|
||
}
|
||
|
||
public static string getEnName()
|
||
{
|
||
HttpHelper httpHelper = new HttpHelper();
|
||
HttpItem item = new HttpItem
|
||
{
|
||
URL = "https://www.qmsjmfb.com/en.php",
|
||
Method = "POST",
|
||
Timeout = 100000,
|
||
ReadWriteTimeout = 30000,
|
||
IsToLower = false,
|
||
Cookie = "",
|
||
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",
|
||
Accept = "text/html, application/xhtml+xml, */*",
|
||
ContentType = "application/x-www-form-urlencoded",
|
||
Postdata = "num=1&sex=all&xing=",
|
||
ResultType = ResultType.String
|
||
};
|
||
HttpResult html = httpHelper.GetHtml(item);
|
||
if (html.StatusCode == HttpStatusCode.OK)
|
||
{
|
||
string text = new Regex("<li>([\\s\\S]*?)</li>").Match(html.Html).Groups[1].Value.Trim();
|
||
if (text.Contains("("))
|
||
{
|
||
return getEnName();
|
||
}
|
||
return text;
|
||
}
|
||
return GenerateSurname() + " Hal";
|
||
}
|
||
|
||
public static string GenerateSurname()
|
||
{
|
||
string text = string.Empty;
|
||
string[] array = "a,a,a,a,a,e,e,e,e,e,e,e,e,e,e,e,i,i,i,o,o,o,u,y,ee,ee,ea,ea,ey,eau,eigh,oa,oo,ou,ough,ay".Split(',');
|
||
string[] array2 = "s,s,s,s,t,t,t,t,t,n,n,r,l,d,sm,sl,sh,sh,th,th,th".Split(',');
|
||
string[] array3 = "sh,sh,st,st,b,c,f,g,h,k,l,m,p,p,ph,wh".Split(',');
|
||
string[] array4 = "x,ss,ss,ch,ch,ck,ck,dd,kn,rt,gh,mm,nd,nd,nn,pp,ps,tt,ff,rr,rk,mp,ll".Split(',');
|
||
string[] array5 = "j,j,j,v,v,w,w,w,z,qu,qu".Split(',');
|
||
Random random = new Random(Guid.NewGuid().GetHashCode());
|
||
int[] array6 = new int[10] { 2, 2, 2, 2, 2, 2, 3, 3, 3, 4 };
|
||
int num = array6[random.Next(array6.Length)];
|
||
for (int i = 0; i < num; i++)
|
||
{
|
||
int num2 = random.Next(1000);
|
||
string[] array7 = ((num2 < 775) ? array2 : ((num2 < 875 && i > 0) ? array4 : ((num2 >= 985) ? array5 : array3)));
|
||
text += array7[random.Next(array7.Length)];
|
||
text += array[random.Next(array.Length)];
|
||
if ((text.Length > 4 && random.Next(1000) < 800) || (text.Length > 6 && random.Next(1000) < 950) || text.Length > 7)
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
int num3 = random.Next(1000);
|
||
num3 = ((text.Length <= 6) ? (num3 + text.Length * 10) : (num3 - text.Length * 25));
|
||
if (num3 >= 400)
|
||
{
|
||
if (num3 < 775)
|
||
{
|
||
text += array2[random.Next(array2.Length)];
|
||
}
|
||
else if (num3 < 825)
|
||
{
|
||
text += array3[random.Next(array3.Length)];
|
||
}
|
||
else if (num3 < 840)
|
||
{
|
||
text += "ski";
|
||
}
|
||
else if (num3 < 860)
|
||
{
|
||
text += "son";
|
||
}
|
||
else
|
||
{
|
||
if (Regex.IsMatch(text, "(.+)(ay|e|ee|ea|oo)$") || text.Length < 5)
|
||
{
|
||
return "Mc" + text.Substring(0, 1).ToUpper() + text.Substring(1);
|
||
}
|
||
text += "ez";
|
||
}
|
||
}
|
||
return text.Substring(0, 1).ToUpper() + text.Substring(1);
|
||
}
|
||
|
||
public static string EncodeBase64(byte[] source)
|
||
{
|
||
try
|
||
{
|
||
return Convert.ToBase64String(source);
|
||
}
|
||
catch
|
||
{
|
||
return Encoding.Default.GetString(source);
|
||
}
|
||
}
|
||
|
||
public static int getAnwerId_Index(int id)
|
||
{
|
||
if (id >= 130 && id <= 135)
|
||
{
|
||
return 1;
|
||
}
|
||
if (id >= 136 && id <= 141)
|
||
{
|
||
return 2;
|
||
}
|
||
if (id >= 142 && id <= 147)
|
||
{
|
||
return 3;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
public static string readFile(string Path, Encoding encoding)
|
||
{
|
||
FileStream fileStream = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||
string result = "";
|
||
using (StreamReader streamReader = new StreamReader(fileStream, encoding))
|
||
{
|
||
result = streamReader.ReadToEnd();
|
||
}
|
||
fileStream.Close();
|
||
fileStream.Dispose();
|
||
return result;
|
||
}
|
||
|
||
public static string readFile(string url)
|
||
{
|
||
return readFile(url, Encoding.Default);
|
||
}
|
||
|
||
public static string getAnwerId(string postion)
|
||
{
|
||
if (!postion.Contains("friend in high school") && !postion.Contains("的朋友叫什么名字"))
|
||
{
|
||
if (!postion.Contains("What was the name of your first pet") && !postion.Contains("你的第一个宠物叫什么名字"))
|
||
{
|
||
if (!postion.Contains("What was the first thing you learned to cook") && !postion.Contains("你学会做的第一道菜是什么"))
|
||
{
|
||
if (!postion.Contains("What was the first film you saw in the theater") && !postion.Contains("你第一次去电影院看的是哪一部电影"))
|
||
{
|
||
if (!postion.Contains("Where did you go the first time you flew on a plane") && !postion.Contains("你第一次坐飞机是去哪里"))
|
||
{
|
||
if (!postion.Contains("What is the last name of your favorite elementary school teacher") && !postion.Contains("你上小学时最喜欢的老师姓什么"))
|
||
{
|
||
if (!postion.Contains("What is your dream job") && !postion.Contains("你的理想工作是什么"))
|
||
{
|
||
if (!postion.Contains("What is your favorite children’s book") && !postion.Contains("你小时候最喜欢哪一本书"))
|
||
{
|
||
if (!postion.Contains("What was the model of your first car") && !postion.Contains("你拥有的第一辆车是什么型号"))
|
||
{
|
||
if (!postion.Contains("What was your childhood nickname") && !postion.Contains("你童年时代的绰号是什么"))
|
||
{
|
||
if (!postion.Contains("Who was your favorite film star or character in school") && !postion.Contains("你在学生时代最喜欢哪个电影明星或角色"))
|
||
{
|
||
if (!postion.Contains("Who was your favorite singer or band in high school") && !postion.Contains("你在学生时代最喜欢哪个歌手或乐队"))
|
||
{
|
||
if (!postion.Contains("In what city did your parents meet") && !postion.Contains("你的父母是在哪里认识的"))
|
||
{
|
||
if (!postion.Contains("What was the first name of your first boss") && !postion.Contains("你的第一个上司叫什么名字"))
|
||
{
|
||
if (!postion.Contains("What is the name of the street where you grew up") && !postion.Contains("您从小长大的那条街叫什么"))
|
||
{
|
||
if (!postion.Contains("What is the name of the first beach you visited") && !postion.Contains("你去过的第一个海滨浴场是哪一个"))
|
||
{
|
||
if (!postion.Contains("What was the first album that you purchased") && !postion.Contains("你购买的第一张专辑是什么"))
|
||
{
|
||
if (!postion.Contains("What is the name of your favorite sports team") && !postion.Contains("您最喜欢哪个球队"))
|
||
{
|
||
return "1_0";
|
||
}
|
||
return "147_3";
|
||
}
|
||
return "146_3";
|
||
}
|
||
return "145_3";
|
||
}
|
||
return "144_3";
|
||
}
|
||
return "143_3";
|
||
}
|
||
return "142_3";
|
||
}
|
||
return "141_2";
|
||
}
|
||
return "140_2";
|
||
}
|
||
return "139_2";
|
||
}
|
||
return "138_2";
|
||
}
|
||
return "137_2";
|
||
}
|
||
return "136_2";
|
||
}
|
||
return "135_1";
|
||
}
|
||
return "134_1";
|
||
}
|
||
return "133_1";
|
||
}
|
||
return "132_1";
|
||
}
|
||
return "131_1";
|
||
}
|
||
return "130_1";
|
||
}
|
||
|
||
public static string GetRandomFcode()
|
||
{
|
||
int num = new Random(Guid.NewGuid().GetHashCode()).Next(Fcodes.Length - 1);
|
||
return Fcodes[num];
|
||
}
|
||
|
||
public static string GetRandomUserAgent()
|
||
{
|
||
int num = new Random(Guid.NewGuid().GetHashCode()).Next(0, UserAgents.Length);
|
||
return UserAgents[num];
|
||
}
|
||
|
||
public static string toFonmtCookie(this Dictionary<string, List<CookieItem>> hostLists, string host)
|
||
{
|
||
List<CookieItem> list = null;
|
||
if (hostLists.ContainsKey(host))
|
||
{
|
||
list = hostLists[host];
|
||
}
|
||
string text = "";
|
||
if (list != null)
|
||
{
|
||
foreach (CookieItem item in list)
|
||
{
|
||
text += $"{item.Key}={item.Value};";
|
||
}
|
||
return text;
|
||
}
|
||
return text;
|
||
}
|
||
|
||
public static string toFonmtCookie(this List<CookieItem> list)
|
||
{
|
||
string text = "";
|
||
foreach (CookieItem item in list)
|
||
{
|
||
text += $"{item.Key}={item.Value};";
|
||
}
|
||
return text;
|
||
}
|
||
}
|
||
}
|