1052 lines
56 KiB
C#
1052 lines
56 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Management;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
using System.Xml;
|
|
using AllBase;
|
|
using Work.Api;
|
|
using Work.CollectClass;
|
|
using Work.ManageClass;
|
|
using System.Text.RegularExpressions;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using System.Net;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using NaiBa.Util.Extension;
|
|
using System.IO.Compression;
|
|
|
|
namespace Work
|
|
{
|
|
public class Initialization
|
|
{
|
|
public static int InitPercent = 0;
|
|
public static bool IsCheckFilesFinish = false;
|
|
public static bool IsCheckFilesSuccesss = true;
|
|
public static string ConfigFilePach = Application.StartupPath + "\\Config.xml";
|
|
|
|
public static void InitProgress(int i)
|
|
{
|
|
Thread.Sleep(Randomx.GetId(10, 100));
|
|
InitPercent += i;
|
|
if (InitPercent > 100)
|
|
InitPercent = 100;
|
|
}
|
|
|
|
public string KeyWord =
|
|
"67,41,102,107,122,85,3,61,66,76,56,97,9,123,117,43,55,87,22,9,11,79,2,40,55,13,44,28,123,105,85,50,117,110,120,7,104,17,13,62,41,113,88,118,7,51,85,102,3,31,41,4,88,86,105,115,93,73,125,111,46,47,99,119,66,94,90,66,43,112,111,10,12,46,30,119,60,116,7,15,78,115,1,50,27,29,20,64,26,121,116,57,28,71,53,49,54,109,103,122,77,123,105,75,122,125,11,98,85,2,117,64,55,33,28,107,120,50,113,112,21,19,92,57,23,14,88,50,14,105,83,89,69,83,116,120,87,5,100,94,111,126,7,59,81,28,44,84,13,46,51,13,59,75,111,7,75,14,123,119,14,29,70,105,102,115,124,115,86,42,78,123,125,29,82,8,14,47,1,126,9,47,26,73,96,13,112,8,71,91,68,95,90,20,24,28,54,70,75,39,51,103,42,39,120,120,126,25,96,34,125,32,50,32,44,63,56,75,34,89,64,75,110,62,123,117,1,114,84,75,34,2,105,58,61,55,52,20,122,16,40,78,21,126,124,29,38,55,2,124,60,123,34,111,28,41,36,76,119,59,101,15,82,7,84,29,113,99,8,51,71,23,19,91,30,2,116,38,36,3,29,54,20,9,65,16,123,47,64,23,1,109,62,119,108,45,14,91,117,10,79,76,15,43,67,26,45,28,65,94,51,37,91,110,107,110,109,65,61,82,12,116,27,25,26,71,122,87,100,100,86,107,8,38,5,20,68,2,44,91,2,87,36,69,73,35,107,13,120,120,27,104,87,97,74,40,49,65,126,19,65,118,100,49,13,6,77,21,91,13,68,37,43,50,41,97,62,118,49,41,65,28,27,30,13,93,16,106,23,77,29,19,28,18,110,45,114,27,63,74,30,90,126,93,126,91,26,113,59,125,85,45,94,74,45,42,19,105,100,40,6,5,10,107,105,55,9,64,89,121,7,47,25,27,60,17,41,59,26,49,85,72,102,115,114,5,78,49,48,0,111,54,103,42,22,117,66,114,119,6,5,77,65,66,52,27,94,24,104,24,43,101,120,60,71,68,38,113,23,39,62,76,22,69,15,46,36,123,81,36,68,22,75,32,77,58,112,125,41,48,124,70,50,80,100,31,55,124,79,92,27,104,106,55,65,14,70,92,17,105,48,57,24,116,9,65,51,76,19,55,32,88,98,35,72,25,117,46,109,78,29,109,93,76,81,3,101,58,118,9,83,98,81,13,42,30,94,51,108,119,45,5,119,84,10,62,42,32,69,64,49,35,96,41,32,94,28,104,98,99,113,58,45,117,82,44,42,62,76,45,32,68,104,15,37,31,34,43,122,23,76,15,44,7,114,92,77,55,29,65,50,125,119,102,4,115,89,122,51,71,54,34,111,116,48,87,29,53,14,121,100,21,65,21,114,96,35,68,4,123,43,21,103,41,6,107,123,69,11,45,53,100,58,121,12,84,98,21,6,47,67,13,90,76,4,20,87,12,113,16,1,34,19,82,28,104,39,11,40,125,78,42,4,124,68,34,88,113,111,85,125,21,82,109,74,60,65,40,59,34,57,106,9,84,49,53,121,109,83,63,57,70,88,62,118,111,18,25,83,21,118,2,64,116,79,93,80,33,3,31,44,30,96,33,111,38,33,92,36,69,106,56,72,93,94,20,17,15,13,108,29,20,27,57,7,43,76,115,55,109,42,41,34,2,31,49,25,92,52,68,25,19,121,35,51,8,35,19,90,57,119,83,12,77,110,102,9,1,42,80,83,55,108,16,45,111,19,47,76,63,11,50,42,59,89,88,20,122,125,12,5,68,36,53,90,120,43,90,93,50,20,6,90,82,52,100,124,49,65,39,86,40,31,20,77,75,97,49,35,101,69,15,74,40,78,20,107,54,63,6,103,6,38,94,119,60,34,53,117,90,68,2,108,36,113,53,124,64,48,72,105,1,68,45,13,57,6,20,67,80,110,79,109,68,101,62,82,61,80,117,73,59,82,45,41,110,78,68,89,18,115,4,66,17,24,112,41,29,0,16,94,36,78,4,122,17,86,49,98,85,118,115,14,92,12,126,90,74,105,26,46,21,6,19,84,39,95,21,36,10,45,36,98,93,117,104,97,10,84,55,15,28,121,114,22,78,112,55,6,34,45,58,37,55,24,112,71,96,121,106,122,64,0,78,67,30,29,101,24,113,16,85,34,4,63,57,115,57,100,66,13,49,68,21,45,49,22,60,53,21,48,29,108,43,103,8,106,104,70,20,71,32,58,52,25,2,91,53,60,12,68,120,39,34";
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
public void Get()
|
|
{
|
|
UpdateTime();
|
|
InitProgress(1);
|
|
|
|
string code = "";
|
|
//EncryptionCode.Test();;
|
|
new JumpUpProductNew(null).Ini();
|
|
InitProgress(1);
|
|
|
|
string file = "temp/product.ini";
|
|
string[] l = FileBase.ReadAllLines(file);
|
|
for (int i = 0; l != null && i < l.Length; i++)
|
|
{
|
|
if (string.IsNullOrEmpty(l[i]))
|
|
continue;
|
|
BaseClass.ProductIds.Add(l[i]);
|
|
}
|
|
foreach (Process thisproc in Process.GetProcesses())
|
|
{
|
|
if (thisproc.ProcessName.ToLower() == "cmd")
|
|
thisproc.Kill();
|
|
}
|
|
InitProgress(1);
|
|
|
|
FileBase.DirectoryCreate(Application.StartupPath + "\\temp\\upsame\\");
|
|
FileBase.DirectoryCreate(Application.StartupPath + "\\taobao\\");
|
|
FileBase.DirectoryCreate(Application.StartupPath + "\\taobao\\keywords\\");
|
|
FileBase.DirectoryCreate(Application.StartupPath + "\\taobao\\out\\");
|
|
if (!FileBase.Exists(ConfigFilePach))
|
|
WriteFile();
|
|
string checkvalue = @"OrderStep,5;RankPage,3;ImageSheild,true;NoKeyword,;
|
|
noSoldPara,true;visitPara,true;visitCountPara,1;offTimePara,23:00;onTimePara,05:00;
|
|
taoBaoPara,false;alibabaPara,false;pinduoduoPara,false;dataCenterPara,false;autoAddPara,false;
|
|
maxPagePara,5;singleKeywordPara,1000;priceStartPara,1;priceEndPara,1000;soldStartPara,1;soldEndPara,100000;
|
|
mainImagePara,0;fessionCountPara,1;outKeywordrichPara,批发\定制\代购\外贸\跨境\防狼\辣椒水\迷情\刀\枪\听话\催泪\瓦斯\旗舰店\企业店\外购;addKeywordrichPara,;
|
|
multiPara,1.08;postagePara,10;singlePricePara,1;beforPricePara,2.0;stockPara,999;groupCountPara,2;randPara,false;randPrice1Para,0;randPrice2Para,2;
|
|
imageBuildPara,true;randDeletePara,true;priceShieldPara,true;IrregularitiesPara,true;randSkuPara,false;randImagePara,true;randDescPara,false;onlyFreePara,false;
|
|
propToMainPara,false;deleteMainImagePara,false;mainImageCountPara,0;deleteFirstPara,false;saveAllImagePara,false;descImgCountPara,10;prefixPara,false;
|
|
prefixTextPara,;shopthreadCountPara,3;singeThreadCountPara,1;singleUploadPara,500;catHardPara,false;relationPara,false;visitSpacePara,7;saveCollectPara,true;
|
|
offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;noNeerDaysPara,3;limitReplacePara,true;replaceCountPara,3;errorDownPara,false;apiPara,false";
|
|
CheckXmlValue(checkvalue, ConfigFilePach);
|
|
|
|
Task.Run(() =>
|
|
{
|
|
if (Directory.Exists(System.Environment.CurrentDirectory + "\\data1"))
|
|
Directory.Delete(System.Environment.CurrentDirectory + "\\data1", true);
|
|
});
|
|
//Task.Run(() => { Update(); InitProgress(1); });
|
|
Task.Run(() => { CheckUpdate(); InitProgress(2); });
|
|
Task.Run(() => { GetAuthConfig(); InitProgress(1); });
|
|
Task.Run(() => { CheckFiles(); IsCheckFilesFinish = true; InitProgress(2); });
|
|
//Task.Run(() => { CheckUpdataFile(); });
|
|
//Task.Run(() => { new Segment().GetWord(); InitProgress(1); }); // 奇奇科技?
|
|
//Task.Run(() => { new PinduoduoCatList().Get(); InitProgress(1); }); // pdd cate
|
|
Task.Run(() => { GetMacCode(); InitProgress(1); });
|
|
#if DEBUG
|
|
if (!File.Exists(System.Environment.CurrentDirectory + "\\TemuKJD.exe.choice.debug.tools")) Task.Run(() => { new CheckHecker().Check(); InitProgress(2); }); // 防止破解
|
|
#else
|
|
Task.Run(() => { new CheckHecker().Check(); InitProgress(2); }); // 防止破解
|
|
#endif
|
|
Task.Run(() => { /*PinduoduoProductCollect.GetServerCookies();*/ InitProgress(2); });
|
|
Task.Run(() => { /*new LoadCloudData().Get();*/ InitProgress(2); }); // 加载云数据
|
|
Task.Run(() => { /*new BigDataBuild("").Ini();*/ InitProgress(2); }); // 加载云数据
|
|
Task.Run(() => { new FromTitleToCat(); InitProgress(2); });
|
|
InitProgress(1);
|
|
|
|
if (!File.Exists(ConfigFilePach))
|
|
{
|
|
WriteFile();
|
|
InitProgress(1);
|
|
}
|
|
try
|
|
{
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
xmlDoc.Load(ConfigFilePach);
|
|
XmlNode xn = xmlDoc.SelectSingleNode("ConfigSet");
|
|
BaseClass.UserName = xn["UserName"].InnerText;
|
|
BaseClass.PassWord = xn["PassWord"].InnerText;
|
|
BaseClass.RankPage = int.Parse(xn["RankPage"].InnerText);
|
|
BaseClass.ThreadCount = int.Parse(xn["ThreadCount"].InnerText);
|
|
BaseClass.WaitTime = int.Parse(xn["WaitTime"].InnerText);
|
|
BaseClass.OrderStep = int.Parse(xn["OrderStep"].InnerText);
|
|
BaseClass.HadNoteId = xn["HadNoteId"].InnerText;
|
|
BaseClass.Remember = bool.Parse(xn["RememberPass"].InnerText);
|
|
BaseClass.AutoLogin = bool.Parse(xn["AutoLogin"].InnerText);
|
|
BaseClass.MinPrice = decimal.Parse(xn["MinPrice"].InnerText);
|
|
BaseClass.MaxPrice = decimal.Parse(xn["MaxPrice"].InnerText);
|
|
BaseClass.MinBackMoney = decimal.Parse(xn["MinBackMoney"].InnerText);
|
|
BaseClass.MinSales = int.Parse(xn["MinSales"].InnerText);
|
|
BaseClass.MinPercent = int.Parse(xn["MinPercent"].InnerText);
|
|
BaseClass.MinLevel = int.Parse(xn["MinLevel"].InnerText);
|
|
BaseClass.AlimamaPageCount = int.Parse(xn["AlimamaPageCount"].InnerText);
|
|
BaseClass.ImageSheild = bool.Parse(xn["ImageSheild"].InnerText);
|
|
BaseClass.CloudTitle = bool.Parse(xn["CloudTitle"].InnerText);
|
|
BaseClass.CloudBrand = bool.Parse(xn["CloudBrand"].InnerText);
|
|
BaseClass.CloudSellerNick = bool.Parse(xn["CloudSellerNick"].InnerText);
|
|
BaseClass.CloudProduct = bool.Parse(xn["CloudProduct"].InnerText);
|
|
BaseClass.NoKeyword = xn["NoKeyword"].InnerText;
|
|
//自动上下架
|
|
UploadPinduoduoMain.NoSold = bool.Parse(xn["noSoldPara"].InnerText);
|
|
UploadPinduoduoMain.NoVisit = bool.Parse(xn["visitPara"].InnerText);
|
|
UploadPinduoduoMain.VisitCount = int.Parse(xn["visitCountPara"].InnerText);
|
|
UploadPinduoduoMain.offTime = xn["offTimePara"].InnerText;
|
|
UploadPinduoduoMain.onTime = xn["onTimePara"].InnerText;
|
|
//采集
|
|
CollectKeywordByTaobao.TaobaoCollect = bool.Parse(xn["taoBaoPara"].InnerText);
|
|
CollectKeywordByTaobao.Alibaba = bool.Parse(xn["alibabaPara"].InnerText);
|
|
CollectKeywordByTaobao.PinduoduoCollect = bool.Parse(xn["pinduoduoPara"].InnerText);
|
|
CollectKeywordByTaobao.DataCenter = bool.Parse(xn["dataCenterPara"].InnerText);
|
|
CollectKeywordByTaobao.AutoAdd = bool.Parse(xn["autoAddPara"].InnerText);
|
|
CollectKeywordByTaobao.PageTop = int.Parse(xn["maxPagePara"].InnerText);
|
|
CollectKeywordByTaobao.MaxSingleKeywordProduct = int.Parse(xn["singleKeywordPara"].InnerText);
|
|
CollectKeywordByTaobao.MinPrice = int.Parse(xn["priceStartPara"].InnerText);
|
|
CollectKeywordByTaobao.MaxPrice = int.Parse(xn["priceEndPara"].InnerText);
|
|
CollectKeywordByTaobao.MinSale = int.Parse(xn["soldStartPara"].InnerText);
|
|
CollectKeywordByTaobao.MaxSale = int.Parse(xn["soldEndPara"].InnerText);
|
|
CollectKeywordByTaobao.MainImageCut = int.Parse(xn["mainImagePara"].InnerText);
|
|
CollectKeywordByTaobao.FessionCount = int.Parse(xn["fessionCountPara"].InnerText);
|
|
CollectKeywordByTaobao.outKeywordrich = xn["outKeywordrichPara"].InnerText;
|
|
CollectKeywordByTaobao.addKeywordrich = xn["addKeywordrichPara"].InnerText;
|
|
//上传
|
|
UploadPinduoduoMain.MultiPrice = decimal.Parse(xn["multiPara"].InnerText);
|
|
UploadPinduoduoMain.MultiSavePrice = decimal.Parse(xn["multiPara"].InnerText);
|
|
UploadPinduoduoMain.Postage = decimal.Parse(xn["postagePara"].InnerText);
|
|
UploadPinduoduoMain.SinglePrice = decimal.Parse(xn["singlePricePara"].InnerText);
|
|
UploadPinduoduoMain.BeforePrice = decimal.Parse(xn["beforPricePara"].InnerText);
|
|
UploadPinduoduoMain.LimitBuy = int.Parse(xn["stockPara"].InnerText);
|
|
if (UploadPinduoduoMain.LimitBuy > 99)
|
|
UploadPinduoduoMain.LimitBuy = 99;
|
|
UploadPinduoduoMain.GroupCount = int.Parse(xn["groupCountPara"].InnerText);
|
|
UploadPinduoduoMain.RandPrice = bool.Parse(xn["randPara"].InnerText);
|
|
UploadPinduoduoMain.RandPrice1 = int.Parse(xn["randPrice1Para"].InnerText);
|
|
UploadPinduoduoMain.RandPrice2 = int.Parse(xn["randPrice2Para"].InnerText);
|
|
UploadPinduoduoMain.ImageBuild = bool.Parse(xn["imageBuildPara"].InnerText);
|
|
UploadPinduoduoMain.RandDeleteImage = bool.Parse(xn["randDeletePara"].InnerText);
|
|
UploadPinduoduoMain.PriceShield = bool.Parse(xn["priceShieldPara"].InnerText);
|
|
UploadPinduoduoMain.Irregularities = bool.Parse(xn["IrregularitiesPara"].InnerText);
|
|
UploadPinduoduoMain.RandSku = bool.Parse(xn["randSkuPara"].InnerText);
|
|
UploadPinduoduoMain.RandMainImage = bool.Parse(xn["randImagePara"].InnerText);
|
|
UploadPinduoduoMain.RandDesc = bool.Parse(xn["randDescPara"].InnerText);
|
|
UploadPinduoduoMain.JustFree = bool.Parse(xn["onlyFreePara"].InnerText);
|
|
UploadPinduoduoMain.PropImageToMain = bool.Parse(xn["propToMainPara"].InnerText);
|
|
UploadPinduoduoMain.DeleteMainImage = bool.Parse(xn["deleteMainImagePara"].InnerText);
|
|
UploadPinduoduoMain.DeleteMainImageCut = int.Parse(xn["mainImageCountPara"].InnerText);
|
|
UploadPinduoduoMain.DeleteFirst = bool.Parse(xn["deleteFirstPara"].InnerText);
|
|
UploadPinduoduoMain.JustSaveContentImage = bool.Parse(xn["saveAllImagePara"].InnerText);
|
|
UploadPinduoduoMain.JustSaveContentImageCount = int.Parse(xn["descImgCountPara"].InnerText);
|
|
UploadPinduoduoMain.PreFix = bool.Parse(xn["prefixPara"].InnerText);
|
|
UploadPinduoduoMain.PreFixTitle = xn["prefixTextPara"].InnerText;
|
|
UploadPinduoduoMain.ShopThreadCount = int.Parse(xn["shopthreadCountPara"].InnerText);
|
|
UploadPinduoduoMain.SingleThreadCount = int.Parse(xn["singeThreadCountPara"].InnerText);
|
|
UploadPinduoduoMain.MaxUpload = int.Parse(xn["singleUploadPara"].InnerText);
|
|
UploadPinduoduoMain.CutHand = bool.Parse(xn["catHardPara"].InnerText);
|
|
UploadPinduoduoMain.Relation = bool.Parse(xn["relationPara"].InnerText);
|
|
//替换
|
|
UploadPinduoduoMain.Days = int.Parse(xn["visitSpacePara"].InnerText);
|
|
CollectKeywordByTaobao.SaveCollect = bool.Parse(xn["saveCollectPara"].InnerText);
|
|
UploadPinduoduoMain.OffProduct = bool.Parse(xn["offCountPara"].InnerText);
|
|
UploadPinduoduoMain.OffProductCount = int.Parse(xn["offProductPara"].InnerText);
|
|
UploadPinduoduoMain.Irregularities = bool.Parse(xn["IrregularitiesPara"].InnerText);
|
|
UploadPinduoduoMain.NoNeerReplace = bool.Parse(xn["IrregularitiesPara"].InnerText);
|
|
UploadPinduoduoMain.NoNeerDays = int.Parse(xn["noNeerDaysPara"].InnerText);
|
|
UploadPinduoduoMain.LimitReplace = bool.Parse(xn["limitReplacePara"].InnerText);
|
|
UploadPinduoduoMain.ReplaceCount = int.Parse(xn["replaceCountPara"].InnerText);
|
|
UploadPinduoduoMain.ErrorDown = bool.Parse(xn["errorDownPara"].InnerText);
|
|
UploadPinduoduoMain.UseApi = bool.Parse(xn["apiPara"].InnerText);
|
|
}
|
|
catch
|
|
{
|
|
MessageBox.Show("配置文件异常,自动重置");
|
|
WriteFile();
|
|
}
|
|
InitProgress(1);
|
|
|
|
string name = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName);
|
|
int count = 0;
|
|
foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcesses())
|
|
{
|
|
if (thisproc.ProcessName.ToLower() == name.ToLower())
|
|
{
|
|
count++;
|
|
break;
|
|
}
|
|
}
|
|
InitProgress(1);
|
|
|
|
Task.Run(() => { /*GetPublicIp();*/ InitProgress(1); });
|
|
}
|
|
|
|
public static void GetPublicIp()
|
|
{
|
|
try
|
|
{
|
|
string url = " https://www.baidu.com/s?ie=utf-8&newi=1&mod=1&isbd=1&isid=84A468A54F829825&wd=" + GetHtml.UrlEncodeUtf8("本机iP地址查询") + "&rsv_spt=1&rsv_iqid=0xcb667698000f1fc5&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&rsv_dl=tb&rsv_sug3=2&rsv_n=2&rsv_sug1=1&rsv_sug7=100&inputT=9336&rsv_sug4=9993&rsv_sid=30747_1421_21089_30792_20692_30824_26350_22157&_ss=1&clist=&hsug=&f4s=1&csor=8&_cr1=29534";
|
|
string html = GetPostTaobaoHtml.UploadBaidu(url);
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"我的ip地址(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s*属于([\w\W]+?)。");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
BaseClass.IPAddress = m[j].Groups[1].Value;
|
|
BaseClass.IPAddressName = m[j].Groups[2].Value;
|
|
}
|
|
if (string.IsNullOrEmpty(BaseClass.IPAddress))
|
|
{
|
|
url = "https://www.ip.cn/api/index?ip=&type=0";
|
|
html = GetPostTaobaoHtml.UploadTaobao(url, "", true);
|
|
//{"rs":1,"code":0,"address":"中国 安徽省 合肥市 电信","ip":"183.160.113.181","isDomain":0}
|
|
BaseClass.IPAddress = BaseRegex.GetStringJson(ref html, "ip");
|
|
BaseClass.IPAddressName = BaseRegex.GetStringJson(ref html, "address");
|
|
}
|
|
//if (string.IsNullOrEmpty(BaseClass.IPAddress))
|
|
//{
|
|
// url = "http://ip.xianhua.com.cn/";
|
|
// html = GetPostTaobaoHtml.UploadTaobaoPost(url, "", true, "", false, "", 3);
|
|
// m = BaseRegex.GetMatchRegex(ref html, @"\[(.*?)]");
|
|
// for (int j = 0; m != null && j < m.Count; j++)
|
|
// {
|
|
// BaseClass.IPAddress = m[0].ToString().Trim('[').Trim(']');
|
|
// BaseClass.IPAddressName = m[1].ToString().Trim('[').Trim(']');
|
|
// }
|
|
//}
|
|
//if (string.IsNullOrEmpty(BaseClass.IPAddress))
|
|
//{
|
|
// url = "http://2000019.ip138.com/";
|
|
// html = GetPostTaobaoHtml.UploadTaobaoPost(url, "", true, "", false, "", 3);
|
|
// m = BaseRegex.GetMatchRegex(ref html, @"您的IP地址是:\s*\[([\w\W]+?)\]\s*来自:([\w\W]+?)</p>");
|
|
// for (int j = 0; m != null && j < m.Count; j++)
|
|
// {
|
|
// BaseClass.IPAddress = m[j].Groups[1].Value;
|
|
// BaseClass.IPAddressName = m[j].Groups[2].Value.Trim();
|
|
// }
|
|
//}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 检查更新
|
|
/// </summary>
|
|
private void Update()
|
|
{
|
|
//string upfilepath = Application.StartupPath + "\\Updatex.exe";
|
|
//File.WriteAllText(Application.StartupPath + "\\updateconfig.ini", BaseClass.VersionCount
|
|
//+ "\r\nhttps://update.qixiaoke.com/littlerabbit_update/uploader.php");
|
|
//if (File.Exists(upfilepath))
|
|
//{
|
|
// string fc = GetMD5(upfilepath);
|
|
// if (fc != "001EC5642914325F1DCF6E69BBA90738")
|
|
// {
|
|
// GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath);
|
|
// }
|
|
//}
|
|
//else//如果自动更新文件不存在,则强制更新主文件
|
|
// GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath);
|
|
//try
|
|
//{
|
|
// Process.Start(upfilepath);
|
|
//}
|
|
//catch
|
|
//{
|
|
//}
|
|
|
|
InitProgress(1);
|
|
}
|
|
|
|
public static void CheckUpdate()
|
|
{
|
|
try
|
|
{
|
|
// while (true)
|
|
{
|
|
string updatefilepath = System.Environment.CurrentDirectory + "\\Update.exe";
|
|
var url = BaseClass.BuildObjString("update/get_update");
|
|
var data = UserLogin.GetSignaturex();
|
|
var html = GetHtml.PostUtf8(url, data);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
|
return;
|
|
|
|
var updateExeChk = BaseRegex.GetStringJson(ref html, "exe_check").ParseToString();
|
|
var updateExeAddress = BaseRegex.GetStringJson(ref html, "exe_address");
|
|
var updateFileAddress = BaseRegex.GetStringJson(ref html, "file_address");
|
|
var newVersion = BaseRegex.GetIntJson(ref html, "next_version").ParseToInt();
|
|
|
|
if (File.Exists(updatefilepath))
|
|
{
|
|
string fc = BaseClass.GetFileMd5(updatefilepath);
|
|
if (fc != updateExeChk)
|
|
{
|
|
NaiBa.Util.Helper.HttpHelper.DownloadFile(updateExeAddress, updatefilepath);
|
|
}
|
|
}
|
|
else // 如果自动更新exe文件不存在,则强制更新exe文件
|
|
NaiBa.Util.Helper.HttpHelper.DownloadFile(updateExeAddress, updatefilepath);
|
|
|
|
if (newVersion > BaseClass.VersionCount)
|
|
{
|
|
try
|
|
{
|
|
if (File.Exists(updatefilepath))
|
|
{
|
|
File.WriteAllText(System.Environment.CurrentDirectory + "\\UpdateConfig.ini",
|
|
"TemuKJD\r\n" +
|
|
BaseClass.VersionCount + "\r\n" +
|
|
newVersion + "\r\n" +
|
|
updateFileAddress);
|
|
|
|
Process.Start(updatefilepath);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//BaseMsgForm.ShowError(ex.Message);
|
|
}
|
|
}
|
|
//Thread.Sleep(1000 * 60 * 60);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//BaseMsgForm.ShowError(ex.Message);
|
|
}
|
|
InitProgress(1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取签名验证配置
|
|
/// </summary>
|
|
private void GetAuthConfig()
|
|
{
|
|
string sUrl = BaseClass.LoginApiUrl + "/?obj=api/config&act=auth_config";
|
|
//string sAuthConfig = HttpHelper.Get(new HttpParam { Url = sUrl });
|
|
string sAuthConfig = GetHtml.PostUtf8(sUrl, "");
|
|
if (string.IsNullOrEmpty(sAuthConfig)) return;
|
|
BaseClass.NewSignatureAuth = sAuthConfig.Equals("1");
|
|
InitProgress(1);
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取文件MD5值
|
|
/// </summary>
|
|
/// <param name="FilePath"></param>
|
|
/// <returns></returns>
|
|
public static string GetMD5(string FilePath)
|
|
{
|
|
try
|
|
{
|
|
FileStream get_file = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
System.Security.Cryptography.MD5CryptoServiceProvider get_md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
|
byte[] hash_byte = get_md5.ComputeHash(get_file);
|
|
string resule = System.BitConverter.ToString(hash_byte);
|
|
resule = resule.Replace("-", "");
|
|
get_file.Close();
|
|
return resule;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查所有配置选项是否存在
|
|
/// </summary>
|
|
/// <param name="checkstring">检查项目和默认值</param>
|
|
private void CheckXmlValue(string checkstring, string file)
|
|
{
|
|
checkstring = checkstring.Replace("\r\n", "").Replace("\n", "");
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
xmlDoc.Load(file);
|
|
XmlNode xn = xmlDoc.SelectSingleNode("ConfigSet");
|
|
string[] list = checkstring.Split(';');
|
|
bool mustsave = false;
|
|
for (int i = 0; i < list.Length; i++)
|
|
{
|
|
if (string.IsNullOrEmpty(list[i]))
|
|
continue;
|
|
string[] l = list[i].Split(',');
|
|
if (xn[l[0]] == null)
|
|
{
|
|
mustsave = true;
|
|
XmlElement element2 = xmlDoc.CreateElement(l[0].Trim());
|
|
element2.InnerText = l[1];
|
|
xn.AppendChild(element2);
|
|
}
|
|
}
|
|
if (mustsave)
|
|
xmlDoc.Save(file);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存配置
|
|
/// </summary>
|
|
public void SaveConfig()
|
|
{
|
|
try
|
|
{
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
xmlDoc.Load(ConfigFilePach);
|
|
XmlNode xn = xmlDoc.SelectSingleNode("ConfigSet");
|
|
xn["WaitTime"].InnerText = BaseClass.WaitTime.ToString();
|
|
xn["ThreadCount"].InnerText = BaseClass.ThreadCount.ToString();
|
|
xn["OrderStep"].InnerText = BaseClass.OrderStep.ToString();
|
|
xn["RankPage"].InnerText = BaseClass.RankPage.ToString();
|
|
xn["UserName"].InnerText = BaseClass.UserName;
|
|
xn["PassWord"].InnerText = BaseClass.Remember ? BaseClass.PassWord : "";
|
|
xn["HadNoteId"].InnerText = BaseClass.HadNoteId;
|
|
xn["RememberPass"].InnerText = BaseClass.Remember.ToString();
|
|
xn["AutoLogin"].InnerText = BaseClass.AutoLogin.ToString();
|
|
|
|
xn["MinPrice"].InnerText = BaseClass.MinPrice.ToString();
|
|
xn["MaxPrice"].InnerText = BaseClass.MaxPrice.ToString();
|
|
xn["MinBackMoney"].InnerText = BaseClass.MinBackMoney.ToString();
|
|
xn["MinPercent"].InnerText = BaseClass.MinPercent.ToString();
|
|
xn["MinLevel"].InnerText = BaseClass.MinLevel.ToString();
|
|
xn["MinSales"].InnerText = BaseClass.MinSales.ToString();
|
|
xn["AlimamaPageCount"].InnerText = BaseClass.AlimamaPageCount.ToString();
|
|
xn["CloudTitle"].InnerText = BaseClass.CloudTitle.ToString();
|
|
xn["CloudBrand"].InnerText = BaseClass.CloudBrand.ToString();
|
|
xn["CloudSellerNick"].InnerText = BaseClass.CloudSellerNick.ToString();
|
|
xn["ImageSheild"].InnerText = BaseClass.ImageSheild.ToString();
|
|
xn["CloudProduct"].InnerText = BaseClass.CloudProduct.ToString();
|
|
xn["NoKeyword"].InnerText = BaseClass.NoKeyword;
|
|
//自动上下架
|
|
xn["noSoldPara"].InnerText = UploadPinduoduoMain.NoSold.ToString();
|
|
xn["visitPara"].InnerText = UploadPinduoduoMain.NoVisit.ToString();
|
|
xn["visitCountPara"].InnerText = UploadPinduoduoMain.VisitCount.ToString();
|
|
xn["offTimePara"].InnerText = UploadPinduoduoMain.offTime;
|
|
xn["onTimePara"].InnerText = UploadPinduoduoMain.onTime;
|
|
//采集
|
|
xn["taoBaoPara"].InnerText = CollectKeywordByTaobao.TaobaoCollect.ToString();
|
|
xn["alibabaPara"].InnerText = CollectKeywordByTaobao.Alibaba.ToString();
|
|
xn["pinduoduoPara"].InnerText = CollectKeywordByTaobao.PinduoduoCollect.ToString();
|
|
xn["dataCenterPara"].InnerText = CollectKeywordByTaobao.DataCenter.ToString();
|
|
xn["autoAddPara"].InnerText = CollectKeywordByTaobao.AutoAdd.ToString();
|
|
xn["maxPagePara"].InnerText = CollectKeywordByTaobao.PageTop.ToString();
|
|
xn["singleKeywordPara"].InnerText = CollectKeywordByTaobao.MaxSingleKeywordProduct.ToString();
|
|
xn["priceStartPara"].InnerText = CollectKeywordByTaobao.MinPrice.ToString();
|
|
xn["priceEndPara"].InnerText = CollectKeywordByTaobao.MaxPrice.ToString();
|
|
xn["soldStartPara"].InnerText = CollectKeywordByTaobao.MinSale.ToString();
|
|
xn["soldEndPara"].InnerText = CollectKeywordByTaobao.MaxSale.ToString();
|
|
xn["mainImagePara"].InnerText = CollectKeywordByTaobao.MainImageCut.ToString();
|
|
xn["fessionCountPara"].InnerText = CollectKeywordByTaobao.FessionCount.ToString();
|
|
xn["outKeywordrichPara"].InnerText = CollectKeywordByTaobao.outKeywordrich.Replace("\n", "\\");
|
|
xn["addKeywordrichPara"].InnerText = CollectKeywordByTaobao.addKeywordrich.Replace("\n", "\\");
|
|
|
|
//上传
|
|
xn["multiPara"].InnerText = UploadPinduoduoMain.MultiSavePrice.ToString();
|
|
xn["postagePara"].InnerText = UploadPinduoduoMain.Postage.ToString();
|
|
xn["singlePricePara"].InnerText = UploadPinduoduoMain.SinglePrice.ToString();
|
|
xn["beforPricePara"].InnerText = UploadPinduoduoMain.BeforePrice.ToString();
|
|
xn["stockPara"].InnerText = UploadPinduoduoMain.LimitBuy.ToString();
|
|
xn["groupCountPara"].InnerText = UploadPinduoduoMain.GroupCount.ToString();
|
|
xn["randPara"].InnerText = UploadPinduoduoMain.RandPrice.ToString();
|
|
xn["randPrice1Para"].InnerText = UploadPinduoduoMain.RandPrice1.ToString();
|
|
xn["randPrice2Para"].InnerText = UploadPinduoduoMain.RandPrice2.ToString();
|
|
xn["imageBuildPara"].InnerText = UploadPinduoduoMain.ImageBuild.ToString();
|
|
xn["randDeletePara"].InnerText = UploadPinduoduoMain.RandDeleteImage.ToString();
|
|
xn["priceShieldPara"].InnerText = UploadPinduoduoMain.PriceShield.ToString();
|
|
xn["IrregularitiesPara"].InnerText = UploadPinduoduoMain.Irregularities.ToString();
|
|
xn["randSkuPara"].InnerText = UploadPinduoduoMain.RandSku.ToString();
|
|
xn["randImagePara"].InnerText = UploadPinduoduoMain.RandMainImage.ToString();
|
|
xn["randDescPara"].InnerText = UploadPinduoduoMain.RandDesc.ToString();
|
|
xn["onlyFreePara"].InnerText = UploadPinduoduoMain.JustFree.ToString();
|
|
xn["propToMainPara"].InnerText = UploadPinduoduoMain.PropImageToMain.ToString();
|
|
xn["deleteMainImagePara"].InnerText = UploadPinduoduoMain.DeleteMainImage.ToString();
|
|
xn["mainImageCountPara"].InnerText = UploadPinduoduoMain.DeleteMainImageCut.ToString();
|
|
xn["deleteFirstPara"].InnerText = UploadPinduoduoMain.DeleteFirst.ToString();
|
|
xn["saveAllImagePara"].InnerText = UploadPinduoduoMain.JustSaveContentImage.ToString();
|
|
xn["descImgCountPara"].InnerText = UploadPinduoduoMain.JustSaveContentImageCount.ToString();
|
|
xn["prefixPara"].InnerText = UploadPinduoduoMain.PreFix.ToString();
|
|
xn["prefixTextPara"].InnerText = UploadPinduoduoMain.PreFixTitle.ToString();
|
|
xn["shopthreadCountPara"].InnerText = UploadPinduoduoMain.ShopThreadCount.ToString();
|
|
xn["singeThreadCountPara"].InnerText = UploadPinduoduoMain.SingleThreadCount.ToString();
|
|
xn["singleUploadPara"].InnerText = UploadPinduoduoMain.MaxUpload.ToString();
|
|
xn["catHardPara"].InnerText = UploadPinduoduoMain.CutHand.ToString();
|
|
xn["relationPara"].InnerText = UploadPinduoduoMain.Relation.ToString();
|
|
//替换
|
|
xn["visitSpacePara"].InnerText = UploadPinduoduoMain.Days.ToString();
|
|
xn["saveCollectPara"].InnerText = CollectKeywordByTaobao.SaveCollect.ToString();
|
|
xn["offCountPara"].InnerText = UploadPinduoduoMain.OffProduct.ToString();
|
|
xn["offProductPara"].InnerText = UploadPinduoduoMain.OffProductCount.ToString();
|
|
xn["IrregularitiesPara"].InnerText = UploadPinduoduoMain.Irregularities.ToString();
|
|
xn["IrregularitiesPara"].InnerText = UploadPinduoduoMain.NoNeerReplace.ToString();
|
|
xn["noNeerDaysPara"].InnerText = UploadPinduoduoMain.NoNeerDays.ToString();
|
|
xn["limitReplacePara"].InnerText = UploadPinduoduoMain.LimitReplace.ToString();
|
|
xn["replaceCountPara"].InnerText = UploadPinduoduoMain.ReplaceCount.ToString();
|
|
xn["errorDownPara"].InnerText = UploadPinduoduoMain.ErrorDown.ToString();
|
|
xn["apiPara"].InnerText = UploadPinduoduoMain.UseApi.ToString();
|
|
|
|
xmlDoc.Save(ConfigFilePach);
|
|
}
|
|
catch
|
|
{
|
|
BaseClass.ViewCode += "保存配置信息出错,请删除配置文件,重试\n";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 写入配置文件
|
|
/// </summary>
|
|
public void WriteFile()
|
|
{
|
|
string content = @"<?xml version=""1.0"" encoding=""utf-8""?>
|
|
<ConfigSet>
|
|
<WaitTime>1000</WaitTime>
|
|
<ThreadCount>1</ThreadCount>
|
|
<UserName></UserName>
|
|
<PassWord></PassWord>
|
|
<AutoLogin>False</AutoLogin>
|
|
<RememberPass>True</RememberPass>
|
|
<HadNoteId></HadNoteId>
|
|
<OrderStep>1</OrderStep>
|
|
<RankPage>3</RankPage>
|
|
<MinPrice>10</MinPrice>
|
|
<MaxPrice>300</MaxPrice>
|
|
<MinSales>1</MinSales>
|
|
<MinLevel>5</MinLevel>
|
|
<MinBackMoney>5</MinBackMoney>
|
|
<MinPercent>2</MinPercent>
|
|
<CloudTitle>True</CloudTitle>
|
|
<CloudBrand>True</CloudBrand>
|
|
<CloudSellerNick>True</CloudSellerNick>
|
|
<CloudProduct>True</CloudProduct>
|
|
<AlimamaPageCount>50</AlimamaPageCount>
|
|
</ConfigSet>";
|
|
FileBase.WriteAllText(ConfigFilePach, content, Encoding.UTF8);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取机器码
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public void GetMacCode()
|
|
{
|
|
string Info = ""; //cpu序列号
|
|
try
|
|
{
|
|
ManagementClass cimobject = new ManagementClass("Win32_Processor");
|
|
ManagementObjectCollection moc = cimobject.GetInstances();
|
|
foreach (ManagementObject mo in moc)
|
|
{
|
|
Info = mo.Properties["ProcessorId"].Value.ToString();
|
|
break;
|
|
}
|
|
Info += "@";
|
|
ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
|
|
ManagementObjectCollection moc1 = cimobject1.GetInstances();
|
|
foreach (ManagementObject mo in moc1)
|
|
{
|
|
if (string.IsNullOrEmpty(mo["signature"]?.ToString()) || mo["signature"].ToString() == "0" || mo.Properties["Model"].Value.ToString().IndexOf("USB") > -1)
|
|
{
|
|
continue;
|
|
}
|
|
Info += mo.Properties["Model"].Value + "," + mo["SerialNumber"] + ";"; //硬盘型号、硬盘ID
|
|
}
|
|
Info = Info.Substring(0, Info.Length - 1);
|
|
Info = Info.Replace(" ", "");
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
InitProgress(1);
|
|
BaseClass.MacInfo = Info;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 校准时间
|
|
/// </summary>
|
|
private void UpdateTime()
|
|
{
|
|
string t = GetHtml.Utf8(BaseClass.LoginApiUrl + "time.php");
|
|
if (string.IsNullOrEmpty(t))
|
|
return;
|
|
DateTime dt;
|
|
if (!DateTime.TryParse(t, out dt))
|
|
{
|
|
MessageBox.Show("连接服务器失败,将导致无法登录", "请检查防火墙设置");
|
|
return;
|
|
}
|
|
int s = BaseClass.DateTimeToTimestampSeconds(dt);
|
|
int a = BaseClass.DateTimeToTimestampSeconds(DateTime.Now);
|
|
BaseClass.TimeDifferent = s - a;
|
|
//SetDate(dt); //设置系统时间
|
|
}
|
|
public static bool IsBase64(string str)
|
|
{
|
|
try
|
|
{
|
|
string pattern = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$";
|
|
return Regex.IsMatch(str, pattern);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static string Base64Encrypt(string encrypt)
|
|
{
|
|
try
|
|
{
|
|
return Convert.ToBase64String(Encoding.UTF8.GetBytes(encrypt));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return encrypt;
|
|
}
|
|
}
|
|
|
|
public static string Base64Decrypt(string decrypt)
|
|
{
|
|
try
|
|
{
|
|
return Encoding.UTF8.GetString(Convert.FromBase64String(decrypt));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return decrypt;
|
|
}
|
|
}
|
|
|
|
private void CheckFiles()
|
|
{
|
|
if (!Directory.Exists("config"))
|
|
Directory.CreateDirectory("config");
|
|
if (!Directory.Exists("x64"))
|
|
Directory.CreateDirectory("x64");
|
|
if (!Directory.Exists("x86"))
|
|
Directory.CreateDirectory("x86");
|
|
//if (!Directory.Exists("ru-ru"))
|
|
// Directory.CreateDirectory("ru-ru");
|
|
if (!Directory.Exists("temp"))
|
|
Directory.CreateDirectory("temp");
|
|
//if (!Directory.Exists("temp/image"))
|
|
// Directory.CreateDirectory("temp/image");
|
|
|
|
|
|
|
|
if (!FileBase.Exists("FiddlerCore4.dll"))
|
|
if (GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/" + "FiddlerCore4.dll", "FiddlerCore4.dll" + ".bak"))
|
|
FileBase.Move("FiddlerCore4.dll" + ".bak", "FiddlerCore4.dll");
|
|
if (!FileBase.Exists("temp\\pdd_chance_cate.cty"))
|
|
if (GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/" + "pdd_chance_cate.dll", "temp\\pdd_chance_cate.dll" + ".bak"))
|
|
FileBase.Move("temp\\pdd_chance_cate.dll" + ".bak", "temp\\pdd_chance_cate.cty");
|
|
if (!FileBase.Exists("temp\\9527.wav"))
|
|
if (GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/Sound/" + "9527.wav", "temp\\9527.wav" + ".bak"))
|
|
FileBase.Move("temp\\9527.wav" + ".bak", "temp\\9527.wav");
|
|
for (int i = 1; i<= 20; i++)
|
|
{
|
|
string fileName = "temp\\" + i + "号电脑.mp3";
|
|
if (!FileBase.Exists(fileName))
|
|
if (GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/Sound/" + "9527.wav", fileName + ".bak"))
|
|
FileBase.Move(fileName + ".bak", fileName);
|
|
}
|
|
//ZipFile.ExtractToDirectory(tempFile, upTempPath);
|
|
//File.Delete(tempFile);
|
|
if (!FileBase.Exists("temp\\wxCat"))
|
|
{
|
|
if(GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/" + "wxCat.zip", "temp\\wxCat.dll" + ".bak"))
|
|
{
|
|
FileBase.Move("temp\\wxCat.dll" + ".bak", "temp\\wxCat.zip");
|
|
ZipFile.ExtractToDirectory(Path.Combine(Environment.CurrentDirectory, "temp\\wxCat.zip"), Path.Combine(Environment.CurrentDirectory, "temp"));
|
|
File.Delete(Path.Combine(Environment.CurrentDirectory, "temp\\wxCat.zip"));
|
|
}
|
|
}
|
|
|
|
/*
|
|
List<KeyValueBase> files = new List<KeyValueBase>();
|
|
files.Add(new KeyValueBase("标题包含过滤_new.txt", "config/标题包含过滤x.ini"));
|
|
files.Add(new KeyValueBase("标题过滤词_new.txt", "config/标题过滤词x.ini"));
|
|
files.Add(new KeyValueBase("标题过滤词_new.txt", "config/标题去除词x.ini"));
|
|
files.Add(new KeyValueBase("品牌属性过滤_new.txt", "config/品牌属性过滤x.ini"));
|
|
files.Add(new KeyValueBase("属性过滤词_new.txt", "config/属性过滤词x.ini"));
|
|
files.Add(new KeyValueBase("ids_20200602.dll", "temp/ids.dll"));
|
|
files.Add(new KeyValueBase("tids_20200602.dll", "temp/tids.dll"));
|
|
files.Add(new KeyValueBase("crawlerInfo.js", "crawlerInfo.js"));
|
|
files.Add(new KeyValueBase("pdd.ico", "pdd.dat"));
|
|
files.Add(new KeyValueBase("anti_content.js", "anti_content.js"));
|
|
files.Add(new KeyValueBase("taobao_address.js", "taobao_address.tjm"));
|
|
files.Add(new KeyValueBase("1688address.js", "1688_address.tjm"));
|
|
files.Add(new KeyValueBase("crawlerInfoInterface.js", "crawlerInfoInterface.js"));
|
|
files.Add(new KeyValueBase("Interop.MSScriptControl.ico", "Interop.MSScriptControl.dll"));
|
|
files.Add(new KeyValueBase("taobao_cat.ico", "taobao_cat.ico"));
|
|
files.Add(new KeyValueBase("segment1.2.dll", "segment.dll", "C8057AEA79E32985670BC41D39C3349B"));
|
|
files.Add(new KeyValueBase("UserAgent.txt", "temp/UserAgent.txt"));
|
|
files.Add(new KeyValueBase("simplepwd.txt", "temp/simplepwd.txt"));
|
|
//java v8引擎
|
|
files.Add(new KeyValueBase("ru-ru/JavaScriptEngineSwitcher.Core.resources.dll", "ru-ru/JavaScriptEngineSwitcher.Core.resources.dll"));
|
|
files.Add(new KeyValueBase("x64/ClearScriptV8-64.dll", "x64/ClearScriptV8-64.dll"));
|
|
files.Add(new KeyValueBase("x64/v8-base-x64.dll", "x64/v8-base-x64.dll"));
|
|
files.Add(new KeyValueBase("x64/v8-x64.dll", "x64/v8-x64.dll"));
|
|
files.Add(new KeyValueBase("x86/ClearScriptV8-32.dll", "x86/ClearScriptV8-32.dll"));
|
|
files.Add(new KeyValueBase("x86/v8-base-ia32.dll", "x86/v8-base-ia32.dll"));
|
|
files.Add(new KeyValueBase("x86/v8-ia32.dll", "x86/v8-ia32.dll"));
|
|
files.Add(new KeyValueBase("AdvancedStringBuilder.dll", "AdvancedStringBuilder.dll"));
|
|
files.Add(new KeyValueBase("ClearScript.dll", "ClearScript.dll"));
|
|
files.Add(new KeyValueBase("ClearScriptV8-32.dll", "ClearScriptV8-32.dll"));
|
|
files.Add(new KeyValueBase("ClearScriptV8-64.dll", "ClearScriptV8-64.dll"));
|
|
files.Add(new KeyValueBase("JavaScriptEngineSwitcher.Core.dll", "JavaScriptEngineSwitcher.Core.dll"));
|
|
files.Add(new KeyValueBase("JavaScriptEngineSwitcher.V8.dll", "JavaScriptEngineSwitcher.V8.dll"));
|
|
files.Add(new KeyValueBase("v8-ia32.dll", "v8-ia32.dll"));
|
|
files.Add(new KeyValueBase("v8-x64.dll", "v8-x64.dll"));
|
|
files.Add(new KeyValueBase("DB.dll", "DB.dll"));
|
|
files.Add(new KeyValueBase("System.Data.SQLite.DLL", "System.Data.SQLite.DLL"));
|
|
//files.Add(new KeyValueBase("FindLittleRabbitOrder.exe", "FindLittleRabbitOrder.exe"));
|
|
|
|
files.Add(new KeyValueBase("9527_new.ico", "temp/9527.wav"));
|
|
files.Add(new KeyValueBase("tipaudio1_new.ico", "temp/1号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio2_new.ico", "temp/2号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio3_new.ico", "temp/3号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio4_new.ico", "temp/4号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio5_new.ico", "temp/5号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio6_new.ico", "temp/6号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio7_new.ico", "temp/7号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio8_new.ico", "temp/8号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio9_new.ico", "temp/9号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio10_new.ico", "temp/10号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio11_new.ico", "temp/11号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio12_new.ico", "temp/12号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio13_new.ico", "temp/13号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio14_new.ico", "temp/14号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio15_new.ico", "temp/15号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio16_new.ico", "temp/16号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio17_new.ico", "temp/17号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio18_new.ico", "temp/18号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio19_new.ico", "temp/19号电脑.mp3"));
|
|
files.Add(new KeyValueBase("tipaudio20_new.ico", "temp/20号电脑.mp3"));
|
|
|
|
foreach (KeyValueBase k in files)
|
|
{
|
|
string md5 = GetMD5(k.Value);
|
|
if (FileBase.Exists(k.Value) && string.IsNullOrEmpty(k.CatName) || !string.IsNullOrEmpty(k.CatName) && md5 == k.CatName)
|
|
continue;
|
|
if (GetHtml.DownloadFile("http://dl.qixiaoke.com/files/" + k.Key, k.Key + ".bak"))
|
|
FileBase.Move(k.Key + ".bak", k.Value);
|
|
|
|
InitProgress(1);
|
|
}
|
|
|
|
List<KeyValueBase> cef_files = new List<KeyValueBase>();
|
|
cef_files.Add(new KeyValueBase("cef.pak", "cef.pak"));
|
|
cef_files.Add(new KeyValueBase("cef_100_percent.pak", "cef_100_percent.pak"));
|
|
cef_files.Add(new KeyValueBase("cef_200_percent.pak", "cef_200_percent.pak"));
|
|
cef_files.Add(new KeyValueBase("cef_extensions.pak", "cef_extensions.pak"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.BrowserSubprocess.Core.dll", "CefSharp.BrowserSubprocess.Core.dll"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.BrowserSubprocess.exe", "CefSharp.BrowserSubprocess.exe"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.Core.dll", "CefSharp.Core.dll"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.Core.xml", "CefSharp.Core.xml"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.dll", "CefSharp.dll"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.WinForms.dll", "CefSharp.WinForms.dll"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.WinForms.XML", "CefSharp.WinForms.XML"));
|
|
cef_files.Add(new KeyValueBase("CefSharp.XML", "CefSharp.XML"));
|
|
cef_files.Add(new KeyValueBase("chrome_elf.dll", "chrome_elf.dll"));
|
|
cef_files.Add(new KeyValueBase("d3dcompiler_47.dll", "d3dcompiler_47.dll"));
|
|
cef_files.Add(new KeyValueBase("devtools_resources.pak", "devtools_resources.pak"));
|
|
cef_files.Add(new KeyValueBase("icudtl.dat", "icudtl.dat"));
|
|
cef_files.Add(new KeyValueBase("libcef.dll", "libcef.dll"));
|
|
cef_files.Add(new KeyValueBase("libEGL.dll", "libEGL.dll"));
|
|
cef_files.Add(new KeyValueBase("libGLESv2.dll", "libGLESv2.dll"));
|
|
cef_files.Add(new KeyValueBase("natives_blob.bin", "natives_blob.bin"));
|
|
cef_files.Add(new KeyValueBase("snapshot_blob.bin", "snapshot_blob.bin"));
|
|
cef_files.Add(new KeyValueBase("v8_context_snapshot.bin", "v8_context_snapshot.bin"));
|
|
if (!File.Exists("cef_config") || cef_files.Any(c => File.Exists(c.Key + ".bak")))
|
|
{
|
|
try
|
|
{
|
|
foreach (KeyValueBase k in cef_files)
|
|
{
|
|
string md5 = GetMD5(k.Value);
|
|
//if (FileBase.Exists(k.Value) && string.IsNullOrEmpty(k.CatName) || !string.IsNullOrEmpty(k.CatName) && md5 == k.CatName)
|
|
// continue;
|
|
if (GetHtml.DownloadFile("http://dl.qixiaoke.com/files/cef79/" + k.Key, k.Key + ".bak"))
|
|
FileBase.Move(k.Key + ".bak", k.Value);
|
|
|
|
InitProgress(1);
|
|
}
|
|
File.Create("cef_config");
|
|
}
|
|
catch
|
|
{
|
|
IsCheckFilesSuccesss = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
InitProgress(20);
|
|
}*/
|
|
Task.Run(() => { new AddressSetIni().Ini(); InitProgress(1); });
|
|
Task.Run(() => { new AddressSetIni().getAddress1688(); InitProgress(1); });
|
|
Task.Run(() => { FromTitleToCat.Ini(); InitProgress(1); });
|
|
Task.Run(() => { Segment.Int(); InitProgress(1); }); // 加载分词文件
|
|
Thread t = new Thread(UploadPinduoduoProperties.Ini);
|
|
t.Priority = ThreadPriority.Lowest;
|
|
t.Start();
|
|
|
|
try
|
|
{
|
|
////加载违规商品Id
|
|
//string idslines = File.ReadAllText("temp/ids.dll", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(idslines))
|
|
//{
|
|
// foreach (string s in idslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
// {
|
|
// if (string.IsNullOrEmpty(s) || s == "0" || s.Contains("?") || s.Contains("@"))
|
|
// continue;
|
|
// if (s.Trim().Length < 2)
|
|
// continue;
|
|
// UploadPinduoduoMain.RuleIds.Add(s);
|
|
// }
|
|
//}
|
|
////加载违规商品标题
|
|
//string tidslines = File.ReadAllText("temp/tids.dll", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(tidslines))
|
|
//{
|
|
// foreach (string s in tidslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
// {
|
|
// if (string.IsNullOrEmpty(s) || s == "0")
|
|
// continue;
|
|
// if (s.Trim().Length < 2)
|
|
// continue;
|
|
// UploadPinduoduoMain.RuleTitles.Add(s);
|
|
// }
|
|
//}
|
|
|
|
InitProgress(1);
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
|
|
//加载配置文件
|
|
//string lines = File.ReadAllText("config/标题过滤词x.ini", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(lines))
|
|
//{
|
|
// if (IsBase64(lines))
|
|
// {
|
|
// lines = Base64Decrypt(lines);
|
|
// }
|
|
// foreach (string s in lines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
// {
|
|
// if (string.IsNullOrEmpty(s))
|
|
// continue;
|
|
// if (s.Trim().Length < 2)
|
|
// continue;
|
|
// AlibabaShop.NoTitleWords.Add(s.Trim());
|
|
// }
|
|
//
|
|
InitProgress(1);
|
|
//}
|
|
|
|
//lines = File.ReadAllText("config/属性过滤词x.ini", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(lines))
|
|
//{
|
|
//if (IsBase64(lines))
|
|
//{
|
|
//lines = Base64Decrypt(lines);
|
|
//}
|
|
//foreach (string s in lines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
//{
|
|
//if (string.IsNullOrEmpty(s))
|
|
//continue;
|
|
//AlibabaShop.NoPropWords.Add(s.Trim());
|
|
//}
|
|
|
|
InitProgress(1);
|
|
//}
|
|
//lines = File.ReadAllText("config/品牌属性过滤x.ini", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(lines))
|
|
//{
|
|
//if (IsBase64(lines))
|
|
//{
|
|
//lines = Base64Decrypt(lines);
|
|
//}
|
|
//foreach (string s in lines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
//{
|
|
//if (string.IsNullOrEmpty(s))
|
|
//continue;
|
|
//AlibabaShop.NoBrandName.Add(s.Trim());
|
|
//}
|
|
|
|
InitProgress(1);
|
|
//}
|
|
//lines = File.ReadAllText("config/标题包含过滤x.ini", Encoding.Default);
|
|
//if (!string.IsNullOrEmpty(lines))
|
|
//{
|
|
//if (IsBase64(lines))
|
|
//{
|
|
//lines = Base64Decrypt(lines);
|
|
//}
|
|
//foreach (string s in lines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
|
//{
|
|
//if (string.IsNullOrEmpty(s))
|
|
//continue;
|
|
//AlibabaShop.TitleCantHad.Add(s.Trim());
|
|
//}
|
|
|
|
InitProgress(1);
|
|
//}
|
|
}
|
|
|
|
public static bool IsUseSystemProxy()
|
|
{
|
|
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
|
|
IWebProxy systemWebProxy = WebRequest.GetSystemWebProxy();
|
|
FieldInfo field1 = systemWebProxy.GetType().GetField("webProxy", bindingAttr);
|
|
if (field1 != (FieldInfo)null)
|
|
{
|
|
WebProxy webProxy = field1.GetValue((object)systemWebProxy) as WebProxy;
|
|
FieldInfo field2 = webProxy.GetType().GetField("_ProxyHostAddresses", bindingAttr);
|
|
if (field2 != (FieldInfo)null)
|
|
{
|
|
Hashtable hashtable = field2.GetValue((object)webProxy) as Hashtable;
|
|
if (hashtable != null && hashtable.Count > 0)
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static string GetRandKey(int len)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < len; i++)
|
|
{
|
|
sb.Append("," + Randomx.GetId(127));
|
|
}
|
|
return sb.ToString(1, sb.Length - 1);
|
|
}
|
|
|
|
public void Encode(ref byte[] f, string key)
|
|
{
|
|
string[] l = key.Split(',');
|
|
List<byte> k = new List<byte>();
|
|
foreach (string s in l)
|
|
{
|
|
k.Add(byte.Parse(s));
|
|
}
|
|
int j = 0, a = 0;
|
|
for (int i = 0; i < f.Length; i++)
|
|
{
|
|
if (k[j] + f[i] > 255)
|
|
f[i] = (byte)(k[j] + f[i] - 255);
|
|
else
|
|
f[i] = (byte)(k[j] + f[i]);
|
|
j++;
|
|
j += a;
|
|
if (j >= k.Count)
|
|
{
|
|
j -= k.Count;
|
|
a++;
|
|
if (a >= k.Count / 2)
|
|
a = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Decode(ref byte[] f, string key)
|
|
{
|
|
string[] l = key.Split(',');
|
|
List<byte> k = new List<byte>();
|
|
foreach (string s in l)
|
|
{
|
|
k.Add(byte.Parse(s));
|
|
}
|
|
int j = 0, a = 0;
|
|
for (int i = 0; i < f.Length; i++)
|
|
{
|
|
if (f[i] - k[j] < 0)
|
|
f[i] = (byte)(f[i] + 255 - k[j]);
|
|
else
|
|
f[i] = (byte)(f[i] - k[j]);
|
|
|
|
j++;
|
|
j += a;
|
|
if (j >= k.Count)
|
|
{
|
|
j -= k.Count;
|
|
a++;
|
|
if (a >= k.Count / 2)
|
|
a = 0;
|
|
}
|
|
}
|
|
}
|
|
public static string IEUserAgent = "";
|
|
public void GetBaiduCookies()
|
|
{
|
|
Thread.Sleep(10 * 60 * 1000);
|
|
string url = "http://www.baidu.com/";
|
|
//string userAgent = IECookies.GetUserAgent();
|
|
string cookies = IECookies.GetCookies(url);
|
|
if (string.IsNullOrEmpty(IEUserAgent) || string.IsNullOrEmpty(cookies) || cookies.Length < 100)
|
|
return;
|
|
url = BaseClass.BuildObjString("cookies&act=save");
|
|
string data = UserLogin.GetSignaturex() + "&user_agent=" + GetHtml.UrlEncodeUtf8(IEUserAgent) + "&cookies=" + GetHtml.UrlEncodeUtf8(cookies);
|
|
string html = GetHtml.PostUtf8(url, data);
|
|
}
|
|
}
|
|
}
|