/// <summary> /// 创建数据源对象 /// </summary> /// <returns></returns> private IPNLocationSource CreateLocationSource() { string typeStr = System.Configuration.ConfigurationManager.AppSettings["sourceType"]; Type sourceType = Type.GetType(typeStr); IPNLocationSource source = Activator.CreateInstance(sourceType) as IPNLocationSource; //IPNLocationSource source = new DataSource.ShowJiSource(); //IPNLocationSource source = new DataSource.IP138Source(); //IPNLocationSource source = new DataSource.BaiDuSource(); return(source); }
public void Run() { this.mRunning = true; int hitType = 0; IPNLocationSource locationSource = CreateLocationSource(); while (this.mPNQueue.Count > 0) { if (this.mRunning == false) { break; } string pn = this.mPNQueue.Dequeue(); PNLocationInfo pnInfo = new PNLocationInfo(); pnInfo.PhoneNumber = pn; pnInfo.Result = "还未查询"; if (this.mSegmengInfoCache.ContainsKey(pnInfo.Segment.NumberSegment)) { pnInfo.Segment = this.mSegmengInfoCache[pnInfo.Segment.NumberSegment]; pnInfo.Result = ""; this.mCacheHitCount++; hitType = 1; } else { locationSource.FullLocation(pnInfo); this.mSegmengInfoCache[pnInfo.Segment.NumberSegment] = pnInfo.Segment; hitType = 0; } this.mPNLocationResultList.Add(pnInfo); OnProcessProgress(pnInfo, hitType); } }