temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
@@ -0,0 +1,689 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AllBase;
|
||||
using CefSharp;
|
||||
using Cookie = System.Net.Cookie;
|
||||
|
||||
namespace Work.CollectClass
|
||||
{
|
||||
|
||||
public class SetCookiesUserInfo
|
||||
{
|
||||
public static bool ReflashUsers = false;
|
||||
public static bool ReflashPinUsers = false;
|
||||
public static bool ReflashFunUsers = false;
|
||||
public static bool ReflashRepUsers = false;
|
||||
public static bool ReflashTaoBaoUsers = false;
|
||||
public static bool SlipaceReflashUsers = false;
|
||||
public static bool ALReflashUsers = false;
|
||||
public static bool ALReflashFunUsers = false;
|
||||
public static string UserName = "";
|
||||
public static string TaoBaoUserName = "";
|
||||
public static string SlipaceUserName = "";
|
||||
public static string ALUserName = "";
|
||||
public static string PayMobile = "";
|
||||
public static string SlipacePayMobile = "";
|
||||
public static string ALPayMobile = "";
|
||||
public static string CookiesString = "";
|
||||
public static Dictionary<string, UserCookies> UserCookies = new Dictionary<string, UserCookies>();
|
||||
public static Dictionary<string, UserSlipaceCookies> UserSlipaceCookies = new Dictionary<string, UserSlipaceCookies>();
|
||||
public static Dictionary<string, UserALCookies> UserALCookies = new Dictionary<string, UserALCookies>();
|
||||
private List<Cookie> Cookies;
|
||||
private List<Cookie> SlipaceCookies;
|
||||
private List<Cookie> ALCookies;
|
||||
public void Set(string mobile, bool refundFlag)
|
||||
{
|
||||
if (!UserCookies.ContainsKey(mobile))
|
||||
{
|
||||
MessageBox.Show("没有找到这个手机号", "提示");
|
||||
return;
|
||||
}
|
||||
string url = BaseClass.NewUrl+"/personal_profile.html";
|
||||
string refere = BaseClass.NewUrl+"/personal.html";
|
||||
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
|
||||
string name = BaseRegex.GetMatchRegexString(ref html, @"\\""nickname\\"":\\""([^']+?)\\""");
|
||||
if (name == mobile)
|
||||
return;
|
||||
|
||||
List<Cookie> cookies = UserCookies[mobile].Cookies;
|
||||
Delete();
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = BaseClass.NewUrl+"/";
|
||||
foreach (System.Net.Cookie c in cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
PayMobile = mobile;
|
||||
Cookies = cookies;
|
||||
new Thread(Set).Start();
|
||||
if (!refundFlag)
|
||||
{
|
||||
MessageBox.Show("切换到账户:" + mobile + " 成功", "提示");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重试一次设置cookies
|
||||
/// </summary>
|
||||
public void Set()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = BaseClass.NewUrl+"/";
|
||||
foreach (System.Net.Cookie c in Cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool SetTaoBao(string userName, bool refundFlag)
|
||||
{
|
||||
if (!UserCookies.ContainsKey(userName))
|
||||
{
|
||||
MessageBox.Show("没有找到这个淘宝买家", "提示");
|
||||
return false;
|
||||
}
|
||||
DeleteTaoBao();
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
List<Cookie> cookies = UserCookies[userName].Cookies;
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = "https://i.taobao.com/my_taobao.htm";
|
||||
foreach (System.Net.Cookie c in cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
PayMobile = userName;
|
||||
if (!refundFlag)
|
||||
{
|
||||
MessageBox.Show("切换到账户:" + userName + " 成功", "提示");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置淘宝卖家
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetSellerTaoBao(string userName)
|
||||
{
|
||||
if (!UserCookies.ContainsKey(userName))
|
||||
{
|
||||
MessageBox.Show("没有找到这个淘宝卖家", "提示");
|
||||
return false;
|
||||
}
|
||||
DeleteTaoBao();
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
List<Cookie> cookies = UserCookies[userName].Cookies;
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = "https://myseller.taobao.com/home.htm";
|
||||
foreach (System.Net.Cookie c in cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
PayMobile = userName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Get()
|
||||
{
|
||||
string url = BaseClass.BuildObjString("user_login_cookies&act=get");
|
||||
string data = "&site_id=-1";
|
||||
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("'"))
|
||||
return;
|
||||
UserCookies.Clear();
|
||||
var m = BaseRegex.GetMatchRegex(ref html, "<user_login_cookies([^>]+?)>");
|
||||
for (int i = 0; m != null && i < m.Count; i++)
|
||||
{
|
||||
string list = m[i].Groups[0].Value;
|
||||
string name = BaseRegex.GetStringJson(ref list, "user_name");
|
||||
if (string.IsNullOrEmpty(name) || UserCookies.ContainsKey(name))
|
||||
continue;
|
||||
string cookies = BaseRegex.GetStringJson(ref list, "cookies");
|
||||
int site_id = BaseRegex.GetIntJson(ref list, "site_id");
|
||||
AddList(name, cookies, site_id);
|
||||
}
|
||||
ReflashUsers = true;
|
||||
ReflashPinUsers = true;
|
||||
ReflashFunUsers = true;
|
||||
ReflashRepUsers = true;
|
||||
ReflashTaoBaoUsers = true;
|
||||
ALReflashUsers = true;
|
||||
ALReflashFunUsers = true;
|
||||
UserName = "点击下拉切换";
|
||||
TaoBaoUserName = "点击下拉切换";
|
||||
ALUserName = "点击下拉切换";
|
||||
}
|
||||
|
||||
|
||||
public void Add(string name, string cookies, int site_id)
|
||||
{
|
||||
string url = BaseClass.BuildObjString("user_login_cookies&act=insert");
|
||||
StringBuilder data = new StringBuilder();
|
||||
data.Append("&user_name=" + name);
|
||||
data.Append("&site_id="+ site_id);
|
||||
data.Append("&cookies=" + GetHtml.UrlEncodeUtf8(cookies));
|
||||
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
|
||||
if (html != "ok")
|
||||
{
|
||||
Thread.Sleep(10 * 1000);
|
||||
html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
|
||||
}
|
||||
AddList(name, cookies, site_id);
|
||||
}
|
||||
|
||||
public void AddList(string name, string cookies, int site_id)
|
||||
{
|
||||
string[] l = cookies.Split(';');
|
||||
List<Cookie> cookie = new List<Cookie>();
|
||||
for (int j = 0; j < l.Length; j++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
|
||||
continue;
|
||||
string[] ll = l[j].Split('=');
|
||||
if (site_id == 1)
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "taobao.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
c = new Cookie();
|
||||
c.Domain = "tmall.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
if (site_id == 2 || site_id == 0 || site_id == -1)
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "yangkeduo.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
if (site_id == 3)//淘宝卖家
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "taobao.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
if (site_id == 4)//进宝
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "jinbao.pinduoduo.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
}
|
||||
UserCookies uc = new UserCookies();
|
||||
uc.Cookies = cookie;
|
||||
uc.UserName = name;
|
||||
uc.SiteId = site_id;
|
||||
if (site_id.Equals(1))
|
||||
{
|
||||
TaoBaoUserName = name;
|
||||
}
|
||||
else if (site_id.Equals(0) || site_id.Equals(2))
|
||||
{
|
||||
UserName = name;
|
||||
}
|
||||
|
||||
if (!UserCookies.ContainsKey(name))
|
||||
UserCookies.Add(name, uc);
|
||||
else
|
||||
UserCookies[name] = uc;
|
||||
ReflashUsers = true;
|
||||
ReflashFunUsers = true;
|
||||
ReflashPinUsers = true;
|
||||
ReflashRepUsers = true;
|
||||
ReflashTaoBaoUsers = true;
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cookieManager = Cef.GetGlobalCookieManager();
|
||||
if (BaseClass.CookiesAllString.ContainsKey("yangkeduo.com"))
|
||||
{
|
||||
var cookies = BaseClass.CookiesAllString["yangkeduo.com"];
|
||||
string[] l = cookies.Split(';');
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
|
||||
continue;
|
||||
string name = l[i].Split('=')[0].Trim();
|
||||
try
|
||||
{
|
||||
cookieManager.DeleteCookies(BaseClass.NewUrl+"/", name);
|
||||
cookieManager.DeleteCookies("http://yangkeduo.com/", name);
|
||||
//cookieManager.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DeleteTaoBao()
|
||||
{
|
||||
var cookieManager = Cef.GetGlobalCookieManager();
|
||||
if (BaseClass.CookiesAllString.ContainsKey("taobao.com"))
|
||||
{
|
||||
var cookies = BaseClass.CookiesAllString["taobao.com"];
|
||||
string[] l = cookies.Split(';');
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
|
||||
continue;
|
||||
string name = l[i].Split('=')[0].Trim();
|
||||
try
|
||||
{
|
||||
cookieManager.DeleteCookies("https://i.taobao.com/my_taobao.htm", name);
|
||||
cookieManager.DeleteCookies("https://login.taobao.com/member/login.jhtml", name);
|
||||
//cookieManager.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (BaseClass.CookiesAllString.ContainsKey("tmall.com"))
|
||||
{
|
||||
var cookies = BaseClass.CookiesAllString["tmall.com"];
|
||||
string[] l = cookies.Split(';');
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
|
||||
continue;
|
||||
string name = l[i].Split('=')[0].Trim();
|
||||
try
|
||||
{
|
||||
cookieManager.DeleteCookies("https://i.taobao.com/my_taobao.htm", name);
|
||||
cookieManager.DeleteCookies("https://login.taobao.com/member/login.jhtml", name);
|
||||
//cookieManager.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteJinBao()
|
||||
{
|
||||
var cookieManager = Cef.GetGlobalCookieManager();
|
||||
if (BaseClass.CookiesAllString.ContainsKey("jinbao.pinduoduo.com"))
|
||||
{
|
||||
var cookies = BaseClass.CookiesAllString["jinbao.pinduoduo.com"];
|
||||
string[] l = cookies.Split(';');
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
|
||||
continue;
|
||||
string name = l[i].Split('=')[0].Trim();
|
||||
try
|
||||
{
|
||||
cookieManager.DeleteCookies("http://jinbao.pinduoduo.com/", name);
|
||||
cookieManager.DeleteCookies("http://pinduoduo.com/", name);
|
||||
//cookieManager.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 刷单
|
||||
public void Setslipace(string mobile, bool refundFlag)
|
||||
{
|
||||
if (!UserSlipaceCookies.ContainsKey(mobile))
|
||||
{
|
||||
MessageBox.Show("没有找到这个手机号", "提示");
|
||||
return;
|
||||
}
|
||||
string url = BaseClass.NewUrl+"/personal_profile.html";
|
||||
string refere = BaseClass.NewUrl+"/personal.html";
|
||||
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
|
||||
string name = BaseRegex.GetMatchRegexString(ref html, @"\\""nickname\\"":\\""([^']+?)\\""");
|
||||
if (name == mobile)
|
||||
return;
|
||||
|
||||
List<Cookie> cookies = UserSlipaceCookies[mobile].Cookies;
|
||||
Delete();
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = BaseClass.NewUrl+"/";
|
||||
foreach (System.Net.Cookie c in cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
SlipacePayMobile = mobile;
|
||||
SlipaceCookies = cookies;
|
||||
new Thread(SlipaceSet).Start();
|
||||
if (!refundFlag)
|
||||
{
|
||||
MessageBox.Show("切换到账户:" + mobile + " 成功", "提示");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 重试一次设置cookies
|
||||
/// </summary>
|
||||
public void SlipaceSet()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = BaseClass.NewUrl+"/";
|
||||
foreach (System.Net.Cookie c in SlipaceCookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AddSlipace(string name, string cookies, int site_id)
|
||||
{
|
||||
FileBase.WriteAllText("temp/MobileCookies/" + StringToUnicode(name) + ".tjm", cookies,
|
||||
Encoding.Default);
|
||||
AddListSlipace(name, cookies, site_id);
|
||||
}
|
||||
public void AddListSlipace(string name, string cookies, int site_id)
|
||||
{
|
||||
string[] l = cookies.Split(';');
|
||||
List<Cookie> cookie = new List<Cookie>();
|
||||
for (int j = 0; j < l.Length; j++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
|
||||
continue;
|
||||
string[] ll = l[j].Split('=');
|
||||
|
||||
if (site_id == 2 || site_id == 0)
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "yangkeduo.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
|
||||
}
|
||||
UserSlipaceCookies uc = new UserSlipaceCookies();
|
||||
uc.Cookies = cookie;
|
||||
uc.UserName = name;
|
||||
uc.SiteId = site_id;
|
||||
if (site_id.Equals(0) || site_id.Equals(2))
|
||||
{
|
||||
SlipaceUserName = name;
|
||||
}
|
||||
|
||||
if (!UserSlipaceCookies.ContainsKey(name))
|
||||
UserSlipaceCookies.Add(name, uc);
|
||||
else
|
||||
UserSlipaceCookies[name] = uc;
|
||||
SlipaceReflashUsers = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 阿里巴巴
|
||||
public void SetAL(string mobile, bool refundFlag)
|
||||
{
|
||||
if (!UserALCookies.ContainsKey(mobile))
|
||||
{
|
||||
MessageBox.Show("没有找到这个阿里巴巴买家", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Cookie> cookies = UserALCookies[mobile].Cookies;
|
||||
DeleteAL();
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = "https://www.1688.com/";
|
||||
foreach (System.Net.Cookie c in cookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ALPayMobile = mobile;
|
||||
ALCookies = cookies;
|
||||
new Thread(ALSet).Start();
|
||||
}
|
||||
public void ALSet()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
|
||||
//Cef.GetGlobalCookieManager().SetStoragePath(Environment.CurrentDirectory, true);
|
||||
string domain = "https://www.1688.com/";
|
||||
foreach (System.Net.Cookie c in ALCookies)
|
||||
{
|
||||
var cookie = new CefSharp.Cookie
|
||||
{
|
||||
Domain = c.Domain,
|
||||
Name = c.Name,
|
||||
Value = c.Value,
|
||||
Expires = DateTime.Now.AddYears(1),
|
||||
Path = "/"
|
||||
};
|
||||
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AddAL(string name, string cookies, int site_id)
|
||||
{
|
||||
FileBase.WriteAllText("temp/ALCookies/" + StringToUnicode(name) + ".tjm", cookies,
|
||||
Encoding.Default);
|
||||
AddListAL(name, cookies, site_id);
|
||||
}
|
||||
public void AddListAL(string name, string cookies, int site_id)
|
||||
{
|
||||
string[] l = cookies.Split(';');
|
||||
List<Cookie> cookie = new List<Cookie>();
|
||||
for (int j = 0; j < l.Length; j++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
|
||||
continue;
|
||||
string[] ll = l[j].Split('=');
|
||||
|
||||
if (site_id == 3)
|
||||
{
|
||||
Cookie c = new Cookie();
|
||||
c.Domain = "1688.com";
|
||||
c.Expires = DateTime.Now.AddYears(1);
|
||||
c.Name = ll[0].Trim();
|
||||
c.Value = ll[1];
|
||||
c.Path = "/";
|
||||
cookie.Add(c);
|
||||
}
|
||||
|
||||
}
|
||||
UserALCookies uc = new UserALCookies();
|
||||
uc.Cookies = cookie;
|
||||
uc.UserName = name;
|
||||
uc.SiteId = site_id;
|
||||
if (site_id.Equals(3))
|
||||
{
|
||||
ALUserName = name;
|
||||
}
|
||||
|
||||
if (!UserALCookies.ContainsKey(name))
|
||||
UserALCookies.Add(name, uc);
|
||||
else
|
||||
UserALCookies[name] = uc;
|
||||
ALReflashUsers = true;
|
||||
ALReflashFunUsers = true;
|
||||
}
|
||||
public void DeleteAL()
|
||||
{
|
||||
var cookieManager = Cef.GetGlobalCookieManager();
|
||||
if (BaseClass.CookiesAllString.ContainsKey("1688.com"))
|
||||
{
|
||||
var cookies = BaseClass.CookiesAllString["1688.com"];
|
||||
string[] l = cookies.Split(';');
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
|
||||
continue;
|
||||
string name = l[i].Split('=')[0].Trim();
|
||||
try
|
||||
{
|
||||
cookieManager.DeleteCookies("https://www.1688.com/", name);
|
||||
cookieManager.DeleteCookies("http://www.1688.com/", name);
|
||||
//cookieManager.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private string StringToUnicode(string value)
|
||||
{
|
||||
byte[] bytes = Encoding.Unicode.GetBytes(value);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < bytes.Length; i += 2)
|
||||
{
|
||||
// 取两个字符,每个字符都是右对齐。
|
||||
stringBuilder.AppendFormat("u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0'));
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class UserCookies
|
||||
{
|
||||
public string UserName = "";
|
||||
public List<Cookie> Cookies = new List<Cookie>();
|
||||
public int SiteId = 0;
|
||||
}
|
||||
public class UserSlipaceCookies
|
||||
{
|
||||
public string UserName = "";
|
||||
public List<Cookie> Cookies = new List<Cookie>();
|
||||
public int SiteId = 0;
|
||||
}
|
||||
public class UserALCookies
|
||||
{
|
||||
public string UserName = "";
|
||||
public List<Cookie> Cookies = new List<Cookie>();
|
||||
public int SiteId = 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user