Beispiel #1
0
        private void CheckMangaEntry(MangaEntry entry, string title, MangaEntryStatus status, int chaptersRead, int volumesRead,
                                     int score, int priority, bool isPrivate, bool hiddenDefault, string notes,
                                     int[] advancedRatingScores, int[] customLists, DateTime?startedOn, DateTime?endedOn)
        {
            Assert.NotNull(entry);
            Assert.AreEqual(title, entry.Manga.TitleEnglish);
            Assert.AreEqual(status, entry.ListStatus);
            Assert.AreEqual(chaptersRead, entry.ChaptersRead);
            Assert.AreEqual(volumesRead, entry.VolumesRead);
            Assert.AreEqual(score, entry.Score);
            Assert.AreEqual(priority, entry.Priority); // NOTE: Don't know what this is actually used for, but it seems to always be 0
            Assert.AreEqual(isPrivate, entry.Private);
            Assert.AreEqual(hiddenDefault, entry.HiddenDefault);
            Assert.AreEqual(notes, entry.Notes);

            Assert.AreEqual(advancedRatingScores.Length, entry.AdvancedRatingScores.Length);
            for (var i = 0; i < advancedRatingScores.Length; i++)
            {
                Assert.AreEqual(advancedRatingScores[i], entry.AdvancedRatingScores[i]);
            }

            // TODO: Gotta figure out how the custom list system actually works
            //Assert.AreEqual(customLists.Length, entry.CustomLists.Length);
            //foreach (var list in customLists)
            //    Assert.True(entry.CustomLists.Contains(list));

            Assert.AreEqual(startedOn, entry.StartedOn);
            Assert.AreEqual(endedOn, entry.FinishedOn);
        }
Beispiel #2
0
        /// <summary>
        /// Adds manga to specific user's list
        /// </summary>
        /// <param name="searchEntry">The search entry you found.</param>
        /// <param name="status">The status of the manga Reading, Completed, Onhold, Dropped...</param>
        /// <returns>A string represnting the state of adding "Created" or detailed error message.</returns>
        public string AddManga(MangaSearchEntry searchEntry, MangaListStatus status)
        {
            m_api.CheckAuth();
            MangaEntry addedManga = new MangaEntry()
            {
                Status = status,
            };

            return(m_api.PostSerializedObject(addedManga, string.Format(MAL.url_addManga, searchEntry.Id)));
        }
Beispiel #3
0
        /// <summary>
        /// Adds manga to specific user's list
        /// </summary>
        /// <param name="searchEntry">The search entry you found.</param>
        /// <param name="status">The status of the manga Reading, Completed, Onhold, Dropped...</param>
        /// <returns>A string represnting the state of adding "Created" or detailed error message.</returns>
        public async Task <string> AddMangaAsync(MangaSearchEntry searchEntry, MangaListStatus status)
        {
            m_api.CheckAuthAsync();

            MangaEntry addedManga = new MangaEntry()
            {
                Status = status,
            };

            return(await m_api.PostSerializedObjectAsync(addedManga, string.Format(MAL.url_addManga, searchEntry.Id)));
        }
Beispiel #4
0
        public static void UpdateManga(string mangaCode, string mangaName, string mangaZipPath)
        {
            lock (Manga)
            {
                bool       found = false;
                MangaEntry entry = null;

                for (var i = 0; i < Manga.Count; ++i)
                {
                    entry = Manga[i];
                    if (string.Equals(entry.MangaCode, mangaCode, StringComparison.OrdinalIgnoreCase))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    entry = new MangaEntry
                    {
                        MangaCode   = mangaCode,
                        TitleWithNo = mangaName,
                        ZipPath     = mangaZipPath,
                    };

                    Application.Current.Dispatcher.Invoke(new Action <MangaEntry>(Manga.Add), entry);

                    lock (Detail)
                        Detail.FirstOrDefault(le => le.MangaCodes != null && le.MangaCodes.Contains(mangaCode))?.RecalcCompleted();
                }

                entry.Archived = DateTime.Now;

                ConfigManager.Save();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Adds manga to specific user's list.
        /// </summary>
        /// <param name="addedManga">The new added manga to the list.</param>
        /// <param name="mangaId">The ID of the new added manga.</param>
        /// <returns>A string represnting the state of adding "Created" or detailed error message.</returns>
        public async Task <string> AddMangaAsync(MangaEntry addedManga, int mangaId)
        {
            m_api.CheckAuthAsync();

            return(await m_api.PostSerializedObjectAsync(addedManga, string.Format(MAL.url_addManga, mangaId)));
        }
Beispiel #6
0
        /// <summary>
        /// Updates existing manga in user's list.
        /// </summary>
        /// <param name="newMangaInfo">The updated manga object.</param>
        /// <param name="mangaId">the ID of the manga you want to update.</param>
        /// <returns>A string represnting the state of updating "Updated" or detailed error message.</returns>
        public string UpdateManga(MangaEntry newMangaInfo, int mangaId)
        {
            m_api.CheckAuth();

            return(m_api.PostSerializedObject(newMangaInfo, string.Format(MAL.url_updateManga, mangaId)));
        }
Beispiel #7
0
        /// <summary>
        /// Adds manga to specific user's list.
        /// </summary>
        /// <param name="addedManga">The new added manga to the list.</param>
        /// <param name="mangaId">The ID of the new added manga.</param>
        /// <returns>A string represnting the state of adding "Created" or detailed error message.</returns>
        public string AddManga(MangaEntry addedManga, int mangaId)
        {
            m_api.CheckAuth();

            return(m_api.PostSerializedObject(addedManga, string.Format(MAL.url_addManga, mangaId)));
        }
Beispiel #8
0
        /// <summary>
        /// Updates existing manga in user's list.
        /// </summary>
        /// <param name="newMangaInfo">The updated manga object.</param>
        /// <param name="mangaId">the ID of the manga you want to update.</param>
        /// <returns>A string represnting the state of updating "Updated" or detailed error message.</returns>
        public async Task <string> UpdateMangaAsync(MangaEntry newMangaInfo, int mangaId)
        {
            m_api.CheckAuthAsync();

            return(await m_api.PostSerializedObjectAsync(newMangaInfo, string.Format(MAL.url_updateManga, mangaId)));
        }