Esempio n. 1
0
        static void Main(string[] args)
        {
            CookieContainer cc = new CookieContainer();

            var cookieData = new ChromeCookieReader().ReadCookies("115");

            var json = JsonConvert.SerializeObject(cookieData.Where(x => !x.Value.Contains(",")).Distinct());

            ScanDataBaseManager.InsertOneOneFiveCookie(new OneOneFiveCookieModel
            {
                OneOneFiveCookie = json
            });
        }
Esempio n. 2
0
        public string Save115Cookie(string cookie)
        {
            List <CookieItem> items = new List <CookieItem>();

            CookieContainer cc = new CookieContainer();

            var cookieData = new ChromeCookieReader().ReadCookies(".115.com");

            if (cookieData != null)
            {
                items.AddRange(cookieData);
            }

            try
            {
                if (!string.IsNullOrEmpty(cookie))
                {
                    foreach (var item in cookie.Split(';'))
                    {
                        items.Add(new CookieItem()
                        {
                            Name  = item.Split('=')[0].Trim(),
                            Value = item.Split('=')[1].Trim(),
                        });
                    }
                }

                if (items.Count > 0)
                {
                    ScanDataBaseManager.TruncateOneOneFiveCookie();

                    ScanDataBaseManager.InsertOneOneFiveCookie(new OneOneFiveCookieModel
                    {
                        OneOneFiveCookie = JsonConvert.SerializeObject(items)
                    });
                }
            }
            catch (Exception)
            {
                return("fail");
            }

            return("success");
        }