From 8f5faa7fa90991a9c18260433eb0448c5a01c2f3 Mon Sep 17 00:00:00 2001 From: MallocNull Date: Sun, 19 Oct 2014 16:04:43 -0500 Subject: [PATCH] god damnit flash fix your website --- bot/bot/Chat.cs | 17 +++++++++++------ bot/bot/_G.cs | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bot/bot/Chat.cs b/bot/bot/Chat.cs index 5092698..bc2509e 100644 --- a/bot/bot/Chat.cs +++ b/bot/bot/Chat.cs @@ -17,12 +17,17 @@ namespace bot { static int currentMessage; public static void reloadContext(FirefoxDriver d) { - List chatdata = d.FindElement(By.Id("chatList")).FindElements(By.TagName("div")).ToList(); - messageDivSize = chatdata.Count; - foreach(IWebElement we in chatdata) { - if(Int32.Parse(we.GetAttribute("id").Substring(11)) > currentMessage) - currentMessage = Int32.Parse(we.GetAttribute("id").Substring(11)); - } + while(true) { + try { + List chatdata = d.FindElement(By.Id("chatList")).FindElements(By.TagName("div")).ToList(); + messageDivSize = chatdata.Count; + foreach(IWebElement we in chatdata) { + if(Int32.Parse(we.GetAttribute("id").Substring(11)) > currentMessage) + currentMessage = Int32.Parse(we.GetAttribute("id").Substring(11)); + } + break; + } catch(Exception shoehorn) {} + } if(d.FindElement(By.Id("audioButton")).GetAttribute("class").ToLower() == "button") d.FindElement(By.Id("audioButton")).Click(); } diff --git a/bot/bot/_G.cs b/bot/bot/_G.cs index 4dec0d3..4e74ba3 100644 --- a/bot/bot/_G.cs +++ b/bot/bot/_G.cs @@ -85,7 +85,7 @@ namespace bot { tmp = new MySqlConnection("SERVER=" + dbinfo[0] + ";DATABASE=" + dbinfo[3] + ";UID=" + dbinfo[1] + ";PASSWORD=" + dbinfo[2] + ";"); tmp.Open(); } catch(Exception e) { - criticalError("Could not open database connection!"); + criticalError("Could not open database connection! "+ e.Message); return null; } return tmp;