您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->NETCMSv1.5(Build0509)完整源码版>>NetCMS.Content/Collect/PageList.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:NETCMSv1.5(Build0509)完整源码版


当前文件路径:NetCMSv15/NetCMS.Content/Collect/PageList.cs 文件类型
普通视图
		            
1//====================================================== 2//== (c)2008 aspxcms inc by NeTCMS v1.0 == 3//== Forum:bbs.aspxcms.com == 4//== Website:www.aspxcms.com == 5//====================================================== 6using System; 7using System.Collections.Generic; 8using System.Text; 9using System.Text.RegularExpressions; 10using System.Collections; 11 12namespace NetCMS.Content.Collect 13{ 14 public class PageList : Page 15 { 16 private string _List; 17 private ArrayList _NewsUrlList; 18 private string listrule = ""; 19 private string linkrule = ""; 20 public string RuleOfList 21 { 22 set { listrule = value; } 23 } 24 public string RuleOfLink 25 { 26 set { linkrule = value; } 27 } 28 public PageList(string url) : base(url) { } 29 public PageList(string url, string encode) : base(url, encode) { } 30 public void FigureList() 31 { 32 if (listrule == null || listrule.IndexOf("[列表内容]") < 0) 33 throw new Exception("列表内容规则没有设定"); 34 _List = ""; 35 if (_Doc.Equals("")) 36 { 37 if (!this.Fetch()) 38 throw new Exception(_Error); 39 } 40 Match m = Utility.GetMatch(_Doc, listrule, "[列表内容]"); 41 while (m.Success) 42 { 43 _List += m.Groups["TARGET"].Value; 44 m = m.NextMatch(); 45 } 46 } 47 public string List 48 { 49 get 50 { 51 return _List; 52 } 53 set 54 { 55 _List = value; 56 } 57 } 58 public void FigureNewsUrls() 59 { 60 if (linkrule == null || linkrule.IndexOf("[列表URL]") < 0) 61 throw new Exception("列表URL规则没有设定"); 62 _NewsUrlList = new ArrayList(); 63 _NewsUrlList.Clear(); 64 Match m = Utility.GetMatchUrl(_List, linkrule, "[列表URL]"); 65 while (m.Success) 66 { 67 _NewsUrlList.Add(Utility.StickUrl(_Url, m.Groups["TARGET"].Value)); 68 m = m.NextMatch(); 69 } 70 } 71 public string[] NewsUrl 72 { 73 get 74 { 75 if (_NewsUrlList == null || _NewsUrlList.Count < 1) 76 return null; 77 else 78 return (string[])_NewsUrlList.ToArray(typeof(string)); 79 } 80 } 81 public string[] Pagination(string profile, int total) 82 { 83 string[] result = new string[total]; 84 GetOtherPage(this._Url, _Doc, profile, ref result, total, 0); 85 return result; 86 } 87 private void GetOtherPage(string otherurl, string PageDoc, string pattern, ref string[] r, int total, int n) 88 { 89 Match m = Utility.GetMatchUrl(PageDoc, pattern, "[其他页面]"); 90 if (m.Success) 91 { 92 string obturl = Utility.StickUrl(otherurl, m.Groups["TARGET"].Value); 93 if (!obturl.Trim().Equals(otherurl.Trim())) 94 { 95 PageList pglst = new PageList(obturl, _Encode); 96 ArrayList arraylist = GetListUrl(pglst); 97 if (arraylist != null && arraylist.Count > 0) 98 { 99 int len = arraylist.Count; 100 int j = len + n; 101 if (j < total) 102 arraylist.CopyTo(0, r, n, len); 103 else 104 { 105 arraylist.CopyTo(0, r, n, total - n); 106 return; 107 } 108 n = j; 109 } 110 if (n < total) 111 { 112 GetOtherPage(obturl, pglst._Doc, pattern, ref r, total, n); 113 } 114 } 115 } 116 } 117 public string[] SinglePagination(string profile, int total) 118 { 119 string[] result = new string[total]; 120 int n = 0; 121 Match m = Utility.GetMatchUrl(_Doc, profile, "[其他页面]"); 122 while (m.Success) 123 { 124 if (n >= total) 125 break; 126 string otherurl = Utility.StickUrl(_Url, m.Groups["TARGET"].Value); 127 if (!otherurl.Trim().Equals(this._Url.Trim())) 128 { 129 PageList pglst = new PageList(otherurl, _Encode); 130 ArrayList arraylist = GetListUrl(pglst); 131 if (arraylist != null && arraylist.Count > 0) 132 { 133 int len = arraylist.Count; 134 int j = len + n; 135 if (j < total) 136 arraylist.CopyTo(0, result, n, len); 137 else 138 { 139 arraylist.CopyTo(0, result, n, total - n); 140 break; 141 } 142 n = j; 143 } 144 } 145 m = m.NextMatch(); 146 } 147 return result; 148 } 149 public string[] IndexPagination(string profile, int min, int max, int total) 150 { 151 string[] result = new string[total]; 152 int n = 0; 153 for (int i = min; i <= max; i++) 154 { 155 if (n >= total) 156 break; 157 string otherurl = profile.Replace("[页码]", i.ToString()); 158 if (!otherurl.Trim().Equals(this._Url.Trim())) 159 { 160 PageList pglst = new PageList(otherurl, _Encode); 161 ArrayList arraylist = GetListUrl(pglst); 162 if (arraylist != null && arraylist.Count > 0) 163 { 164 int len = arraylist.Count; 165 int j = len + n; 166 if (j < total) 167 arraylist.CopyTo(0, result, n, len); 168 else 169 { 170 arraylist.CopyTo(0, result, n, total - n); 171 break; 172 } 173 n = j; 174 } 175 } 176 } 177 return result; 178 } 179 180 private ArrayList GetListUrl(PageList pl) 181 { 182 if (pl == null) 183 return null; 184 pl.linkrule = this.linkrule; 185 pl.listrule = this.listrule; 186 if (!pl.Fetch()) 187 { 188 return null; 189 } 190 pl.FigureList(); 191 pl.FigureNewsUrls(); 192 return pl._NewsUrlList; 193 } 194 } 195} 196
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:NETCMSv1.5(Build0509)完整源码版

- ASP.NET相册控件(含源码)

- Asp.net简单留言板源码(采用..

- 拍宝网B2B(仿淘宝)整站源码

- Anthem.NET中FileUpload控件..

- 丫丫饰品商城网站源码

- Asp.net客户服务跟踪管理系统..

- 拓网IP签名图系统V1.0源码

- 24xN.com在线帮助系统源码

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号