예제 #1
0
        public async Task CreateOrUpdateCookie(Cookie cookie, BrowserType browser)
        {
            switch (browser)
            {
            case BrowserType.None:
                _adapter = null;
                break;

            case BrowserType.GoogleChrome:
                _adapter = new GoogleChromeAdapter();
                break;

            default:
                _adapter = null;
                break;
            }

            await CreateOrUpdate(cookie);
        }
예제 #2
0
        public async Task <Cookie> GetCookie(string host, string name, BrowserType browser)
        {
            switch (browser)
            {
            case BrowserType.None:
                _adapter = null;
                break;

            case BrowserType.GoogleChrome:
                _adapter = new GoogleChromeAdapter();
                break;

            default:
                _adapter = null;
                break;
            }

            if (_adapter == null)
            {
                throw new NullReferenceException(nameof(_adapter));
            }

            var cookieValue = await _adapter.GetCookie(host, name);

            if (string.IsNullOrEmpty(cookieValue))
            {
                return(null);
            }

            return(new Cookie
            {
                Domain = host,
                Name = name,
                Value = cookieValue
            });
        }
예제 #3
0
 public CookiesManager()
 {
     _adapter = null;
 }