예제 #1
0
 public void Load()
 {
     if (CheckExist())
     {
         model = MessagePackSerializer.Deserialize <HitomiTitleModel>(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "origin-title.json")));
     }
 }
예제 #2
0
        public static void MakeTitle()
        {
            var xxx = JsonConvert.DeserializeObject <List <EHentaiResultArticle> >(File.ReadAllText("ex-hentai-archive3.json"));

            var result = new HitomiTitleModel();

            var id           = new List <int>();
            var origin_title = new List <string>();

            foreach (var xx in xxx)
            {
                id.Add(xx.URL.Split('/')[4].ToInt32());
                origin_title.Add(xx.Title);
            }

            result.id           = id.ToArray();
            result.origin_title = origin_title.ToArray();

            Array.Sort(result.id, result.origin_title);

            var bbc = MessagePackSerializer.Serialize(result);

            using (FileStream fsStream = new FileStream(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "origin-title.json"), FileMode.Create))
                using (BinaryWriter sw = new BinaryWriter(fsStream))
                {
                    sw.Write(bbc);
                }

            var bbb = MessagePackSerializer.Serialize(result).ZipByte();

            using (FileStream fsStream = new FileStream(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "origin-title.compress"), FileMode.Create))
                using (BinaryWriter sw = new BinaryWriter(fsStream))
                {
                    sw.Write(bbb);
                }
        }