public CookieAccessInfo( Cookie cookie ) { this.domain = cookie.domain; this.path = cookie.path; this.secure = cookie.secure; this.scriptAccessible = cookie.scriptAccessible; }
public void SetCookies( Cookie[] cookieObjects ) { for ( var index = 0; index < cookieObjects.Length; ++index ) { this.SetCookie( cookieObjects[ index ] ); } }
public bool SetCookie( Cookie cookie ) { lock( cookieJarLock ) { bool expired = cookie.expirationDate < DateTime.Now; if ( cookies.ContainsKey( cookie.name ) ) { for( int index = 0; index < cookies[ cookie.name ].Count; ++index ) { Cookie collidableCookie = cookies[ cookie.name ][ index ]; if ( collidableCookie.CollidesWith( new CookieAccessInfo( cookie ) ) ) { if( expired ) { cookies[ cookie.name ].RemoveAt( index ); if ( cookies[ cookie.name ].Count == 0 ) { cookies.Remove( cookie.name ); if ( ContentsChanged != null ) { ContentsChanged(); } } return false; } else { cookies[ cookie.name ][ index ] = cookie; if ( ContentsChanged != null ) { ContentsChanged(); } return true; } } } if ( expired ) { return false; } cookies[ cookie.name ].Add( cookie ); if ( ContentsChanged != null ) { ContentsChanged(); } return true; } if ( expired ) { return false; } cookies[ cookie.name ] = new List< Cookie >(); cookies[ cookie.name ].Add( cookie ); if ( ContentsChanged != null ) { ContentsChanged(); } return true; } }