public static async Task <List <Book> > GetMekFeedAsync() { var feed = await GetFeedAsync("http://mek.oszk.hu/mek2.rss"); var list = new List <Book>(); list = feed?. Where(f => !Regex.IsMatch(f.Title.Text.ToString(), "Hangoskönyv")). Select(f => new Book() { Title = f.Title.Text, Recommendation = TextManipulation.StripHTML(f.Summary.Text).Replace(("^" + f.Title.Text), ""), //TODO: create proper filter ThumbnailUrl = new Uri(TextManipulation.GetImageUrl(f.Summary.Text)), Url = f.Links[0].Uri.ToString(), UrlId = ItemResolver.Resolve(f.Links[0].Uri.ToString()).UrlId }).ToList(); return(list); }
void Start() { Instance = this; }
public SingletonItemResolver(ItemResolver original_resolver) { this.original_resolver = original_resolver; }
private void OnDisable() { Instance = null; }
private void OnEnable() { Instance = this; }
public GameState Wait(ItemResolver <Character> c, GameState state) { return(state); }
public TargettedSkill Act(GameState state, ItemResolver <Character> c) { CharactersActed.Add(c.Item); return(SkillToReturn); }
public ImmutableArray <Character> GetOpponents(ItemResolver <Character> c) { return(Enemies.Contains(c.Item) ? Party : Enemies); }
public ImmutableArray <Character> GetTeammates(ItemResolver <Character> c) { return(Enemies.Contains(c.Item) ? Enemies : Party); }
public static async Task <List <Book> > SearchBookAsync(string searchKeyword = "", string searchTitle = "", string searchCreator = "") { // DKA: http://mek.oszk.hu/kozoskereso/mobil/mek_epa_dka_kereso/build/ // "http://mek.oszk.hu/kozoskereso/mobil/index.php?alkoto=&cim=&temakor=horthy"; var searchEndpoint = "http://mek.oszk.hu/kozoskereso/mobil/index.php?alkoto={0}&cim={1}&temakor={2}"; var uri = String.Format(searchEndpoint, searchCreator, searchTitle, searchKeyword); HttpClient client = new HttpClient(); var json = ""; try { json = await client.GetStringAsync(uri); } catch { } client.Dispose(); var results = new List <Book>(); json = TextManipulation.StripJson(json); JsonArray root = JsonValue.Parse(json).GetArray(); for (uint i = 0; i < root.Count; i++) { try { string id = root.GetObjectAt(i).GetNamedString("id"); string collection = root.GetObjectAt(i).GetNamedString("collection"); if (id == "0" || collection.ToLower() != "mek") { continue; } string url = root.GetObjectAt(i).GetNamedString("URL"); string title = root.GetObjectAt(i).GetNamedString("title"); string subtitle = root.GetObjectAt(i).GetNamedString("subtitle"); string creators = root.GetObjectAt(i).GetNamedString("creators"); string thumbnailUrl = root.GetObjectAt(i).GetNamedString("thumbnailURL"); //TODO: solve paging var book = new Book() { UrlId = ItemResolver.Resolve(url).UrlId, Url = url, Title = title, SubTitle = subtitle, Creators = creators, ThumbnailUrl = new Uri(thumbnailUrl) }; results.Add(book); } catch (Exception ex) { //Swallow to survive populating results } } ; return(results); }