Пример #1
0
 public void LoadTagJson()
 {
     if (File.Exists(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "tagdata.json")))
     {
         tag_collection = JsonConvert.DeserializeObject <HitomiTagdataCollection>(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "tagdata.json")));
     }
 }
Пример #2
0
        public async Task DownloadTagdata()
        {
            HttpClient client = new HttpClient();
            var        data   = await client.GetStringAsync(tag_json_uri);

            tagdata_collection = JsonConvert.DeserializeObject <HitomiTagdataCollection>(data);
            List <HitomiTagdata> female_data = new List <HitomiTagdata>();

            tagdata_collection.female.ForEach((a) => { HitomiTagdata tag_data = new HitomiTagdata(); tag_data.Tag = "female:" + a.Tag; tag_data.Count = a.Count; female_data.Add(tag_data); });
            List <HitomiTagdata> male_data = new List <HitomiTagdata>();

            tagdata_collection.male.ForEach((a) => { HitomiTagdata tag_data = new HitomiTagdata(); tag_data.Tag = "male:" + a.Tag; tag_data.Count = a.Count; male_data.Add(tag_data); });
            tagdata_collection.female = female_data;
            tagdata_collection.male   = male_data;
            SortTagdata();

            JsonSerializer serializer = new JsonSerializer();

            serializer.Converters.Add(new JavaScriptDateTimeConverter());
            serializer.NullValueHandling = NullValueHandling.Ignore;

            using (StreamWriter sw = new StreamWriter(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "tagdata.json")))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, tagdata_collection);
                }
        }
Пример #3
0
        public async Task DownloadTagJson()
        {
            HttpClient client = new HttpClient();
            var        data   = await client.GetStringAsync(tag_json_uri);

            tag_collection = JsonConvert.DeserializeObject <HitomiTagdataCollection>(data);

            JsonSerializer serializer = new JsonSerializer();

            serializer.Converters.Add(new JavaScriptDateTimeConverter());
            serializer.NullValueHandling = NullValueHandling.Ignore;

            using (StreamWriter sw = new StreamWriter(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "tagdata.json")))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, tag_collection);
                }
        }