private void _ic_Notified(CVResult r, object o) { if (r == CVResult.TableQueryReceived) { if (o is QueryResultPt) { QueryResultPt qrp = o as QueryResultPt; if (qrp.success == 0) { if (qrp.resultFmart == "xml") { _txw = new TableXmlWrapper(qrp); Notified?.Invoke(CVRTableResult.SelectXmlReceived, _txw); } else if (qrp.resultFmart == "json") { _cjp = new CVRJsonParser(qrp.result) { Token = qrp.token, Count = qrp.count }; Notified?.Invoke(CVRTableResult.SelectJsonReceived, _cjp); } } else { Notified?.Invoke(CVRTableResult.SelectFailed, qrp.msg); } } } else if (r == CVResult.TableUpdateReceived) { if (o is ExecuteResultPt) { ExecuteResultPt erp = o as ExecuteResultPt; _ui = new UpdateItem { Id = erp.token, Succeed = erp.success == 0, Msg = erp.msg }; Notified?.Invoke(CVRTableResult.UpdateResultReceived, _ui); } } }
private void _ic_Notified(CVResult r, object o) { if (r == CVResult.TableQueryReceived) { if (o is QueryResultPt) { QueryResultPt qrp = o as QueryResultPt; if (qrp.token == _token) { if (qrp.success == 0) { TableXmlWrapper txw = new TableXmlWrapper(qrp); _curNum = txw.Count; _curIndex = 0; _pageCount = txw.Count / _pageSize + (txw.Count % _pageSize == 0 ? 0 : 1); foreach (XmlNode xn in txw.Nodes) { ResXmlNodeParser rxnp = new ResXmlNodeParser(xn); string pathfile = rxnp.Pathfile.Remove(0, 1); string file = pathfile.Replace(_dc.RemoteDirectory + @"/", ""); string source = @"ftp://" + _dc.Ip + @"/" + pathfile; string target = Path.Combine(_dc.LocalDirectory, file).Replace("/", @"\"); DateTime tdt = File.Exists(target) ? File.GetLastWriteTime(target) : DateTime.MinValue; if (!Kits.DateTimeEqual(rxnp.Lastwrite, tdt)) { if (UseMemory) { DownloadMemoryItem dmi = new DownloadMemoryItem { Id = rxnp.Id, Source = source, Target = target, Crc = rxnp.Crc, Tag = rxnp.Name }; _dc.Add(dmi); } else { DownloadDataItem ddi = new DownloadDataItem { Id = rxnp.Id, Source = source, Target = target, Crc = rxnp.Crc, Tag = rxnp.Name }; _dc.Add(ddi); } } else { Notified?.Invoke(CVResDownloadResult.ExistedTarget, target); if (++_curIndex >= _curNum) { if (++_pageNo >= _pageCount) { Completed?.Invoke(); } } } } } else { Notified?.Invoke(CVResDownloadResult.RequestResourceFailed, qrp.msg); } } } } }