示例#1
0
        public static async Task <UrlFilenamePair[]> GetTitleContentURLs(TMD tmd, bool skipTMD = false)
        {
            var URLs = new List <UrlFilenamePair> {
            };

            if (await TitleExists(tmd.TitleID))
            {
                if (skipTMD == false)
                {
                    URLs.Add(new UrlFilenamePair(downloadBase + tmd.TitleID + "/tmd", "title.tmd"));
                }

                if (await TicketExists(tmd.TitleID))
                {
                    URLs.Add(new UrlFilenamePair(downloadBase + tmd.TitleID + "/cetk", "title.tik"));
                }
                foreach (var content in tmd.Content)
                {
                    URLs.Add(new UrlFilenamePair(downloadBase + tmd.TitleID + "/" + content.IDString, content.IDString + ".app"));

                    if (content.HasH3)
                    {
                        URLs.Add(new UrlFilenamePair(downloadBase + tmd.TitleID + "/" + content.IDString + ".h3", content.IDString + ".h3"));
                    }
                }
            }
            return(URLs.ToArray());
        }
示例#2
0
        public static async Task <TMD> DownloadTMD(string TitleID)
        {
            if (!IsTitleIDFormatValid(TitleID))
            {
                throw new ArgumentException("Invalid format.", "TitleID");
            }

            using (WebClient client = new WebClient())
            {
                TMD tmd = new TMD(await client.DownloadDataTaskAsync(downloadBase + TitleID + "/tmd"));
                return(tmd);
            }
        }
示例#3
0
        public static async Task <UrlFilenamePair[]> GetTitleContentURLs(string TitleID, bool throwError = false)
        {
            if (!IsTitleIDFormatValid(TitleID))
            {
                throw new ArgumentException("Invalid format.", "TitleID");
            }

            try
            {
                TMD tmd = await DownloadTMD(TitleID);

                return(await GetTitleContentURLs(tmd));
            } catch (WebException ex)
            {
                if (throwError)
                {
                    throw ex;
                }
            }
            return(new UrlFilenamePair[] { });
        }