Esempio n. 1
0
 public Reader(Hitomi hitomi)
 {
     this.Background = new SolidColorBrush(Global.background);
     this.hitomi     = hitomi;
     this.window     = Global.MainWindow;
     this.page       = 0;
     InitializeComponent();
     Init();
 }
Esempio n. 2
0
 public HitomiPanel(Hitomi h, MainWindow sender)
 {
     this.h          = h;
     this.thumb      = h.thumb;
     this.MainWindow = sender;
     InitializeComponent();
     InitEvent();
     Init();
 }
Esempio n. 3
0
        public static Hitomi GetHitomi(string path, string patturn = Global.basicPatturn)
        {
            string[] innerFiles = System.IO.Directory.GetFiles(path, patturn).ESort().ToArray();
            Hitomi   h          = new Hitomi
            {
                name  = path.Split(System.IO.Path.DirectorySeparatorChar).Last(),
                dir   = path,
                page  = innerFiles.Length,
                thumb = new BitmapImage(new System.Uri(innerFiles.First()))
            };

            return(h);
        }
Esempio n. 4
0
        public static Hitomi Copy(Hitomi hitomi)
        {
            Hitomi h = new Hitomi();

            h.name        = hitomi.name;
            h.dir         = hitomi.dir;
            h.page        = hitomi.page;
            h.files       = hitomi.files;
            h.thumbpath   = hitomi.thumbpath;
            h.FolderByte  = hitomi.FolderByte;
            h.SizePerPage = hitomi.SizePerPage;
            h.thumb       = hitomi.thumb;
            h.images      = hitomi.images;
            return(h);
        }
Esempio n. 5
0
        private async void Search_Button_Click(object sender, RoutedEventArgs e)
        {
            string SearchText = Search_Text.Text;
            int    number     = 0;

            if (int.TryParse(SearchText, out number))
            {
                MainPanel.Children.Clear();
                InternetP            parser = new InternetP(index: number);
                Tuple <bool, Hitomi> data   = await parser.isHiyobiData();

                bool   result = data.Item1;
                Hitomi h      = data.Item2;
                if (!result)
                {
                    h = await parser.HitomiData();
                }
                MainPanel.Children.Add(new HitomiPanel(h, this, true));
            }
            else
            {
                File_Search_Button_Click(sender, e);
            }
        }
Esempio n. 6
0
        public void LoadHitomi(string[] files)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => label.Visibility = Visibility.Hidden));
            if (files.Length <= 0)
            {
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => label.Visibility = Visibility.Hidden));
                return;
            }
            string[] Folders      = FolderSort(files);
            int      i            = 0;
            int      SelectedPage = 1;

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                this.Background = new SolidColorBrush(Global.background);
                MainPanel.Children.Clear();
                if (SearchMode2.SelectedIndex == 1)
                {
                    Folders = Folders.Reverse().ToArray();
                }
                SelectedPage = Page_Index.SelectedIndex + 1;
                this.Title   = string.Format("MainWindow - {0}페이지", SelectedPage);
            }));
            foreach (string folder in Folders.Where(x => Array.IndexOf(Folders, x) + 1 <= Page_itemCount * SelectedPage && Array.IndexOf(Folders, x) + 1 > (SelectedPage - 1) * Page_itemCount))
            {
                i++;
                Console.WriteLine("{0}: {1}", i, folder);
                var      allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".lock" };
                string[] innerFiles        = Directory.GetFiles(folder).Where(file => allowedExtensions.Any(file.ToLower().EndsWith)).ToArray().ESort();
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    Hitomi h = new Hitomi
                    {
                        name        = folder.Split(Path.DirectorySeparatorChar).Last(),
                        dir         = folder,
                        page        = innerFiles.Length,
                        files       = innerFiles,
                        type        = Hitomi.Type.Folder,
                        FolderByte  = File2.GetFolderByte(folder),
                        SizePerPage = File2.GetSizePerPage(folder)
                    };
                    if (innerFiles.Length <= 0)
                    {
                        h.thumb     = ImageProcessor.FromResource("NoImage.jpg");
                        h.thumbpath = "";
                    }
                    else
                    {
                        h.thumb     = ImageProcessor.ProcessEncrypt(innerFiles.First());
                        h.thumbpath = innerFiles.First();
                    }
                    if (h.thumb == null)
                    {
                        return;
                    }
                    label.FontSize = 100;
                    label.Content  = i + "/" + Page_itemCount;
                    MainPanel.Children.Add(new HitomiPanel(h, this, true));
                    Console.WriteLine("Completed: {0}", folder);
                }));
            }
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => label.Visibility = Visibility.Hidden));
        }