Exemple #1
0
        int IComparer.Compare(object a, object b)
        {
            StatUrl c1 = (StatUrl)a;
            StatUrl c2 = (StatUrl)b;

            return(CompareFileTime(ref c2.ftLastVisited, ref c1.ftLastVisited));
        }
        public StatUrlWrapper(StatUrl stat_url)
        {
            Url   = stat_url.Url;
            Title = stat_url.Title;

            LastVisited = stat_url.LastVisited;
            LastUpdated = stat_url.LastUpdated;
            Expires     = stat_url.Expires;
        }
            /// <summary>
            /// Advances the enumerator to the next item of the url history cache.
            /// </summary>
            /// <returns>true if the enumerator was successfully advanced to the next element;
            ///  false if the enumerator has passed the end of the url history cache.
            ///  </returns>
            public bool MoveNext()
            {
                m_statUrl = new StatUrl();

                m_enumrator.Next(1, ref m_statUrl, out m_index);
                if (m_index == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            /// <summary>
            ///Enumerate the items in the history cache and store them in the IList object.
            /// </summary>
            /// <param name="list">IList object
            /// <example><c>ArrayList</c>object</example>
            /// </param>
            public void GetUrlHistory(IList list)
            {
                while (true)
                {
                    m_statUrl = new StatUrl();

                    m_enumrator.Next(1, ref m_statUrl, out m_index);
                    if (m_index == 0)
                    {
                        break;
                    }

                    list.Add(m_statUrl);
                }

                m_enumrator.Reset();
            }
        /// <summary>
        ///Queries the history and reports whether the URL passed as the pocsUrl parameter has been visited by the current user.
        /// </summary>
        /// <param name="pocsUrl">the string of the URL to querythe string of the URL to query.</param>
        /// <param name="dwFlags">STATURL_QUERYFLAGS Enumeration
        /// <example><c>STATURL_QUERYFLAGS.STATURL_QUERYFLAG_TOPLEVEL</c></example></param>
        /// <returns>Returns STATURL structure that received additional URL history information. If the returned  STATURL's pwcsUrl is not null, Queried URL has been visited by the current user.
        /// </returns>
        public StatUrl QueryUrl(string pocsUrl, STATURL_QUERYFLAGS dwFlags)
        {
            StatUrl lpSTATURL = new StatUrl();

            try
            {
                //In this case, queried URL has been visited by the current user.
                m_historyStg2.QueryUrl(pocsUrl, dwFlags, ref lpSTATURL);
                //lpSTATURL.pwcsUrl is NOT null;
                return(lpSTATURL);
            }
            catch (FileNotFoundException)
            {
                //Queried URL has not been visited by the current user.
                //lpSTATURL.pwcsUrl is set to null;
                return(lpSTATURL);
            }
        }