public static void ShowDetail(Image img)
 {
     FileItem fileItem = img.Tag as FileItem;
     if (fileItem == null) return;
     MoreInfo moreInfo = new MoreInfo(fileItem.Name, fileItem.FullName, fileItem.IconAssociated);
     moreInfo.ShowDialog();
 }
示例#2
0
        public MoreInfo MovieInfo(string id)
        {
            if (id != null)
            {
                try
                {
                    MoreInfo moreInfo = _client.MovieInfo(id);

                    moreInfo.characters = _client.Characters(id);

                    moreInfo.pictures = _client.Pictures(id);
                    try
                    {
                        moreInfo = (TranslatorText.Translate(moreInfo)).Result;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    return(moreInfo);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        public override JToken ToJToken(ApiVersion version, ResultFormat format)
        {
            var obj = new JObject();

            if (Type != null)
            {
                obj["type"] = Type.ToString();
            }

            if (Name != null)
            {
                obj["name"] = Name.ToJToken(version, format);
            }

            if (Description != null)
            {
                obj["description"] = Description.ToJToken(version, format);
            }

            if (MoreInfo != null)
            {
                obj["moreInfo"] = MoreInfo.ToString();
            }

            if (Extensions != null)
            {
                obj["extensions"] = Extensions.ToJToken(version, format);
            }

            return(obj);
        }
        /// <summary>
        /// To the j object.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <returns>JObject.</returns>
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Type != null)
            {
                result.Add("type", Type.ToString());
            }
            if (MoreInfo != null)
            {
                result.Add("moreInfo", MoreInfo.ToString());
            }
            if (Name != null && !Name.IsEmpty())
            {
                result.Add("name", Name.ToJObject(version));
            }
            if (Description != null && !Description.IsEmpty())
            {
                result.Add("description", Description.ToJObject(version));
            }
            if (Extensions != null && !Extensions.IsEmpty())
            {
                result.Add("extensions", Extensions.ToJObject(version));
            }

            return(result);
        }
示例#5
0
        public UserProfileMapping findUserProfileMappingById(int id)
        {
            User user = findById(id);
            UserProfileMapping userProfileMapping = new UserProfileMapping();

            userProfileMapping.Id           = user.Id;
            userProfileMapping.DateOfBirth  = user.DateOfBirth.GetValueOrDefault();
            userProfileMapping.FullName     = user.Fullname;
            userProfileMapping.Gender       = user.Gender.GetValueOrDefault();
            userProfileMapping.ProfileImage = user.ProfileImage;
            userProfileMapping.HouseId      = user.HouseId.GetValueOrDefault();
            userProfileMapping.HouseName    = user.House == null ? "Không xác định" : user.House.HouseName;
            userProfileMapping.CreatedDate  = user.CreateDate.Value.ToString(AmsConstants.DateFormat);
            userProfileMapping.Age          = CommonUtil.CalculateAge(user.DateOfBirth.Value);
            userProfileMapping.HouseProfile = user.House == null || user.House.ProfileImage == null || user.House.ProfileImage.Equals("") ? "/Content/Images/home_default.jpg" : user.House.ProfileImage;
            List <Post>     rawPost   = user.Posts.OrderByDescending(p => p.CreateDate).Take(5).ToList();
            List <MoreInfo> moreInfos = new List <MoreInfo>();

            foreach (Post p in rawPost)
            {
                MoreInfo pInfo = new MoreInfo();
                pInfo.Id          = p.Id + "";
                pInfo.createdDate = p.CreateDate.Value.ToString("s");
                pInfo.PostText    = CommonUtil.TruncateLongString(p.Body, 100);
                moreInfos.Add(pInfo);
            }
            userProfileMapping.moreInfos = moreInfos;
            return(userProfileMapping);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MoreInfo moreInfo = db.MoreInfos.Find(id);

            db.MoreInfos.Remove(moreInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#7
0
        private void btnMoreInfo_Click(object sender, RoutedEventArgs e)
        {
            MoreInfo moreInfo = new MoreInfo();

            this.Hide();
            moreInfo.ShowDialog();
            this.Show();
        }
 public ActionResult Edit([Bind(Include = "Id,Title,Text")] MoreInfo moreInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(moreInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(moreInfo));
 }
        public ActionResult Create([Bind(Include = "Id,Title,Text")] MoreInfo moreInfo)
        {
            if (ModelState.IsValid)
            {
                db.MoreInfos.Add(moreInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(moreInfo));
        }
        public static void ShowDetail(Image img)
        {
            FileItem fileItem = img.Tag as FileItem;

            if (fileItem == null)
            {
                return;
            }
            MoreInfo moreInfo = new MoreInfo(fileItem.Name, fileItem.FullName, fileItem.IconAssociated);

            moreInfo.ShowDialog();
        }
示例#11
0
        // creo dati di prova
        private MoreInfo createMoreInfoData(int i)
        {
            MoreInfo data = new MoreInfo();

            data.codice          = i;
            data.materiale       = "mat" + i;
            data.lunghezza       = i;
            data.costo           = i + 2;
            data.info            = "info" + i;
            data.nomeCommittente = "committ" + i;
            data.azienda         = "az" + i;
            return(data);
        }
        public void SetUp()
        {
            // Initializes web driver and pages
            this._driver       = new FirefoxDriver();
            this._homePage     = new Home(this._driver);
            this._moreInfoPage = new MoreInfo(this._driver);

            // Sets a bit longer page load timeout in case the application pool starts
            this._driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(Constants.PageLoadTimeoutInSeconds));

            // Maximizes the web driver window
            this._driver.Manage().Window.Maximize();
        }
        // GET: Admin/MoreInfoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MoreInfo moreInfo = db.MoreInfos.Find(id);

            if (moreInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(moreInfo));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (MoreInfo != null)
         {
             hashCode = hashCode * 59 + MoreInfo.GetHashCode();
         }
         if (MntoverlaydamguicontentassetsmoreinfoHtmlpath != null)
         {
             hashCode = hashCode * 59 + MntoverlaydamguicontentassetsmoreinfoHtmlpath.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#15
0
        public List <Picture> Pictures(string id)
        {
            using (HttpClient AruppiClient = new HttpClient())
            {
                string url = _iconfiguration.GetSection("Keys").GetSection("UrlBase").Value + string.Format("anime/{0}/pictures", id);

                AruppiClient.BaseAddress = new Uri(url);



                StringBuilder path = new StringBuilder(url);

                MoreInfo respuesta = new MoreInfo();


                using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(path.ToString())))
                {
                    try
                    {
                        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                        HttpResponseMessage response = AruppiClient.GetAsync(url).Result;

                        string jsonString = response.Content.ReadAsStringAsync().Result;

                        if (response.IsSuccessStatusCode && response.StatusCode.Equals(System.Net.HttpStatusCode.OK))
                        {
                            respuesta = JsonConvert.DeserializeObject <MoreInfo>(jsonString);
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                    return(respuesta.pictures);
                }
            }
        }
示例#16
0
        protected override async Task OnAppearingAnimationEndAsync()
        {
            if (!IsAnimationEnabled)
            {
                return;
            }

            var translateLength = 400u;

            await Task.WhenAll(
                FoodName.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                FoodName.FadeTo(1)
                //,
                //(new Func<Task>(async () =>
                //{
                //    await Task.Delay(200);
                //    await Task.WhenAll(
                //        FoodFat.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                //        FoodFat.FadeTo(1));

                //}))()
                );

            await Task.WhenAll(
                CloseImage.FadeTo(1),
                CloseImage.ScaleTo(1, easing: Easing.SpringOut),
                CloseImage.RotateTo(0),
                FoodCal.ScaleTo(1),
                FoodCal.FadeTo(1),
                FoodCarb.ScaleTo(1),
                FoodCarb.FadeTo(1),
                FoodProt.ScaleTo(1),
                FoodProt.FadeTo(1),
                FoodFat.ScaleTo(1),
                FoodFat.FadeTo(1),
                TimesPressed.ScaleTo(1),
                TimesPressed.FadeTo(1),
                IsCustom.ScaleTo(1),
                IsCustom.FadeTo(1),
                MoreInfo.ScaleTo(1),
                MoreInfo.FadeTo(1));
        }
示例#17
0
        public MoreInfo RequestMoreInfo()
        {
            HttpWebRequest request = Requests.CreateDefaultRequest(m_datasheetSiteLink);
            string         result  = Requests.ReadResponseString(request);

            HtmlDocument document = new HtmlDocument();

            document.LoadHtml(result);

            HtmlNode rootElement = document.DocumentNode;

            IEnumerable <HtmlNode> matchingNodes = from node in rootElement.Descendants("td")
                                                   where IsAttributeValueLike(node, "width", "283") && IsAttributeValueLike(node, "height", "367") &&
                                                   IsAttributeValueLike(node, "align", "center") && IsAttributeValueLike(node, "valign", "top")
                                                   select node;

            HtmlNode aNode = matchingNodes.ElementAt(0).Element("a");

            MoreInfo moreInfo = new MoreInfo();

            moreInfo.PdfSite = GetAttributeValueOrEmpty(aNode, "href");

            matchingNodes = from node in rootElement.Descendants("td")
                            where IsAttributeValueLike(node, "height", "40") && IsAttributeValueLike(node, "class", "gray_title") &&
                            IsAttributeValueLike(node, "width", "88")
                            select node;

            HtmlNode sizeNode = matchingNodes.ElementAt(2).ParentNode;

            moreInfo.Size = sizeNode.Elements("td").ElementAt(1).Element("font").InnerText;

            HtmlNode pagesNode = matchingNodes.ElementAt(3).ParentNode;

            moreInfo.Pages = pagesNode.Elements("td").ElementAt(1).Element("font").InnerText;

            HtmlNode manufacturerSiteNode = matchingNodes.ElementAt(5).ParentNode;

            moreInfo.ManufacturerSite = manufacturerSiteNode.Elements("td").ElementAt(1).InnerText;

            return(moreInfo);
        }
        /// <summary>
        /// Returns true if ComDayCqDamCoreImplServletCompanionServletProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqDamCoreImplServletCompanionServletProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqDamCoreImplServletCompanionServletProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MoreInfo == other.MoreInfo ||
                     MoreInfo != null &&
                     MoreInfo.Equals(other.MoreInfo)
                     ) &&
                 (
                     MntoverlaydamguicontentassetsmoreinfoHtmlpath == other.MntoverlaydamguicontentassetsmoreinfoHtmlpath ||
                     MntoverlaydamguicontentassetsmoreinfoHtmlpath != null &&
                     MntoverlaydamguicontentassetsmoreinfoHtmlpath.Equals(other.MntoverlaydamguicontentassetsmoreinfoHtmlpath)
                 ));
        }
示例#19
0
        public static async System.Threading.Tasks.Task <MoreInfo> Translate(MoreInfo moreInfo)
        {
            try
            {
                if (moreInfo.synopsis != null)
                {
                    moreInfo.synopsis = await TranslateText(moreInfo.synopsis);
                }

                if (moreInfo.background != null)
                {
                    moreInfo.background = await TranslateText(moreInfo.background);
                }

                if (moreInfo.broadcast != null && !moreInfo.broadcast.Contains("Unknown"))
                {
                    string[] broadCas = moreInfo.broadcast.Split(new string[] { " " }, StringSplitOptions.None);
                    moreInfo.broadcast = await(TranslateText(broadCas[0])) + " " + broadCas[broadCas.Length - 2] + " " + broadCas[broadCas.Length - 1];
                }
                else if (moreInfo.broadcast != null && moreInfo.broadcast.Contains("Unknown"))
                {
                    string[] broadCas = moreInfo.broadcast.Split(new string[] { " " }, StringSplitOptions.None);
                    moreInfo.broadcast = await(TranslateText(broadCas[0]));
                }

                if (moreInfo.genres != null)
                {
                    moreInfo.genres = await TranslateGenres(moreInfo.genres);
                }

                return(moreInfo);
            }catch (Exception ex)
            {
                throw ex;
            }
        }
示例#20
0
 private string GetBriefAllNotes() =>
 MoreInfo?.OrderBy(p => p.ChartRatingClass).Select(p => p.ChartAllNotes).ToStringJoin('/').TrimEnd('/');
示例#21
0
        static void Main(string[] args)
        {
            // Initialize JikanWrapper
            IJikan jikan = new Jikan(true);

            // Send request for "Cowboy Bebop" anime
            Anime cowboyBebop = jikan.GetAnime(1).Result;

            // Output -> "Cowboy Bebop"
            Console.WriteLine(cowboyBebop.Title);
            // Output -> "TV"
            Console.WriteLine(cowboyBebop.Type);
            // Output -> "R - 17+ (violence & profanity)"
            Console.WriteLine(cowboyBebop.Rating);


            // Send request for episodes of "Cowboy Bebop" anime
            AnimeEpisodes episodes = jikan.GetAnimeEpisodes(1).Result;

            // Output -> "1"
            Console.WriteLine("Last page: " + episodes.EpisodesLastPage);

            // Print number and English title of each episode
            foreach (AnimeEpisode episode in episodes.EpisodeCollection)
            {
                Console.WriteLine("Episode " + episode.Id + ", English title: " + episode.Title);
            }

            // Send request for episodes of "One Piece" anime -> loads data of episodes from 1 to 100
            AnimeEpisodes onePieceEpisodes = jikan.GetAnimeEpisodes(21).Result;

            // Send request for episodes of "One Piece" anime -> loads data of episodes from 1 to 100
            onePieceEpisodes = jikan.GetAnimeEpisodes(21, 1).Result;

            // Send request for episodes of "One Piece" anime -> loads data of episodes from 101 to 200
            onePieceEpisodes = jikan.GetAnimeEpisodes(21, 2).Result;

            // Send request for "Berserk" manga
            Manga berserkManga = jikan.GetManga(2).Result;

            // Output -> "Berserk"
            Console.WriteLine(berserkManga.Title);
            // Output -> "Publishing"
            Console.WriteLine(berserkManga.Status);

            // Send request for episodes of "Cowboy Bebop" staff and members
            AnimeCharactersStaff charactersStaff = jikan.GetAnimeCharactersStaff(1).Result;

            // Print all characters names and their role (main or supporting).
            foreach (var character in charactersStaff.Characters)
            {
                Console.WriteLine(character.Name + " (" + character.Role + ")");
            }

            // Print all staff members names and their position during production.
            foreach (var staffMember in charactersStaff.Staff)
            {
                Console.WriteLine(staffMember.Name + " (" + String.Join(", ", staffMember.Role) + ")");
            }

            // Send request for pictures of "Cowboy Bebop"
            AnimePictures pictures = jikan.GetAnimePictures(1).Result;

            // Print link to every picture.
            foreach (Picture picture in pictures.Pictures)
            {
                Console.WriteLine(picture.Large);;
            }

            // Send request for episodes of "Cowboy Bebop" pictures
            AnimeNews news = jikan.GetAnimeNews(1).Result;

            // Print date of each news
            foreach (News newsEntry in news.News)
            {
                Console.WriteLine(newsEntry.Date);
            }

            // Send request for videos of "Cowboy Bebop"
            AnimeVideos videos = jikan.GetAnimeVideos(1).Result;

            // Print each episode video title
            foreach (var episode in videos.EpisodeVideos)
            {
                Console.WriteLine("Episode " + episode.NumberedTitle + ": " + episode.Title);
            }

            // Print each promo video title
            foreach (var promo in videos.PromoVideos)
            {
                Console.WriteLine(promo.Title);
            }

            // Send request for statistics of "Cowboy Bebop"
            AnimeStats stats = jikan.GetAnimeStatistics(1).Result;

            // Print statistics to output.
            Console.WriteLine("Comppleted by " + stats.Completed + " users");
            Console.WriteLine("Being watched by " + stats.Watching + " users");
            Console.WriteLine("Dropped by " + stats.Dropped + " users");

            // Send request for forum topics of "Cowboy Bebop"
            ForumTopics forumTopics = jikan.GetAnimeForumTopics(1).Result;

            // Post each topic title and date of creation
            foreach (var topic in forumTopics.Topics)
            {
                Console.WriteLine(topic.Title + ", created:" + topic.DatePosted);
            }

            // Send request for more info of "Cowboy Bebop"
            MoreInfo moreInfo = jikan.GetAnimeMoreInfo(1).Result;

            // Output -> "Suggested Order..."
            Console.WriteLine("Additional info:" + moreInfo.Info);

            // Send request for pictures of "Berserk" manga.
            MangaPictures berserkPics = jikan.GetMangaPictures(2).Result;

            // Print link to every picture.
            foreach (Picture picture in pictures.Pictures)
            {
                Console.WriteLine(picture.Large);;
            }

            // Send request for "Berserk" characters
            MangaCharacters berserkCharacters = jikan.GetMangaCharacters(1).Result;

            // Print all characters names and their role (main or supporting).
            foreach (var character in berserkCharacters.Characters)
            {
                Console.WriteLine(character.Name + " (" + character.Role + ")");
            }

            // Send request for "Berserk" news
            MangaNews berserjNews = jikan.GetMangaNews(2).Result;

            // Print date of each news
            foreach (News newsEntry in news.News)
            {
                Console.WriteLine(newsEntry.Date);
            }

            // Send request for statistics of "Berserk" manga
            MangaStats berserkStats = jikan.GetMangaStatistics(2).Result;

            // Print statistics to output.
            Console.WriteLine("Completed by " + berserkStats.Completed + " users");
            Console.WriteLine("Being read by " + berserkStats.Reading + " users");
            Console.WriteLine("Dropped by " + berserkStats.Dropped + " users");

            // Send request for forum topics of "Berserk" manga.
            ForumTopics bersekrForumTopics = jikan.GetMangaForumTopics(2).Result;

            // Post each topic title and date of creation
            foreach (var topic in bersekrForumTopics.Topics)
            {
                Console.WriteLine(topic.Title + ", created:" + topic.DatePosted);
            }

            // Send request for more info of "Berserk" manga.
            MoreInfo berserkMoreInfo = jikan.GetMangaMoreInfo(2).Result;

            // Output -> "Berserk: The Prototype (1988)"
            Console.WriteLine("Additional info:" + moreInfo.Info);

            // Send request for Hayao Miyazaki
            Person hayaoMiyazaki = jikan.GetPerson(1870).Result;

            // List Miyazaki anime on output
            foreach (var staffPosition in hayaoMiyazaki.AnimeStaffPositions)
            {
                Console.WriteLine("Anime: " + staffPosition.Anime.Name + ", role: " + staffPosition.Position);
            }

            // Send request for pictures of Hayao Miyazaki.
            PersonPictures hayaoMiyazakiPics = jikan.GetPersonPictures(1870).Result;

            // Print link to every picture.
            foreach (Picture picture in hayaoMiyazakiPics.Pictures)
            {
                Console.WriteLine(picture.Large);;
            }

            // Send request for Lain Iwakura
            Character lainIwakura = jikan.GetCharacter(2219).Result;

            // List Lain's voice actresses with their respective languages
            foreach (var voiceActor in lainIwakura.VoiceActors)
            {
                Console.WriteLine("Name: " + voiceActor.Name + ", language: " + voiceActor.Language);
            }

            // List all anime in which Lain appeared
            foreach (var anime in lainIwakura.Animeography)
            {
                Console.WriteLine("Title: " + anime.Name);
            }

            // Send request for pictures of Spike Spiegel.
            CharacterPictures spikePics = jikan.GetCharacterPictures(1).Result;

            // Print link to every picture.
            foreach (Picture picture in spikePics.Pictures)
            {
                Console.WriteLine(picture.Large);;
            }

            // Send request for current season.
            Season season = jikan.GetSeason().Result;

            // Print season basic information
            Console.WriteLine("Season : " + season.SeasonYear + " " + season.SeasonName);

            // Print each anime title of the season.
            foreach (var seasonEntry in season.SeasonEntries)
            {
                Console.WriteLine(seasonEntry.Title);
            }

            // Send request for Fall 2010
            season = jikan.GetSeason(2010, Seasons.Fall).Result;

            // Send request for season archives
            SeasonArchives seasonArchive = jikan.GetSeasonArchive().Result;

            // Print all available years with their available seasons
            foreach (var archive in seasonArchive.Archives)
            {
                Console.WriteLine("Year: " + archive.Year + ", available seasons: " + string.Join(", ", archive.Season));
            }

            // Send request for schedule
            Schedule schedule = jikan.GetSchedule().Result;

            // Print title of each anime airing on monday
            foreach (var mondayAnime in schedule.Monday)
            {
                Console.WriteLine(mondayAnime.Title);
            }

            // Print title of each anime with irregular airing cycle.
            foreach (var other in schedule.Other)
            {
                Console.WriteLine(other.Title);
            }

            // Send request for Sunday schedule
            schedule = jikan.GetSchedule(ScheduledDay.Sunday).Result;

            // Print title of each anime airing on monday
            foreach (var sundayAnime in schedule.Sunday)
            {
                Console.WriteLine(sundayAnime.Title);
            }

            // Will throw Exception -> schedule.Monday is null!
            foreach (var mondayAnime in schedule.Monday)
            {
                Console.WriteLine(mondayAnime.Title);
            }

            // Send request for anime ranking (highest rating).
            AnimeTop topAnimeList = jikan.GetAnimeTop().Result;

            // Print title of each anime in the top 50
            foreach (var listEntry in topAnimeList.Top)
            {
                Console.WriteLine(listEntry.Title);
            }

            // Send request for second page (positions 51-100) of anime with highest ratings.
            topAnimeList = jikan.GetAnimeTop(2).Result;

            // Send request for anime with highest ratings currently airing.
            topAnimeList = jikan.GetAnimeTop(TopAnimeExtension.TopAiring).Result;

            // Send request for second page of most popular anime.
            topAnimeList = jikan.GetAnimeTop(2, TopAnimeExtension.TopPopularity).Result;


            // Send request for manga ranking (highest rating).
            MangaTop topMangaList = jikan.GetMangaTop().Result;

            // Print title of each manga in the top 50
            foreach (var listEntry in topMangaList.Top)
            {
                Console.WriteLine(listEntry.Title);
            }

            // Send request for second page (positions 51-100) of manga with highest ratings.
            topMangaList = jikan.GetMangaTop(2).Result;

            // Send request for light novels with highest ratings.
            topMangaList = jikan.GetMangaTop(TopMangaExtension.TopNovel).Result;

            // Send request for second page of most popular manga.
            topMangaList = jikan.GetMangaTop(2, TopMangaExtension.TopPopularity).Result;

            // Send request for most popular people on MAL
            PeopleTop topPeopleList = jikan.GetPeopleTop().Result;

            // Print rank and name of each person in top 50.
            foreach (var listEntry in topPeopleList.Top)
            {
                Console.WriteLine(listEntry.Rank + ". " + listEntry.Name);
            }

            // Send request for second page (positions 51 - 100) of most popular people
            topPeopleList = jikan.GetPeopleTop(2).Result;

            // Send request for most popular characters on MAL
            CharactersTop topCharacterList = jikan.GetCharactersTop().Result;

            // Print rank and name of each character in top 50.
            foreach (var listEntry in topCharacterList.Top)
            {
                Console.WriteLine(listEntry.Rank + ". " + listEntry.Name);
            }

            // Send request for second page (positions 51 - 100) of most popular characters.
            topCharacterList = jikan.GetCharactersTop(2).Result;

            // Send request for mecha genre (and first 100 mecha anime snippets)
            AnimeGenre animeGenre = jikan.GetAnimeGenre(18).Result;

            // Output -> "Mecha"
            Console.WriteLine(animeGenre.Metadata.Name);

            // Print title of each of the first 100 mecha anime
            foreach (var anime in animeGenre.Anime)
            {
                Console.WriteLine(anime.Title);
            }

            // Send request for mecha genre (mecha anime snippets on positions 101-200)
            animeGenre = jikan.GetAnimeGenre(18, 2).Result;

            // Send request for samurai anime genre (and first 100 samurai anime snippets)
            animeGenre = jikan.GetAnimeGenre(GenreSearch.Samurai).Result;

            // Send request for sports genre (sports anime snippets on positions 201-300)
            animeGenre = jikan.GetAnimeGenre(GenreSearch.Sports, 3).Result;

            // Send request for mecha genre (and first 100 mecha manga snippets)
            MangaGenre mangaGenre = jikan.GetMangaGenre(18).Result;

            // Output -> "Mecha"
            Console.WriteLine(mangaGenre.Metadata.Name);

            // Print title of each of the first 100 mecha manga
            foreach (var anime in mangaGenre.Manga)
            {
                Console.WriteLine(anime.Title);
            }

            // Send request for mecha genre (mecha manga snippets on positions 101-200)
            mangaGenre = jikan.GetMangaGenre(18, 2).Result;

            // Send request for samurai manga genre (and first 100 samurai manga snippets)
            mangaGenre = jikan.GetMangaGenre(GenreSearch.Samurai).Result;

            // Send request for sports genre (sports manga snippets on positions 201-300)
            mangaGenre = jikan.GetMangaGenre(GenreSearch.Sports, 3).Result;

            // Send request for KyotoAnimation
            Producer producer = jikan.GetProducer(2).Result;

            // Output -> "Kyoto Animation"
            Console.WriteLine(producer.Metadata.Name);

            // Print title of each anime of the first 100 anime made by Kyoto Animation
            foreach (var anime in producer.Anime)
            {
                Console.WriteLine(anime.Title);
            }

            // Send request for "Studio Pierrot" (and their anime listed on positions 101-200)
            producer = jikan.GetProducer(1, 2).Result;

            // Send request for "Young Animal" magazine.
            Magazine magazine = jikan.GetMagazine(2).Result;

            // Output -> "Young Animal"
            Console.WriteLine(magazine.Metadata.Name);

            // Print title of each manga of the first 100 mangas of "Young Animal"
            foreach (var manga in magazine.Manga)
            {
                Console.WriteLine(manga.Title);
            }

            // Send request for "Shonen Jump" (and their manga listed on positions 101-200)
            magazine = jikan.GetMagazine(83, 2).Result;

            UserProfile profile = jikan.GetUserProfile("Ervelan").Result;

            // Output -> "Male"
            Console.WriteLine(profile.Gender);

            // Print name of each favorite character
            foreach (var favoriteCharacter in profile.Favorites.Characters)
            {
                Console.WriteLine(favoriteCharacter.Name);
            }

            // Print information about completed and watching/reading anime/manga.
            Console.WriteLine("Completed " + profile.AnimeStatistics.Completed + " anime and " + profile.MangaStatistics.Completed + " manga.");
            Console.WriteLine("Currently watching " + profile.AnimeStatistics.Watching + " anime and reading " + profile.MangaStatistics.Reading + " manga.");

            // Send request for history of user "Ervelan"
            UserHistory userHistory = jikan.GetUserHistory("Ervelan").Result;

            // Print title of each anime/manga and related incerement.
            foreach (var historyEntry in userHistory.History)
            {
                Console.WriteLine(historyEntry.Metadata.Name + ": " + historyEntry.Increment);
            }

            // Send request for friend list of user "Ervelan"
            UserFriends friends = jikan.GetUserFriends("Ervelan").Result;

            // Print each friend username with their last online activity date.
            foreach (var friend in friends.Friends)
            {
                Console.WriteLine(friend.Username + " last seen online " + friend.LastOnline);
            }

            // Send request for friend list of user "batsling1234" on positions 101-200 (sorted by most recent online activity).
            friends = jikan.GetUserFriends("batsling1234", 2).Result;

            // Send request for anime list of user with "Ervelan" username (first 300 entries)
            UserAnimeList animeList = jikan.GetUserAnimeList("Ervelan").Result;

            // Print first 300 anime on requested list wiht scores assigned by user.
            foreach (var anime in animeList.Anime)
            {
                Console.WriteLine("Title: " + anime.Title + ", " + anime.Score);
            }

            // Send request for anime list of user with "Ervelan" username (entries from position 301 to 600).
            animeList = jikan.GetUserAnimeList("Ervelan", 2).Result;

            // Send request for anime list of user with "Ervelan" username (dropped anime only).
            animeList = jikan.GetUserAnimeList("Ervelan", UserAnimeListExtension.Dropped).Result;


            // Send request for anime list of user with "Ervelan" username (completed anime only, from position 301 to 600).
            animeList = jikan.GetUserAnimeList("Ervelan", UserAnimeListExtension.Completed, 2).Result;

            // Send request for manga list of user with "SonMati" username (first 300 entries)
            UserMangaList mangalist = jikan.GetUserMangaList("SonMati").Result;

            // Print first 300 manga on requested list wiht scores assigned by user.
            foreach (var manga in mangalist.Manga)
            {
                Console.WriteLine("Title: " + manga.Title + ", " + manga.Score);
            }

            // Send request for manga list of user with "SonMati" username (entries from position 301 to 600).
            mangalist = jikan.GetUserMangaList("SonMati", 2).Result;

            // Send request for manga list of user with "SonMati" username (reading manga only).
            mangalist = jikan.GetUserMangaList("SonMati", UserMangaListExtension.Reading).Result;

            // Send request for manga list of user with "SonMati" username (completed manga only, from position 301 to 600).
            mangalist = jikan.GetUserMangaList("SonMati", UserMangaListExtension.Completed, 2).Result;

            // Send request to search anime with "haibane" key word
            AnimeSearchResult animeSearchResult = jikan.SearchAnime("haibane").Result;

            // Print title of the first result
            // Output -> "Haibane Renmei"
            Console.WriteLine(animeSearchResult.Results.First().Title);

            // Send request to search anime with "gundam" key word, second page of results
            animeSearchResult = jikan.SearchAnime("gundam", 2).Result;

            AnimeSearchConfig animeSearchConfig = new AnimeSearchConfig()
            {
                Type  = AnimeType.Movie,
                Score = 7
            };

            // Send request to search anime with "gundam" key word, movies with score bigger than 7 only.
            animeSearchResult = jikan.SearchAnime("gundam", animeSearchConfig).Result;

            animeSearchConfig = new AnimeSearchConfig()
            {
                Genres        = { GenreSearch.Action, GenreSearch.Adventure },
                GenreIncluded = true
            };

            // Send request to search anime with "samurai" key word, with action and/or adventure genre.
            animeSearchResult = jikan.SearchAnime("samurai", animeSearchConfig).Result;

            animeSearchConfig = new AnimeSearchConfig()
            {
                Genres        = { GenreSearch.Mecha, GenreSearch.Romance },
                GenreIncluded = false
            };

            // Send request to search anime with "samurai" key word, without mecha and/or romance genre.
            animeSearchResult = jikan.SearchAnime("samurai", animeSearchConfig).Result;

            animeSearchConfig = new AnimeSearchConfig()
            {
                Rating = AgeRating.RX
            };

            // Send request to search anime with "xxx" key word, adult anime only, second page of results
            animeSearchResult = jikan.SearchAnime("xxx", 2, animeSearchConfig).Result;

            // Send request to search manga with "berserk" key word
            MangaSearchResult mangaSearchResult = jikan.SearchManga("berserk").Result;

            // Print title of the first result
            // Output -> "Berserk"
            Console.WriteLine(mangaSearchResult.Results.First().Title);

            // Send request to search manga with "gundam" key word, second page of results
            mangaSearchResult = jikan.SearchManga("gundam", 2).Result;

            MangaSearchConfig mangaSearchConfig = new MangaSearchConfig()
            {
                Type  = MangaType.Novel,
                Score = 5
            };

            // Send request to search manga with "gundam" key word, novel/light novel with score bigger than 5 only.
            mangaSearchResult = jikan.SearchManga("gundam", mangaSearchConfig).Result;

            mangaSearchConfig = new MangaSearchConfig()
            {
                Genres        = { GenreSearch.Mecha, GenreSearch.Adventure },
                GenreIncluded = true
            };

            // Send request to search manga with "samurai" key word, with Mecha and/or adventure genre.
            mangaSearchResult = jikan.SearchManga("samurai", mangaSearchConfig).Result;

            mangaSearchConfig = new MangaSearchConfig()
            {
                Genres        = { GenreSearch.Ecchi, GenreSearch.Game },
                GenreIncluded = false
            };

            // Send request to search manga with "samurai" key word, without ecchi and/or game genre.
            mangaSearchResult = jikan.SearchManga("samurai", mangaSearchConfig).Result;

            mangaSearchConfig = new MangaSearchConfig()
            {
                Rating = AgeRating.RX
            };

            // Send request to search manga with "xxx" key word, adult anime only, second page of results
            mangaSearchResult = jikan.SearchManga("xxx", 2, mangaSearchConfig).Result;

            // Send request to search person with "sawashiro" key word
            PersonSearchResult personSearchResult = jikan.SearchPerson("sawashiro").Result;

            // Print name of the first result
            // Output -> "Miyuki Sawashiro"
            Console.WriteLine(personSearchResult.Results.First().Name);

            // Send request to search person with "sawashiro" key word, second page (positions 51-100)
            personSearchResult = jikan.SearchPerson("sawashiro", 2).Result;

            // Send request to search character with "spiegel" key word
            CharacterSearchResult characterSearchResult = jikan.SearchCharacter("spiegel").Result;

            // Print name of the first result
            // Output -> "Spike Spiegel"
            Console.WriteLine(characterSearchResult.Results.First().Name);

            // Send request to search character with "edward" key word, second page (positions 51-100)
            characterSearchResult = jikan.SearchCharacter("edward", 2).Result;

            // Send request for Jikan status metadata.
            StatusMetadata statusMetadata = jikan.GetStatusMetadata().Result;

            // Print amount of today's and weekly requests.
            Console.WriteLine("Today requests:" + statusMetadata.RequestsToday + ", weekly: " + statusMetadata.RequestsThisWeek);
        }
示例#22
0
 private string GetBriefConstant() =>
 MoreInfo?.OrderBy(p => p.ChartRatingClass).Select(p => p.ChartConstant).ToStringJoin('/').TrimEnd('/');
示例#23
0
        public Stream GetDatasheetStream()
        {
            MoreInfo moreInfo = RequestMoreInfo();

            return(GetDatasheetStream(moreInfo.PdfSite));
        }
示例#24
0
        public async Task GetAnimeMoreInfo_BebopId_ShouldParseCowboyBebopMoreInfo()
        {
            MoreInfo bebop = await _jikan.GetAnimeMoreInfo(1);

            Assert.Contains("Suggested Order of Viewing", bebop.Info);
        }
        public async Task GetMangaMoreInfo_BerserkId_ShouldParseBerserkMoreInfo()
        {
            MoreInfo berserk = await jikan.GetMangaMoreInfo(2);

            Assert.Contains("The Prototype (1988)", berserk.Info);
        }
        public override JObject ToJObject(TCAPIVersion version)
        {
            var result = new JObject();

            if (Type != null)
            {
                result.Add("type", Type.ToString());
            }
            if (MoreInfo != null)
            {
                result.Add("moreInfo", MoreInfo.ToString());
            }
            if (Name != null && !Name.IsEmpty())
            {
                result.Add("name", Name.ToJObject(version));
            }
            if (Description != null && !Description.IsEmpty())
            {
                result.Add("description", Description.ToJObject(version));
            }
            if (Extensions != null && !Extensions.IsEmpty())
            {
                result.Add("extensions", Extensions.ToJObject(version));
            }
            if (InteractionType != null)
            {
                result.Add("interactionType", InteractionType.Value);
            }
            if (CorrectResponsesPattern != null && CorrectResponsesPattern.Count > 0)
            {
                result.Add("correctResponsesPattern", JToken.FromObject(CorrectResponsesPattern));
            }
            if (Choices != null && Choices.Count > 0)
            {
                var jchoices = new JArray();
                result.Add("choices", jchoices);

                foreach (var ichoice in Choices)
                {
                    jchoices.Add(ichoice.ToJObject(version));
                }
            }
            if (Scale != null && Scale.Count > 0)
            {
                var jscale = new JArray();
                result.Add("scale", jscale);

                foreach (var iscale in Scale)
                {
                    jscale.Add(iscale.ToJObject(version));
                }
            }
            if (Source != null && Source.Count > 0)
            {
                var jsource = new JArray();
                result.Add("source", jsource);

                foreach (var isource in Source)
                {
                    jsource.Add(isource.ToJObject(version));
                }
            }
            if (Target != null && Target.Count > 0)
            {
                var jtarget = new JArray();
                result.Add("target", jtarget);

                foreach (var itarget in Target)
                {
                    jtarget.Add(itarget.ToJObject(version));
                }
            }
            if (Steps != null && Steps.Count > 0)
            {
                var jsteps = new JArray();
                result.Add("steps", jsteps);

                foreach (var istep in Steps)
                {
                    jsteps.Add(istep.ToJObject(version));
                }
            }

            return(result);
        }
        public MoreInfo RequestMoreInfo()
        {
            HttpWebRequest request = Requests.CreateDefaultRequest(m_datasheetSiteLink);
            string result = Requests.ReadResponseString(request);

            HtmlDocument document = new HtmlDocument();
            document.LoadHtml(result);

            HtmlNode rootElement = document.DocumentNode;

            IEnumerable<HtmlNode> matchingNodes = from node in rootElement.Descendants("td")
                                                  where IsAttributeValueLike(node, "width", "283") && IsAttributeValueLike(node, "height", "367") &&
                                                        IsAttributeValueLike(node, "align", "center") && IsAttributeValueLike(node, "valign", "top")
                                                  select node;

            HtmlNode aNode = matchingNodes.ElementAt(0).Element("a");

            MoreInfo moreInfo = new MoreInfo();

            moreInfo.PdfSite = GetAttributeValueOrEmpty(aNode, "href");

            matchingNodes = from node in rootElement.Descendants("td")
                            where IsAttributeValueLike(node, "height", "40") && IsAttributeValueLike(node, "class", "gray_title") &&
                                  IsAttributeValueLike(node, "width", "100")
                            select node;

            HtmlNode sizeNode = matchingNodes.ElementAt(2).ParentNode;
            moreInfo.Size = sizeNode.Elements("td").ElementAt(1).Element("font").InnerText;

            HtmlNode pagesNode = matchingNodes.ElementAt(3).ParentNode;
            moreInfo.Pages = pagesNode.Elements("td").ElementAt(1).Element("font").InnerText;

            HtmlNode manufacturerSiteNode = matchingNodes.ElementAt(5).ParentNode;
            moreInfo.ManufacturerSite = manufacturerSiteNode.Elements("td").ElementAt(1).InnerText;

            return moreInfo;
        }
示例#28
0
        public void ShouldParseCowboyBebopMoreInfo()
        {
            MoreInfo bebop = Task.Run(() => jikan.GetAnimeMoreInfo(1)).Result;

            Assert.Contains("Suggested Order of Viewing", bebop.Info);
        }
示例#29
0
        public void ShouldParseBerserkMoreInfo()
        {
            MoreInfo berserk = Task.Run(() => jikan.GetMangaMoreInfo(2)).Result;

            Assert.Contains("The Prototype (1988)", berserk.Info);
        }
示例#30
0
 private string GetBriefChartDesigner() =>
 MoreInfo?.Select(p => p.ChartDesigner).Distinct().ToStringJoin('/').TrimEnd('/');
示例#31
0
文件: AppLog.cs 项目: HuGuo/TSS
 /// <summary>
 /// 保存日志
 /// </summary>
 /// <param name="message">日志信息</param>
 /// <param name="messageType">日志类型</param>
 /// <param name="ex">异常</param>
 /// <param name="type">日志类型</param>
 private static void DoLog(string message , LogMessageType messageType,string parameters , Exception ex ,Type type)
 {
     HttpContext context = HttpContext.Current;
     MoreInfo obj = new MoreInfo {
         Message=message,
         Ip=context.Request.UserHostAddress,
         OperatorId = context.User == null ? "" : context.User.Identity.Name ,
         Browser=context.Request.UserAgent,
         Params=parameters
     };
     ILog log=LogManager.GetLogger(type);
     switch (messageType) {
         case LogMessageType.Debug:
             log.Debug(obj , ex);
             break;
         case LogMessageType.Info:
             log.Info(obj , ex);
             break;
         case LogMessageType.Warn:
             log.Warn(obj , ex);
             break;
         case LogMessageType.Error:
             log.Error(obj , ex);
             break;
         case LogMessageType.Fatal:
             log.Fatal(obj , ex);
             break;
     }
 }