private void pushData(RecvRealtimeData rrd, RealtimeData rd) { lock (lockData) { this.dcPushData[rrd].Add(rd); } }
private void deleteDataList(RecvRealtimeData rrd) { lock (lockData) { if (this.dcPushData.ContainsKey(rrd)) { this.dcPushData.Remove(rrd); } } }
private void createDataList(RecvRealtimeData rrd) { lock (lockData) { if (!this.dcPushData.ContainsKey(rrd)) { this.dcPushData.Add(rrd, new List <RealtimeData>()); } } }
public void getData(RecvRealtimeData rrd, ref List <RealtimeData> ltRd) { lock (lockData) { if (this.dcPushData.ContainsKey(rrd)) { ltRd.AddRange(this.dcPushData[rrd]); this.dcPushData[rrd].Clear(); } } }
public string unregistry(string codes, RecvRealtimeData rrd) { string bingo = ""; string[] arrRegistryCode = { }; if (codes.ToLower() == "all" || codes == null || codes == "") { arrRegistryCode = new string[this.dcCodeIdxThObj.Count]; this.dcCodeIdxThObj.Keys.CopyTo(arrRegistryCode, 0); } else { arrRegistryCode = codes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } lock (lockRsrc) { foreach (var item in arrRegistryCode) { if (this.dcCodeIdxThObj.ContainsKey(item)) { if (this.dcCodeRRD.ContainsKey(item)) { if (this.dcCodeRRD[item].Remove(rrd)) { if (this.dcRRDReferencedCount.ContainsKey(rrd)) { this.dcRRDReferencedCount[rrd]--; } if (this.dcCodeRRD[item].Count <= 0) { this.dcCodeRRD.Remove(item); } } } } } if ((this.dcRRDReferencedCount.ContainsKey(rrd) && this.dcRRDReferencedCount[rrd] <= 0) || !this.dcRRDReferencedCount.ContainsKey(rrd)) { deleteDataList(rrd); } } return(bingo); }
public string registry(string codes, RecvRealtimeData rrd) { string bingo = ""; string[] arrRegistryCode = { }; if (codes.ToLower() == "all" || codes == null || codes == "") { arrRegistryCode = new string[this.dcCodeIdxThObj.Count]; this.dcCodeIdxThObj.Keys.CopyTo(arrRegistryCode, 0); } else { arrRegistryCode = codes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } lock (lockRsrc) { createDataList(rrd); foreach (var item in arrRegistryCode) { //... if (!this.dcCodeIdxThObj.ContainsKey(item)) { ThreadObj to = this.ltThObj[idxThObjForNewRegistry]; if (to.GetType().Equals(typeof(ThreadGetDataFromTradeX))) { this.dcCodeIdxThObj.Add(item, idxThObjForNewRegistry); ((ThreadGetDataFromTradeX)to).addObj(item); idxThObjForNewRegistry++; if (idxThObjForNewRegistry >= this.ltThObj.Count) { idxThObjForNewRegistry = 0; } } } if (this.dcCodeIdxThObj.ContainsKey(item)) { if (!this.dcCodeRRD.ContainsKey(item)) { this.dcCodeRRD.Add(item, new List <RecvRealtimeData>()); } this.dcCodeRRD[item].Add(rrd); if (!this.dcRRDReferencedCount.ContainsKey(rrd)) { this.dcRRDReferencedCount.Add(rrd, 1); } else { this.dcRRDReferencedCount[rrd]++; } bingo += (item + ","); } if (this.dcCodeLastRd.ContainsKey(item)) { pushData(rrd, this.dcCodeLastRd[item]); } } } return(bingo); }