public TagDetailInMiddle(TagDetail tag, string prefix, string suffix) { Name = tag.Name; Type = tag.Type; Parent = tag.Parent; Prefix = prefix; Suffix = suffix; }
public static async Task DownloadLatestTagDBAsync() { Debug.WriteLine("DownloadLatestTagDBAsync + "); HttpClient httpClient = new HttpClient(); var json = await httpClient.GetStringAsync(new Uri(SUMMARY_URI)); JsonObject root = JsonValue.Parse(json).GetObject(); var version = root.GetNamedNumber("version"); var data = root.GetNamedString("data"); if (version > CurrentVersion) { AllTags.Clear(); var items = data.Split(' '); foreach (var item in items) { var names = item.Split('`'); if (names.Length >= 2) { var tagType = int.Parse(names[0]); var name = names[1]; var orginal = new TagDetail() { Name = name, Type = (TagType)tagType }; AllTags[name] = orginal; for (int i = 2; i < names.Length; i++) { AllTags[names[i]] = new TagDetail() { Name = names[i], Type = (TagType)tagType, Parent = name }; } } } } Debug.WriteLine("DownloadLatestTagDBAsync - "); }
public static async Task DownloadLatestTagDBAsync() { Windows.Web.Http.HttpClient httpClient2 = new Windows.Web.Http.HttpClient(); var json = await httpClient2.GetStringAsync(new Uri($"{YandeClient.HOST}/tag/summary.json")); JsonObject root = JsonValue.Parse(json).GetObject(); var version = root.GetNamedNumber("version"); var data = root.GetNamedString("data"); if (version > CurrentVersion) { AllTags.Clear(); var items = data.Split(' '); foreach (var item in items) { var names = item.Split('`'); if (names.Length >= 2) { var tagType = int.Parse(names[0]); var name = names[1]; var orginal = new TagDetail() { Name = name, Type = (TagType)tagType }; AllTags[name] = orginal; for (int i = 2; i < names.Length; i++) { AllTags[names[i]] = new TagDetail() { Name = names[i], Type = (TagType)tagType, Parent = name }; } } } } }