Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seng-Jik committed Apr 7, 2021
1 parent 4ad9d87 commit 30c62a2
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 25 deletions.
2 changes: 1 addition & 1 deletion KoKo/Danbooru.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type DanbooruSpider (name, domain) =
retry <- retry - 1
System.Threading.Thread.Sleep 5000
result)
|> Utils.takeWhileTimes 5 (function
|> Utils.takeWhileTimes 3 (function
| Ok x when x.Posts.Length > 0 -> true
| _ -> false)
|> Seq.choose (function
Expand Down
2 changes: 1 addition & 1 deletion KoKo/Konachan.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type KonachanSpider (args: SpiderArguments) =
let head = Seq.head pages
let pages = Seq.append [head] <| Seq.tail pages
pages
|> Utils.takeWhileTimes 5 (function
|> Utils.takeWhileTimes 3 (function
| Ok x when x.Posts.Length > 0 -> true
| _ -> false)
|> Seq.choose (function
Expand Down
2 changes: 1 addition & 1 deletion KoKo/SankakuComplex.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type SankakuComplex () =
retry <- retry - 1
System.Threading.Thread.Sleep 5000
result)
|> Utils.takeWhileTimes 5 (function
|> Utils.takeWhileTimes 3 (function
| Ok x when x.Length > 0 -> true
| _ -> false)
|> Seq.choose (function
Expand Down
64 changes: 43 additions & 21 deletions KoKoViewer/BrowsePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,28 +207,50 @@ from post in Browser.SelectedItems

private void Image_ImageOpened(object sender, RoutedEventArgs e)
{
var image = sender as Image;
var post = image.Tag as KoKo.Post;

var parent = (image.Parent as Grid);
var stackPanel = parent.Children
.Where(item => null != item as StackPanel)
.First() as StackPanel;


if (FavoritesData.Get().Has(post.fromSpider.Name, post.id))
(stackPanel.FindName("Info_Fav") as SymbolIcon).Visibility = Visibility.Visible;

if (DownloadHelper.GetDownloaded(post) != null)
(stackPanel.FindName("Info_Downloaded") as SymbolIcon).Visibility = Visibility.Visible;

var imageName = post.images.First().First().fileName.ToLower().Trim();

if (imageName.EndsWith(".gif"))
(stackPanel.FindName("Info_GIF") as SymbolIcon).Visibility = Visibility.Visible;
try
{
var image = sender as Image;
var post = image.Tag as KoKo.Post;

else if (imageName.EndsWith(".mp4") || imageName.EndsWith(".webm"))
(stackPanel.FindName("Info_Video") as SymbolIcon).Visibility = Visibility.Visible; ;
DependencyObject parent = VisualTreeHelper.GetParent(image);
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); ++i)
{
DependencyObject obj = VisualTreeHelper.GetChild(parent, i);
if (obj is StackPanel)
{
var stackPanel = (obj as StackPanel);
if (stackPanel.Name == "InformationDisplay")
{
try
{
if (FavoritesData.Get().Has(post.fromSpider.Name, post.id))
(stackPanel.FindName("Info_Fav") as SymbolIcon).Visibility = Visibility.Visible;
}
catch (Exception) { }

try
{
if (DownloadHelper.GetDownloaded(post) != null)
(stackPanel.FindName("Info_Downloaded") as SymbolIcon).Visibility = Visibility.Visible;
}
catch (Exception) { }

try
{
var imageName = post.images.First().First().fileName.ToLower().Trim();

if (imageName.EndsWith(".gif"))
(stackPanel.FindName("Info_GIF") as SymbolIcon).Visibility = Visibility.Visible;

else if (imageName.EndsWith(".mp4") || imageName.EndsWith(".webm"))
(stackPanel.FindName("Info_Video") as SymbolIcon).Visibility = Visibility.Visible;
}
catch (Exception) { }
}
}
}
}
catch (Exception) { }
}
}
}
2 changes: 1 addition & 1 deletion KoKoViewer/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="609b4b8f-a84f-4111-b119-af0006ce93d6"
Publisher="CN=KoKo"
Version="0.2.9.0" />
Version="0.3.0.0" />

<mp:PhoneIdentity PhoneProductId="609b4b8f-a84f-4111-b119-af0006ce93d6" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Anime wallpaper downloader.
* Spider输出内容改为Result,以将错误信息报告给GUI.
* More Spiders.
* KoKo.Viewer支持搜索时常用关键字补全。
* KoKo.Viewer支持查看历史记录。

## KoKoViewer
KoKoViewer是KoKo的使用UWP的GUI实现,提供了基本的浏览功能。
Expand Down

0 comments on commit 30c62a2

Please sign in to comment.