示例#1
0
        protected override bool GetInfomationPriv(HttpClientEx hc, ref int count)
        {
            DetailInfomation detailInfo     = null;
            HttpStatusCode   lastStatusCode = 0;

            var retrySuccess = Utility.Retry((retries) => (detailInfo = this.GetInfomationWorker(hc, retries, out lastStatusCode)) != null);

            if (!retrySuccess)
            {
                this.SetStatusFromHttpStatusCode(lastStatusCode);
                return(false);
            }

            this.Title = detailInfo.Title;
            this.Uri   = detailInfo.NewUri;

            try
            {
                ArchiveManager.UpdateDetail(detailInfo.MaruCode, this.Title, detailInfo.MangaList.Select(e => e.MangaCode).ToArray(), detailInfo.IsFinished);

                IEnumerable <Links> items = detailInfo.MangaList;

                if (this.AddNewonly)
                {
                    items = ArchiveManager.IsNewManga(items, e => DaruUriParser.Manga.GetCode(e.Uri));
                }

                var comics = items.Select(e => new MangaPage(this.AddNewonly, e.Uri, this.Title, e.MangaTitle)).ToArray();

                var noNew = this.AddNewonly && comics.Length == 0;

                MainWindow.Instance.InsertNewComic(this, comics, !noNew);

                if (noNew)
                {
                    this.State = MaruComicState.Complete_3_NoNew;
                    MainWindow.Instance.UpdateTaskbarProgress();
                }

                count = detailInfo.MangaList.Count;

                // Create Shortcut
                if (this.ConfigCur.CreateUrlLink)
                {
                    Directory.CreateDirectory(this.ConfigCur.UrlLinkPath);

                    var path = Path.Combine(this.ConfigCur.UrlLinkPath, $"{Utility.ReplaceInvalid(this.Title)}.url");
                    if (!File.Exists(path))
                    {
                        File.WriteAllText(path, $"[InternetShortcut]\r\nURL=" + this.Uri.AbsoluteUri);
                    }
                }

                return(count > 0);
            }
            catch (Exception ex)
            {
                this.State = MaruComicState.Error_1_Error;

                SentrySdk.CaptureException(ex);
            }

            return(false);
        }