protected void spider_theverge_com_Click(object sender, EventArgs e) { try { Spiders spider = new Spiders(); Global_collection collection_news = new Global_collection(); collection_news.add(spider.theverge_com()); var list = collection_news.get(); text = ""; foreach (var element in list) { //Debug.WriteLine("element.type); text += "id = " + element.id.ToString() + "\n"; text += "type = " + element.type + "\n"; text += "sourse = " + element.source + "\n"; text += "title = " + element.title + "\n"; text += "content = " + element.content + "\n"; text += "image = " + element.image + "\n"; text += "\n"; Debug.WriteLine(text); } Output_new.Text = text; update(); Label.Text = "Робота бота завершена."; } catch (Exception ex) { Label.Text = "Вызвано исключение: " + ex.Message; } }
protected void theverge_com_inXml_Click(object sender, EventArgs e) { try { Spiders spider1 = new Spiders(); Global_collection collection_news = new Global_collection(); collection_news.add(spider1.theverge_com()); collection_news.toXml(); collection_news.toTxt(); Label.Text = "Работа бота прошла успешно! файл сахранен в директори output"; } catch (Exception ex) { Label.Text = "Вызвано исключение: " + ex.Message; } }
// GET: api/values public List <object_news> Get() { try { Spiders spider = new Spiders(); Global_collection collections = new Global_collection(); collections.add(spider.theverge_com()); return(collections.getList()); } catch { Global_collection collections = new Global_collection(); collections.readXml(); return(collections.getList()); } }
/// <summary> /// Consumes a Spiderling of the same owner to regain some eggs to spawn more Spiderlings. /// </summary> /// <param name="spiderling">The Spiderling to consume. It must be on the same Nest as this BroodMother.</param> /// <returns>True if the Spiderling was consumed. False otherwise.</returns> public bool Consume(Spiders.Spiderling spiderling) { return this.RunOnServer<bool>("consume", new Dictionary<string, object> { {"spiderling", spiderling} }); }
/// <summary> /// Starts moving the Spiderling across a Web to another Nest. /// </summary> /// <param name="web">The Web you want to move across to the other Nest.</param> /// <returns>True if the move was successful, false otherwise.</returns> public bool Move(Spiders.Web web) { return this.RunOnServer<bool>("move", new Dictionary<string, object> { {"web", web} }); }
/// <summary> /// Attacks another Spiderling /// </summary> /// <param name="spiderling">The Spiderling to attack.</param> /// <returns>True if the attack was successful, false otherwise.</returns> public bool Attack(Spiders.Spiderling spiderling) { return this.RunOnServer<bool>("attack", new Dictionary<string, object> { {"spiderling", spiderling} }); }
public Pile(BugTeam team, int beetleCount = 2, int grasshopperCount = 3, int ladyBugCount = 0, int mosquitoCount = 0, int pillBugCount = 0, int queenBeeCount = 1, int soldierAntCount = 3, int spiderCount = 2) { _team = team; while (beetleCount > 0 || grasshopperCount > 3 || ladyBugCount > 0 || mosquitoCount > 0 || pillBugCount > 0 || queenBeeCount > 0 || soldierAntCount > 0 || spiderCount > 0) { if (beetleCount > 0) { if (Beetles == null) { Beetles = new Stack <Beetle>(); _stackCount++; } Beetles.Push(new Beetle(_team)); beetleCount--; } if (grasshopperCount > 0) { if (Grasshoppers == null) { Grasshoppers = new Stack <Grasshopper>(); _stackCount++; } Grasshoppers.Push(new Grasshopper(_team)); grasshopperCount--; } if (ladyBugCount > 0) { if (LadyBugs == null) { LadyBugs = new Stack <LadyBug>(); _stackCount++; } LadyBugs.Push(new LadyBug(_team)); ladyBugCount--; } if (mosquitoCount > 0) { if (Mosquitos == null) { Mosquitos = new Stack <Mosquito>(); _stackCount++; } Mosquitos.Push(new Mosquito(_team)); mosquitoCount--; } if (pillBugCount > 0) { if (PillBugs == null) { PillBugs = new Stack <PillBug>(); _stackCount++; } PillBugs.Push(new PillBug(_team)); pillBugCount--; } if (queenBeeCount > 0) { if (QueenBees == null) { QueenBees = new Stack <QueenBee>(); _stackCount++; } QueenBees.Push(new QueenBee(_team)); queenBeeCount--; } if (soldierAntCount > 0) { if (SoldierAnts == null) { SoldierAnts = new Stack <SoldierAnt>(); _stackCount++; } SoldierAnts.Push(new SoldierAnt(_team)); soldierAntCount--; } if (spiderCount > 0) { if (Spiders == null) { Spiders = new Stack <Spider>(); _stackCount++; } Spiders.Push(new Spider(_team)); spiderCount--; } } }
/// <summary> /// Creates and spits a new Web from the Nest the Spitter is on to another Nest, connecting them. /// </summary> /// <param name="nest">The Nest you want to spit a Web to, thus connecting that Nest and the one the Spitter is on.</param> /// <returns>True if the spit was successful, false otherwise.</returns> public bool Spit(Spiders.Nest nest) { return this.RunOnServer<bool>("spit", new Dictionary<string, object> { {"nest", nest} }); }
/// <summary> /// Weaves more silk into an existing Web to strengthen it. /// </summary> /// <param name="web">The web you want to strengthen. Must be connected to the Nest this Weaver is currently on.</param> /// <returns>True if the strengthen was successfully started, false otherwise.</returns> public bool Strengthen(Spiders.Web web) { return this.RunOnServer<bool>("strengthen", new Dictionary<string, object> { {"web", web} }); }