示例#1
0
 public TagDetailInMiddle(TagDetail tag, string prefix, string suffix)
 {
     Name   = tag.Name;
     Type   = tag.Type;
     Parent = tag.Parent;
     Prefix = prefix;
     Suffix = suffix;
 }
示例#2
0
        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 - ");
        }
示例#3
0
        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
                            };
                        }
                    }
                }
            }
        }