public List <DownLoadInfo> Execute(List <SpecialList> specialList, string savePath) { List <DownLoadInfo> downList = new List <DownLoadInfo>(); foreach (var item in specialList) { string url = $"https://cloud.alilo.com.cn/baby/api/t/external/getSpecialInfo?id={item.id}"; string result = HttpClinetHelper.DoPost(url, null); ApiResult apiResult = new ApiResult(); apiResult = JsonConvert.DeserializeAnonymousType(result, apiResult); if (apiResult.msg == "成功") { foreach (var items in apiResult.content.musicList) { DownLoadInfo downLoadInfo = new DownLoadInfo(); string Path = string.Empty; string tempPath = string.Empty; tempPath = $"{savePath}/{item.classname}/{item.name}"; if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } Path = $"{tempPath}/{items.name}"; downLoadInfo.Path = Path; downLoadInfo.MusicPath = items.path; downList.Add(downLoadInfo); } } ; } return(downList); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { var index = (SelectEnum)comboBox1.SelectedIndex; string Parm = index.EnumMetadataDisplay(); string url = $"https://service.alilo.com.cn/gw/resource/special?classname={Parm}&classid=0"; string result = string.Empty; switch (index) { case SelectEnum.All: case SelectEnum.Song: case SelectEnum.Story: case SelectEnum.Engish: case SelectEnum.Sinology: case SelectEnum.Poetry: case SelectEnum.Sleep: result = HttpClinetHelper.DoPost(url, null); ApiResult apiResult = new ApiResult(); apiResult = JsonConvert.DeserializeAnonymousType(result, apiResult); if (apiResult.msg == "成功") { content = apiResult?.content; comboBox2.Items.Clear(); foreach (var item in content.specialList) { comboBox2.Items.Add(item.name); } comboBox2.SelectedIndex = 0; } else { MessageBox.Show("未能获取需下载的资源,请联系开发人员", "提示"); } break; default: break; } }