예제 #1
0
        private void GetDownloadingInfoResult(String response)
        {
            try
            {
                JsonResultMultiCalls info = JsonRequest.GetResultMultiCalls(response);

                List <JsonResultMultiCalls.ResultItemA> results = new List <JsonResultMultiCalls.ResultItemA>();
                results.AddRange(JsonRequest.GetResultMultiCallsResultItemAReform(info.result[0][0]));
                results.AddRange(JsonRequest.GetResultMultiCallsResultItemAReform(info.result[1][0]));

                String globelResult = JsonRequest.GetResultMultiCallsResultItemBReform(info.result[2][0]).ToString();

                results.ForEach(result =>
                {
                    _downloadItems.First(downloadItem => downloadItem.GetGid.Equals(result.gid)).SetDownloadInfo(result.files[0].uris[0].uri, result.files[0].path, result.status, Int64.Parse(result.totalLength), Int64.Parse(result.completedLength), Int64.Parse(result.downloadSpeed));
                });

                GetDownloadingInfoResultHandler?.Invoke(globelResult);
            }
            catch (Exception e)
            {
                GetDownloadingInfoResultHandler?.Invoke(String.Empty);
                ExceptionHelper.ShowErrorMsg("GetDownloadHistoryInfo", e);
            }
        }
예제 #2
0
        private void GetDownloadHistoryResult(String response)
        {
            try
            {
                JsonResultMultiCalls info = JsonRequest.GetResultMultiCalls(response);

                List <JsonResultMultiCalls.ResultItemA> results = new List <JsonResultMultiCalls.ResultItemA>();
                results.AddRange(JsonRequest.GetResultMultiCallsResultItemAReform(info.result[0][0]));
                results.AddRange(JsonRequest.GetResultMultiCallsResultItemAReform(info.result[1][0]));

                results.ForEach(result =>
                {
                    DownloadItem downloadItem = new DownloadItem(result.gid);
                    downloadItem.SetDownloadInfo(result.files[0].uris[0].uri, result.files[0].path, result.status, Int64.Parse(result.totalLength), Int64.Parse(result.completedLength), Int64.Parse(result.downloadSpeed));
                    _downloadItems.Add(downloadItem);
                });

                InitResultHandler?.Invoke(true);
            }
            catch (Exception e)
            {
                InitResultHandler?.Invoke(false);
                ExceptionHelper.ShowErrorMsg("GetDownloadHistoryResult", e);
            }
        }