示例#1
0
 public static BitmapSource ToBitmapSource(this Bitmap bitmap) => ImageProcessor.Bitmap2BitmapSource(bitmap);
示例#2
0
 public static byte[] ToByteArray(this BitmapImage bitmapImage) => ImageProcessor.Image2Bytes(bitmapImage);
示例#3
0
 public static BitmapImage ToImage(this byte[] array) => ImageProcessor.Bytes2Image(array);
示例#4
0
        public async Task <List <Hitomi> > LoadCompre(List <string> items)
        {
            List <Hitomi> res = new List <Hitomi>();

            start(items.Count);
            foreach (string item in items)
            {
                if (item.isUrl())
                {
                    Uri uri = new Uri(item);
                    if (uri.Host == "hiyobi.me")
                    {
                        string id = Path.GetFileNameWithoutExtension(uri.AbsolutePath);
                        Hitomi h  = await new HiyobiLoader(text: id).Parser();
                        res.Add(h);
                        update(h, items.IndexOf(item), items.Count);
                    }
                    if (uri.Host == "hitomi.la")
                    {
                        string id = Path.GetFileNameWithoutExtension(uri.AbsolutePath);
                        this.url   = $"https://ltn.hitomi.la/galleryblock/{id}.html";
                        this.index = int.Parse(id);
                        Hitomi h = await HitomiData();

                        this.url = $"https://ltn.hitomi.la/galleries/{id}.js";
                        JObject info = await HitomiGalleryInfo();

                        h.type  = Hitomi.Type.Hitomi;
                        h.tags  = HitomiTags(info);
                        h.files = HitomiFiles(info).ToArray();
                        h.page  = h.files.Length;
                        h.thumb = await ImageProcessor.LoadWebImageAsync("https:" + h.thumbpath);

                        update(h, items.IndexOf(item), items.Count);
                    }
                }
                else
                {
                    var      allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".lock" };
                    string[] innerFiles        = Directory.GetFiles(item).Where(file => allowedExtensions.Any(file.ToLower().EndsWith)).ToArray().ESort();
                    if (innerFiles.Length <= 0)
                    {
                        continue;
                    }
                    Hitomi h = new Hitomi
                    {
                        name        = item.Split(Path.DirectorySeparatorChar).Last(),
                        dir         = item,
                        page        = innerFiles.Length,
                        files       = innerFiles,
                        thumb       = await ImageProcessor.ProcessEncryptAsync(innerFiles.First()),
                        type        = Hitomi.Type.Folder,
                        FolderByte  = File2.GetFolderByte(item),
                        SizePerPage = File2.GetSizePerPage(item)
                    };
                    update(h, items.IndexOf(item), items.Count);
                }
            }
            end();
            return(res);
        }