コード例 #1
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            UrlCollection urls = this.GetMergedList();

            info.AddValue("policy", this.policy, typeof(UrlManagePolicy));
            info.AddValue("urls", urls, typeof(UrlCollection));
        }
コード例 #2
0
        /// <summary>
        /// 将分组IList的增量部分合并到一个IList中
        /// </summary>
        /// <returns>IList</returns>
        private UrlCollection GetMergedList()
        {
            UrlCollection urls = new UrlCollection();

            for (int i = 0; i < this.lists.Length; i++)
            {
                for (int n = this.listInitItems[i]; n < this.lists[i].Count; n++)
                {
                    urls.Add(this.lists[i][n].Value);
                }
            }
            return(urls);
        }
コード例 #3
0
        /// <summary>
        /// 反序列化
        /// </summary>
        /// <param name="info">SerializationInfo</param>
        /// <param name="context">StreamingContext</param>
        protected UrlManager(SerializationInfo info, StreamingContext context)
        {
            this.policy = info.GetValue("policy", typeof(UrlManagePolicy)) as UrlManagePolicy;
            UrlCollection urls = info.GetValue("urls", typeof(UrlCollection)) as UrlCollection;

            if (null != urls)
            {
                foreach (Url url in urls)
                {
                    this.AddOrRemoveItem(url, false);
                }
                urls.Clear();

                this.InitItemsCount();
            }
        }