private void LoadFolder(string path) { var list = Directory.GetFiles(path).ToList(); list.Sort((x, y) => SortAlgorithm.ComparePath(x, y)); ImagePanel.Children.Clear(); list.ForEach(x => { if (x.EndsWith(".zip")) { ImagePanel.Children.Add(new ZipViewerElements(x)); } }); }
private void MangaCrawler_Loaded(object sender, RoutedEventArgs e) { Task.Run(() => { string base_url = "https://mangashow.me/bbs/page.php?hid=manga_list&page="; int max = MangashowmeParser.ParseMaxPage(NetCommon.DownloadString(base_url)); var result = EmiliaJob.Instance.AddJob(Enumerable.Range(0, max).Select(x => base_url + x).ToList(), (count) => { Application.Current.Dispatcher.BeginInvoke(new Action( delegate { ProgressText.Text = $"가져오는 중...[{count}/{max}]"; })); }); List <Tuple <string, string> > articles = new List <Tuple <string, string> >(); for (int i = 0; i < result.Count; i++) { articles.AddRange(MangashowmeParser.ParseIndex(result[i])); } foreach (var article in articles) { mangas.Add(Tuple.Create(article.Item1, article.Item2, article.Item2.Split('=').Last().Trim())); } mangas.Sort((x, y) => SortAlgorithm.ComparePath(x.Item3, y.Item3)); foreach (var manga in mangas) { elems.Add(new Lazy <MangaCrawlerElements>(() => { return(new MangaCrawlerElements(manga.Item1, manga.Item2, manga.Item3)); })); } Application.Current.Dispatcher.BeginInvoke(new Action( delegate { CollectStatusPanel.Visibility = Visibility.Collapsed; max_page = (mangas.Count - 1) / 36; set_page_segment(0); show_page(0); })); }); }
public ZipArtistsElements(string path, ZipArtistsArtistModel model, int rating, bool offline = false) { InitializeComponent(); ArtistTextBox.Text = model.ArtistName; Date.Text = model.LastAccessDate; ArticleCount.Text = model.ArticleData.Count + " Articles"; this.path = path; sub_folder = model.ArticleData.Select(x => x.Key).ToList(); sub_folder.Sort((x, y) => SortAlgorithm.ComparePath(y, x)); magics = model.ArticleData.Select(x => x.Value.Id).ToList(); magics.Sort((x, y) => y.CompareTo(x)); var tags = new Dictionary <string, int>(); foreach (var v in model.ArticleData) { if (v.Value.Tags != null) { foreach (var tag in v.Value.Tags) { if (tags.ContainsKey(tag)) { tags[tag] += 1; } else { tags.Add(tag, 1); } } } } var tag_list = tags.ToList(); tag_list.Sort((x, y) => y.Value.CompareTo(x.Value)); ScoreTextBox.Text = string.Join("\r\n", tag_list.Select(x => x.Key)); Loaded += ZipArtistsElements_Loaded; this.offline = offline; if (offline == true) { OpenFolder.IsEnabled = false; } }
private void load() { var vm = DataContext as BookmarkPageDataGridViewModel; vm.Items.Clear(); var ll = new List <BookmarkPageDataGridItemViewModel>(); foreach (var artist in BookmarkModelManager.Instance.Model.artists) { if (artist.Item1 == classify_name) { ll.Add(new BookmarkPageDataGridItemViewModel { 내용 = artist.Item2.content, 형 = "작가", 추가된날짜 = artist.Item2.stamp.ToString(), 경로 = artist.Item2.path, BIM = artist.Item2, 기타 = artist.Item2.etc }); } } foreach (var group in BookmarkModelManager.Instance.Model.groups) { if (group.Item1 == classify_name) { ll.Add(new BookmarkPageDataGridItemViewModel { 내용 = group.Item2.content, 형 = "그룹", 추가된날짜 = group.Item2.stamp.ToString(), 경로 = group.Item2.path, BIM = group.Item2, 기타 = group.Item2.etc }); } } foreach (var article in BookmarkModelManager.Instance.Model.articles) { if (article.Item1 == classify_name) { ll.Add(new BookmarkPageDataGridItemViewModel { 내용 = article.Item2.content + " - " + HitomiLegalize.GetMetadataFromMagic(article.Item2.content)?.Name, 형 = "작품", 추가된날짜 = article.Item2.stamp.ToString(), 경로 = article.Item2.path, BIM = article.Item2, 기타 = article.Item2.etc }); } } ll.Sort((x, y) => SortAlgorithm.ComparePath(y.추가된날짜, x.추가된날짜)); for (int i = 0; i < ll.Count; i++) { ll[i].인덱스 = (i + 1).ToString(); } foreach (var item in ll) { vm.Items.Add(item); } }
private void sort_data(int column, int row) { if (column == 0) { elems.Sort((x, y) => SortAlgorithm.ComparePath(x.Item1.Key, y.Item1.Key)); } else if (column == 1) { elems.Sort((x, y) => DateTime.Parse(x.Item1.Value.LastAccessDate).CompareTo(DateTime.Parse(y.Item1.Value.LastAccessDate))); } else if (column == 2) { elems.Sort((x, y) => x.Item1.Value.Size.CompareTo(y.Item1.Value.Size)); } else if (column == 3) { elems.Sort((x, y) => x.Item1.Value.ArtistName.CompareTo(y.Item1.Value.ArtistName)); } else if (column == 4) { elems.Sort((x, y) => x.Item1.Value.ArticleData.Count.CompareTo(y.Item1.Value.ArticleData.Count)); } //else if (column == 5) //{ // elems.Sort((x, y) => get_rate(Convert.ToInt32(x.Item1.Value.ArtistName)).CompareTo(get_rate(Convert.ToInt32(y.Item1.Value.ArtistName)))); //} else if (column == 5) { elems.Sort((x, y) => x.Item1.Value.ArticleData.Select(z => z.Value.Pages).Sum().CompareTo(y.Item1.Value.ArticleData.Select(z => z.Value.Pages).Sum())); } else if (column == 6) { elems.Sort((x, y) => ((double)x.Item1.Value.ArticleData.Select(z => z.Value.Pages).Sum() / x.Item1.Value.ArticleData.Count).CompareTo( ((double)y.Item1.Value.ArticleData.Select(z => z.Value.Pages).Sum() / y.Item1.Value.ArticleData.Count))); } if (row == 1) { elems.Reverse(); } }