Exemplo n.º 1
0
        public bool Visit(CefSharp.Cookie cookie, int count, int total, ref bool deleteCookie)
        {
            deleteCookie = false;
            SendCookie?.Invoke(cookie);

            return(true);
        }
Exemplo n.º 2
0
        public bool Visit(CefSharp.Cookie cookie, int count, int total, ref bool deleteCookie)
        {
            deleteCookie = false;
            if (SendCookie != null)
            {
                SendCookie(cookie);
            }

            return(true);
        }
Exemplo n.º 3
0
        private void BrowserButton_Click(object sender, EventArgs e)
        {
            if (SelectedAccount == null)
            {
                return;
            }

            if (aaform != null && aaform.Visible)
            {
                aaform.HideForm();
            }

            aaform.ShowForm();
            aaform.BrowserMode = true;
            CefSharp.Cookie ck = new CefSharp.Cookie();
            ck.Name  = ".ROBLOSECURITY";
            ck.Value = SelectedAccount.SecurityToken;
            CefSharp.Cef.GetGlobalCookieManager().SetCookie("https://www.roblox.com", ck);
            aaform.chromeBrowser.Load("https://www.roblox.com/home");
        }
Exemplo n.º 4
0
 public virtual bool SetCookie(string url, CefSharp.Cookie cookie, CefSharp.ISetCookieCallback callback)
 {
     throw null;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Parses a single cookie line. <see cref="ParseCookieLines(List{string})"/> uses this function.
        /// </summary>
        /// <param name="line">A line in the netscpae format. Check http://www.cookiecentral.com/faq/#3.5 for details.</param>
        /// <returns></returns>
        public static CefSharp.Cookie ParseCookieLine(string line)
        {
            if (string.IsNullOrWhiteSpace(line))
            {
                return(null);
            }

            if (line.StartsWith("#") || !line.Contains("\t"))
            {
                return(null);
            }

            var lineParts = line.Split("\t".ToArray(), 7);

            if (lineParts.Length < 6)
            {
                return(null);
            }

            string   domain           = lineParts[0];
            bool     flag             = lineParts[1].ToLower() == "true";
            string   path             = lineParts[2];
            bool     secure           = lineParts[3].ToLower() == "true";
            string   expirationString = lineParts[4];
            DateTime?expiration       = null;

            if (expirationString != "0")
            {
                long expirationLong = 0;
                if (long.TryParse(expirationString, out expirationLong))
                {
                    DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                    expiration = dtDateTime.AddSeconds(expirationLong).ToLocalTime();
                }
            }
            string name = lineParts[5];

            CefSharp.Cookie ret = new CefSharp.Cookie()
            {
                Domain  = domain,
                Path    = path,
                Secure  = secure,
                Expires = expiration,
                Name    = name
            };

            if (lineParts.Length > 6)
            {
                ret.Value = lineParts[6];
            }


            return(ret);


            // Example lines:
            // https://unix.stackexchange.com/questions/36531/format-of-cookies-when-using-wget
            // http://www.cookiecentral.com/faq/#3.5

            /*
             # HTTP Cookie File for google.com by Genuinous @genuinous.
             # To download cookies for this tab click here, or download all cookies.
             # Usage Examples:
             #   1) wget -x --load-cookies cookies.txt "https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/related"
             #   2) curl --cookie cookies.txt "https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/related"
             #   3) aria2c --load-cookies cookies.txt "https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/related"
             #
             # .google.com	TRUE	/	FALSE	2145916806	CONSENT	PENDING.274ca8
             # .google.com	TRUE	/	TRUE	1603869418	NID	203=nn0JFuS0JWq-Nk9u7ESYVSxgUfiwGEBKeHyX_kLpYUxoybBZQ0xgmsiV1dA_0OXxcDd9Yi6Cvs_Ni6pd1NFMjgE63p3mplbSi2Wa-vFFy5avRCtqwiklJFuFqVpxbLVtIR7TFg4b1oV7BMDwtZw2cB3yO4YLdg8pSVPHWj9lANU
             # .google.com	TRUE	/	TRUE	1593805783	1P_JAR	2020-6-3-19
             # .chrome.google.com	TRUE	/	FALSE	1654285790	__utma	73091649.403592129.1591213786.1591213786.1591213786.1
             # .chrome.google.com	TRUE	/	FALSE	0	__utmc	73091649
             # .chrome.google.com	TRUE	/	FALSE	1606981790	__utmz	73091649.1591213786.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
             # .chrome.google.com	TRUE	/	FALSE	1591214385	__utmt	1
             # .chrome.google.com	TRUE	/	FALSE	1591215590	__utmb	73091649.20.0.1591213788088
             */
        }