public MainForm() { SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db"); InitializeComponent(); db.ExecuteNonQuery("create table if not exists settings(variable text, value text)"); db.ExecuteNonQuery("create table if not exists items(position text, name text)"); db.ExecuteNonQuery("create table if not exists button_labels(button_name text, " + "button_label text, use_job text)"); db.ExecuteNonQuery("create table if not exists buttons(button_name text, " + "position text, value text)"); }
private void LoadDataFromWeb() { SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db"); List <string> urls = new List <string>(); urls.Add("/weapon/archer"); urls.Add("/weapon/conjurer"); urls.Add("/weapon/gladiator"); urls.Add("/weapon/marauder"); urls.Add("/weapon/lancer"); urls.Add("/weapon/pugilist"); urls.Add("/weapon/thaumaturge"); urls.Add("/tool/alchemist"); urls.Add("/tool/armorer"); urls.Add("/tool/blacksmith"); urls.Add("/tool/botanist"); urls.Add("/tool/carpenter"); urls.Add("/tool/culinarian"); urls.Add("/tool/fisher"); urls.Add("/tool/goldsmith"); urls.Add("/tool/leatherworker"); urls.Add("/tool/miner"); urls.Add("/tool/weaver"); urls.Add("/armor/head"); urls.Add("/armor/body"); urls.Add("/armor/hands"); urls.Add("/armor/waist"); urls.Add("/armor/legs"); urls.Add("/armor/feet"); urls.Add("/armor/shield"); urls.Add("/armor/earring"); urls.Add("/armor/bracelet"); urls.Add("/armor/necklace"); urls.Add("/armor/ring"); db.Delete("items", null); String position = ""; foreach (string url in urls) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://mooglebox.com" + url + ".php"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream resStream = response.GetResponseStream(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(resStream); foreach (HtmlAgilityPack.HtmlNode item in doc.DocumentNode.SelectNodes("//a[@class='imPop']")) { if (url.StartsWith("/weapon") || url.StartsWith("/tool")) { if (item.InnerHtml.Trim().EndsWith("File") || item.InnerHtml.Trim().EndsWith("Mortar") || item.InnerHtml.Trim().EndsWith("Pliers") || item.InnerHtml.Trim().EndsWith("Scythe") || item.InnerHtml.Trim().EndsWith("Claw Hammer") || item.InnerHtml.Trim().EndsWith("Culinary Knife") || item.InnerHtml.Trim().EndsWith("Gig") || item.InnerHtml.Trim().EndsWith("Grinding Wheel") || item.InnerHtml.Trim().EndsWith("Awl") || item.InnerHtml.Trim().EndsWith("Sledgehammer") || item.InnerHtml.Trim().EndsWith("Spinning Wheel")) { position = "oh"; } else if (item.InnerHtml.Trim().EndsWith("Francisca") || item.InnerHtml.Trim().EndsWith("Throwing Dagger") || item.InnerHtml.Trim().EndsWith("Javalin") || item.InnerHtml.Trim().EndsWith("Azagai") || item.InnerHtml.Trim().EndsWith("Chakram")) { position = "throwing"; } else if (item.InnerHtml.Trim().EndsWith("Arrow")) { position = "pack"; } else { position = "mh"; } } else if (url.EndsWith("shield")) { position = "oh"; } else if (url.EndsWith("earring")) { position = "ears"; } else if (url.EndsWith("bracelet")) { position = "wrists"; } else if (url.EndsWith("necklace")) { position = "neck"; } else { position = url.Substring(url.LastIndexOf("/") + 1); } db.ExecuteNonQuery(String.Format("insert into items values(\"{0}\", \"{1}\")", position, item.InnerHtml.Trim())); } } }
private void LoadDataFromWeb() { SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db"); List<string> urls = new List<string>(); urls.Add("/weapon/archer"); urls.Add("/weapon/conjurer"); urls.Add("/weapon/gladiator"); urls.Add("/weapon/marauder"); urls.Add("/weapon/lancer"); urls.Add("/weapon/pugilist"); urls.Add("/weapon/thaumaturge"); urls.Add("/tool/alchemist"); urls.Add("/tool/armorer"); urls.Add("/tool/blacksmith"); urls.Add("/tool/botanist"); urls.Add("/tool/carpenter"); urls.Add("/tool/culinarian"); urls.Add("/tool/fisher"); urls.Add("/tool/goldsmith"); urls.Add("/tool/leatherworker"); urls.Add("/tool/miner"); urls.Add("/tool/weaver"); urls.Add("/armor/head"); urls.Add("/armor/body"); urls.Add("/armor/hands"); urls.Add("/armor/waist"); urls.Add("/armor/legs"); urls.Add("/armor/feet"); urls.Add("/armor/shield"); urls.Add("/armor/earring"); urls.Add("/armor/bracelet"); urls.Add("/armor/necklace"); urls.Add("/armor/ring"); db.Delete("items", null); String position = ""; foreach (string url in urls) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://mooglebox.com" + url + ".php"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream resStream = response.GetResponseStream(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(resStream); foreach (HtmlAgilityPack.HtmlNode item in doc.DocumentNode.SelectNodes("//a[@class='imPop']")) { if (url.StartsWith("/weapon") || url.StartsWith("/tool")) { if (item.InnerHtml.Trim().EndsWith("File") || item.InnerHtml.Trim().EndsWith("Mortar") || item.InnerHtml.Trim().EndsWith("Pliers") || item.InnerHtml.Trim().EndsWith("Scythe") || item.InnerHtml.Trim().EndsWith("Claw Hammer") || item.InnerHtml.Trim().EndsWith("Culinary Knife") || item.InnerHtml.Trim().EndsWith("Gig") || item.InnerHtml.Trim().EndsWith("Grinding Wheel") || item.InnerHtml.Trim().EndsWith("Awl") || item.InnerHtml.Trim().EndsWith("Sledgehammer") || item.InnerHtml.Trim().EndsWith("Spinning Wheel")) { position = "oh"; } else if (item.InnerHtml.Trim().EndsWith("Francisca") || item.InnerHtml.Trim().EndsWith("Throwing Dagger") || item.InnerHtml.Trim().EndsWith("Javalin") || item.InnerHtml.Trim().EndsWith("Azagai") || item.InnerHtml.Trim().EndsWith("Chakram")) { position = "throwing"; } else if (item.InnerHtml.Trim().EndsWith("Arrow")) { position = "pack"; } else { position = "mh"; } } else if (url.EndsWith("shield")) position = "oh"; else if (url.EndsWith("earring")) position = "ears"; else if (url.EndsWith("bracelet")) position = "wrists"; else if (url.EndsWith("necklace")) position = "neck"; else position = url.Substring(url.LastIndexOf("/") + 1); db.ExecuteNonQuery(String.Format("insert into items values(\"{0}\", \"{1}\")", position, item.InnerHtml.Trim())); } } }