Beispiel #1
0
        public static async Task <Pixeez.Objects.UgoiraInfo> GetUgoiraMetaInfo(this PixivItem item)
        {
            Pixeez.Objects.UgoiraInfo result = null;
            long id = 0;

            if (item.IsWork() && long.TryParse(item.ID, out id))
            {
                if (item.Ugoira is Pixeez.Objects.UgoiraInfo)
                {
                    result = item.Ugoira;
                }
                else if (item.Illust.UgoiraMeta is Pixeez.Objects.UgoiraInfo)
                {
                    result      = item.Illust.UgoiraMeta;
                    item.Ugoira = result;
                }
                else
                {
                    result = await GetUgoiraMetaInfo(id);

                    item.Illust.UgoiraMeta = result;
                    item.Ugoira            = result;
                }
            }
            return(result);
        }
Beispiel #2
0
 public void AddToHistory(PixivItem item)
 {
     if (HistoryItems.Items is ObservableCollection <PixivItem> )
     {
         Application.Current.HistoryAdd(item, HistoryItems.Items);
         UpdateDetail();
     }
 }
Beispiel #3
0
        private async Task <List <string> > GetPagesOriginalItems(PixivItem item)
        {
            List <string> pages = new List <string>();

            try
            {
                if (Options.IncludePagePreview)
                {
                    if (item.IsPage() || item.IsPages())
                    {
                        var setting = Application.Current.LoadSetting();
                        pages.Add(item.Illust.GetOriginalUrl(item.Index));
                    }
                    else if (item.IsWork())
                    {
                        var illust = item.Illust;
                        if (illust is Pixeez.Objects.Work && (illust.PageCount ?? 0) > 1)
                        {
                            if (illust is Pixeez.Objects.IllustWork)
                            {
                                var subset = illust as Pixeez.Objects.IllustWork;
                                if (subset.meta_pages.Count() > 1)
                                {
                                    foreach (var page in subset.meta_pages)
                                    {
                                        pages.Add(page.GetOriginalUrl());
                                    }
                                }
                            }
                            else if (illust is Pixeez.Objects.NormalWork)
                            {
                                var subset = illust as Pixeez.Objects.NormalWork;
                                if ((subset.PageCount ?? 0) >= 1 && subset.Metadata == null)
                                {
                                    subset.Metadata = await subset.GetMetaData();

                                    //illust = await illust.RefreshIllust();
                                }
                                if (illust != null && illust.Metadata is Pixeez.Objects.Metadata)
                                {
                                    item.Illust = illust;
                                    foreach (var page in illust.Metadata.Pages)
                                    {
                                        pages.Add(page.GetOriginalUrl());
                                    }
                                }
                            }
                            pages = pages.Distinct().ToList();
                        }
                    }
                }
            }
            catch (Exception ex) { ex.ERROR("PAGESCOUNTING"); }
            return(pages);
        }
Beispiel #4
0
 public static async Task <Pixeez.Objects.UgoiraInfo> GetUgoiraMeta(this PixivItem item, bool ajax = false)
 {
     if (ajax)
     {
         return(await GetUgoiraMetaInfo(item));
     }
     else
     {
         return(await GetUgoiraMetaInfo(item.Illust.Id ?? 0, tokens: null));
     }
 }