public async Task <bool> SetChapter(string path)
        {
            bool IsPathArchiveFile;
            bool chapterUpdated = false;

            if (Directory.Exists(path))
            {
                IsPathArchiveFile = false;
            }
            else if (PathHelper.EnsureValidArchives(path))
            {
                IsPathArchiveFile = true;
            }
            else
            {
                return(chapterUpdated);
            }

            Path        = path;
            Config.Path = Path;
            Title       = Path.Split(System.IO.Path.DirectorySeparatorChar).ToArray()[^ 1];
            ChapterList.Clear();
            var list = await collector.GetChapterListAsync(Path, IsPathArchiveFile);

            ChapterList.AddRange(list);
            chapterUpdated = true;
            return(chapterUpdated);
        }
示例#2
0
    public async void SwitchAnima(ChapterType chapterType)
    {
        Mask.gameObject.SetActive(true);

        switch (chapterType)
        {
        case ChapterType.Main:
            //全部移动到左边
            ChapterHelper.SetActive(m_chapterList.gameObject, true);
            m_chapterList.Init(_curVersionsMaxCount + 1, _passChapterID, _unlockMaxChapterID);

            m_OADList.transform.DOLocalMoveX(1242, 0.3f);
            ZjbBtn_canvasGroup.DOFade(0, switchBtnPosDutation);
            (ZjbBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondStartPosY, switchBtnPosDutation);
            diamondBtn_canvasGroup.DOFade(1, switchBtnPosDutation);
            (diamondBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondEndPosY, switchBtnPosDutation);

            m_chapterList.transform.DOLocalMoveX(0, 0.3f).OnComplete(() =>
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
            });

            StartCoroutine(CutIn(2));
            await UniTask.Delay(300);

            break;

        case ChapterType.OAD:

            ChapterHelper.SetActive(m_OADList.gameObject, true);
            m_chapterList.transform.DOLocalMoveX(-1242, 0.3f);
            ZjbBtn_canvasGroup.DOFade(1, switchBtnPosDutation);
            (ZjbBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondEndPosY, switchBtnPosDutation);
            diamondBtn_canvasGroup.DOFade(0, switchBtnPosDutation);
            (diamondBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondStartPosY, switchBtnPosDutation);

            m_OADList.transform.DOLocalMoveX(0, 0.3f).OnComplete(() =>
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
                Mask.gameObject.SetActive(false);
            });
            await UniTask.Delay(300);

            m_chapterList.Clear();
            break;
        }
    }
 private void _loadChapter()
 {
     ChapterList.Clear();
     SqlHelper.Conn.Open();
     using (var reader = SqlHelper.Select <BookChapter>("Id, BookId, Name, Position, Url", "WHERE BookId = @id ORDER BY Position ASC, Id ASC", new SqliteParameter("@id", Book.Id)))
     {
         while (reader.Read())
         {
             if (reader.HasRows)
             {
                 ChapterList.Add(new BookChapter(reader));
             }
         }
     }
     SqlHelper.Conn.Close();
 }
示例#4
0
        public void ImportMangaInfo()
        {
            Url         = savedinfo.url;
            Name        = savedinfo.name;
            Description = savedinfo.description;
            ImageSource = savedinfo.image?.ToFreezedBitmapImage();
            IsFavourite = savedinfo.isFavourite;
            IsCompleted = savedinfo.isCompleted;

            Dispatcher dispatcher;

            if (Dispatcher.CurrentDispatcher != Application.Current.Dispatcher)
            {
                dispatcher = Application.Current.Dispatcher;
            }
            else
            {
                dispatcher = Dispatcher.CurrentDispatcher;
            }

            dispatcher.Invoke(() =>
            {
                AuthorList = savedinfo.authors;

                GenreList.Clear();
                for (int i = 0; i < savedinfo.genres.Count; i++)
                {
                    GenreList.Add(new GenreItemViewModel {
                        Text = savedinfo.genres[i]
                    });
                }

                ChapterList.Clear();
                for (int i = 0; i < savedinfo.chapters.Count; i++)
                {
                    ChapterListItemViewModel model = new ChapterListItemViewModel(this, i)
                    {
                        Name = savedinfo.chapters[i],
                        URL  = savedinfo.chapterUrls[i]
                    };

                    model.CheckIfDownloaded();

                    ChapterList.Add(model);
                }
            });
        }
 private void LoadData(Volume volume)
 {
     IsLoading     = true;
     Id            = volume.Id;
     Title         = volume.Title;
     Author        = volume.Author;
     Description   = volume.Description;
     CoverImageUri = new Uri(volume.CoverImageUri);
     ChapterList.Clear();
     foreach (var cp in volume.Chapters)
     {
         var cpvm = new ChapterPreviewModel
         {
             Id    = cp.Id,
             No    = cp.ChapterNo,
             Title = cp.Title,
         };
         ChapterList.Add(cpvm);
     }
     IsLoading = false;
 }
        public void InitData(object obj = null)
        {
            CancleHttpRequest();

            if (CurrentEntity == obj as BookEntity && ChapterList.Count != 0)
            {
                return;
            }

            PageCount      = 1;
            PageIndex      = 1;
            CurrentEntity  = (obj as BookEntity);
            CurrentPageUrl = (obj as BookEntity).UpdateCatalogUrl;
            ContentTitle   = (obj as BookEntity).BookName;

            if (this.ChapterList != null)
            {
                ChapterList.Clear();
            }
            if (!ViewModelInstance.Instance.IsLogin)
            {
                IsAddBtnShow = false;
            }
            else if (ViewModelInstance.Instance.IsLogin && ViewModelInstance.Instance.SettingPageViewModelInstance.IfAutAddToShelf)
            {
                IsAddBtnShow = false;
            }
            else if (ViewModelInstance.Instance.IsLogin && !ViewModelInstance.Instance.SettingPageViewModelInstance.IfAutAddToShelf && ViewModelInstance.Instance.MyBookShelfViewModelInstance.ShelfBookList.ToList().Find(p => p.BookID == CurrentEntity.BookID) == null)
            {
                IsAddBtnShow = true;
            }
            else
            {
                IsAddBtnShow = false;
            }
            SetData(1);
        }