Exemplo n.º 1
0
		// When Cookie Information Already Exists
		public KnetikCookieAccessInfo( KnetikCookie cookie )
		{
			this.domain = cookie.domain;
			this.path = cookie.path;
			this.secure = cookie.secure;
			this.scriptAccessible = cookie.scriptAccessible;
		}
Exemplo n.º 2
0
		public void SetCookies( KnetikCookie[] cookieObjects )
		{
			for ( var index = 0; index < cookieObjects.Length; ++index )
			{
				this.SetCookie( cookieObjects[ index ] );
			}
		}
Exemplo n.º 3
0
		public bool SetCookie( KnetikCookie cookie )
		{
            lock( cookieJarLock )
            {
                bool expired = cookie.expirationDate < DateTime.Now;
            
                if ( cookies.ContainsKey( cookie.name ) )
                {
                    for( int index = 0; index < cookies[ cookie.name ].Count; ++index )
                    {
						KnetikCookie collidableCookie = cookies[ cookie.name ][ index ];
						if ( collidableCookie.CollidesWith( new KnetikCookieAccessInfo( 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< KnetikCookie >();
				cookies[ cookie.name ].Add( cookie );
                if ( ContentsChanged != null )
                {
                    ContentsChanged();
                }
                return true;
            }
		}