网址收藏 网址收藏 网址收藏

时间:2014-03-26 00:59:11
【文件属性】:

文件名称:网址收藏 网址收藏 网址收藏

文件大小:130KB

文件格式:RAR

更新时间:2014-03-26 00:59:11

网址收藏

绝对能看能用的C#代码 using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace NetAddressCollector { public class CDataAccess : IDataAccess { #region IDataAccess 成员 private ArrayList _classList; public ArrayList ClassList { get { return _classList; } } private ArrayList _addressList; public ArrayList AddressList { get { return _addressList; } } private bool _isDirty = false; public bool IsDirty { get { return _isDirty; } } public void LoadData() { _classList = new ArrayList(); _addressList = new ArrayList(); string content = CFileOperation.ReadFile(CConst.DATAFILE); if (content.Length < 1) return; string[] ss1 = content.Split(new string[] { CConst.SPLITOR_CLASS_HTTP }, StringSplitOptions.RemoveEmptyEntries); string classString = ss1[0]; string httpString = ss1[1]; string[] ss2 = classString.Split(new string[] { CConst.SPLITOR_CLASS_ITEM }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in ss2) _classList.Add(new CClass(s)); string[] ss3 = httpString.Split(new string[] { CConst.SPLITOR_HTTP_ITEM }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in ss3) { string[] ss4 = s.Split(new string[] { CConst.SPLITOR_HTTP_DETAIL }, StringSplitOptions.RemoveEmptyEntries); foreach (CClass c in _classList) { if (c.Name == ss4[0]) { _addressList.Add(new CAddress(c, ss4[1], ss4[2], ss4[3])); break; } } } _isDirty = false; } public void SaveData() { StringBuilder sbClass = new StringBuilder(); foreach (CClass c in _classList) sbClass.Append(string.Format("{0}{1}", CConst.SPLITOR_CLASS_ITEM, c.Name)); StringBuilder sbContent = sbClass.Append(CConst.SPLITOR_CLASS_HTTP); StringBuilder sbHttp = new StringBuilder(); foreach (CAddress http in _addressList) sbHttp.Append(string.Format("{0}{1}", CConst.SPLITOR_HTTP_ITEM, http.ToString())); sbContent.Append(sbHttp); CFileOperation.WriteFile(CConst.DATAFILE, sbContent.ToString()); _isDirty = false; } public bool ExistClass(CClass httpClass) { foreach (CClass c in _classList) { if (c.Name == httpClass.Name) return true; } return false; } public bool ExistHttp(CAddress http) { foreach (CAddress addr in _addressList) { if (addr.Name == http.Name && addr.Name == http.Http) return true; } return false; } public void AddClass(string className) { CClass c = new CClass(className); AddClass(c); } public void AddClass(CClass httpClass) { _classList.Add(httpClass); _isDirty = true; } public void RemoveClass(CClass httpClass) { for (int i = _addressList.Count - 1; i >= 0; i--) { CAddress http = (CAddress)_addressList[i]; if (http.HttpClass.Name == httpClass.Name) RemoveHttp(http); } _classList.Remove(httpClass); _isDirty = true; } public void AddHttp(CClass httpClass, string name, string http, string remark) { CAddress addr = new CAddress(httpClass, name, http, remark); AddHttp(addr); } public void AddHttp(CAddress http) { _addressList.Add(http); _isDirty = true; } public void RemoveHttp(CAddress http) { _addressList.Remove(http); _isDirty = true; } #endregion } }


【文件预览】:
网址收藏
----_UpgradeReport_Files()
--------UpgradeReport.xslt(12KB)
--------UpgradeReport_Plus.gif(71B)
--------Thumbs.db(4KB)
--------UpgradeReport.css(3KB)
--------UpgradeReport_Minus.gif(69B)
----NetAddressCollector.suo(44KB)
----NetAddressCollector()
--------FormHttp.resx(8KB)
--------FormAbout.resx(9KB)
--------FormClass.cs(2KB)
--------CDataAccess.cs(5KB)
--------bin()
--------CAddress.cs(2KB)
--------obj()
--------NetAddressCollector.csproj(5KB)
--------CConst.cs(423B)
--------Properties()
--------Program.cs(481B)
--------CFileOperation.cs(858B)
--------IDataAccess.cs(827B)
--------FormHttp.Designer.cs(8KB)
--------FormClass.Designer.cs(6KB)
--------FormClass.resx(8KB)
--------FormAbout.cs(468B)
--------FormMain.cs(10KB)
--------XTreeNode.cs(571B)
--------FormMain.resx(16KB)
--------CClass.cs(624B)
--------FormMain.Designer.cs(30KB)
--------FormAbout.Designer.cs(7KB)
--------ClassDiagram1.cd(1B)
--------FormHttp.cs(2KB)
--------Images()
----NetAddressCollector.sln(947B)
----UpgradeLog.XML(1KB)

网友评论

  • 一款简单快捷的实用工具