private void Form1_Load(object sender, EventArgs e) { MessageBox.Show("Thank you for Trying our Unofficial Demo, This was in no way a final project, and is only used as a demonstration, We hope you will Support our Development for the Future", "Demo ONLY", MessageBoxButtons.OK); // OPEN SETTINGS FORM IF WOW DIRECTORY IS NOT SETTED if (string.IsNullOrEmpty(Settings.Default.WowLocation) || !Directory.Exists(Settings.Default.WowLocation)) { if (!string.IsNullOrEmpty(WoW.Directory)) { Settings.Default.WowLocation = WoW.Directory; Settings.Default.Save(); } else { using (SettingsForm form = new SettingsForm()) form.ShowDialog(); } } //========================================= GET TITLE FROM DATABASE SECTION ================================================ MySqlConnection conn; int i = 0; int count = 6; //NUMBER OF NEWS DISPLAYED ON LAUNCHER string MyConString = "server=wownewage.com;uid=launcher;" + "pwd=FiYeSO;database=website;"; conn = new MySqlConnection(MyConString); conn.Open(); MySqlCommand getTitle = new MySqlCommand("SELECT headline FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] titleContent = new string[count]; MySqlDataReader title_row = getTitle.ExecuteReader(); while (title_row.Read()) { string title = title_row["headline"].ToString(); //MessageBox.Show(title.Substring(12, title.Length-2-12)); //ENABLE FOR DEBUG titleContent[i] = title.Substring(12, title.Length - 2 - 12); i++; } conn.Close(); //========================================= GET CONTENT FROM DATABASE SECTION ================================================ conn.Open(); i = 0; // RESET i value for re-use it MySqlCommand getContent = new MySqlCommand("SELECT content FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] contentContent = new string[count]; MySqlDataReader content_row = getContent.ExecuteReader(); while (content_row.Read()) { string content = content_row["content"].ToString(); //MessageBox.Show(content.Substring(12, content.Length-2-12)); //ENABLE FOR DEBUG contentContent[i] = content.Substring(3, content.Length - 7); i++; } conn.Close(); //========================================= GET IMG LINK FROM DATABASE SECTION ================================================ conn.Open(); i = 0; // RESET i value for re-use it MySqlCommand getImgLink = new MySqlCommand("SELECT imgLink FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] ImgLinkContent = new string[count]; MySqlDataReader ImgLink_row = getImgLink.ExecuteReader(); while (ImgLink_row.Read()) { string ImgLink = ImgLink_row["imgLink"].ToString(); //MessageBox.Show(content.Substring(12, content.Length-2-12)); //ENABLE FOR DEBUG ImgLinkContent[i] = ImgLink; i++; } conn.Close(); //SET TITLE AND CONTENT SECTION News_Item1_Title.Text = titleContent[0]; Item1_Description.Text = contentContent[0]; UpdateBox1.ImageLocation = ImgLinkContent[0]; News_Item2_Title.Text = titleContent[1]; Item2_Description.Text = contentContent[1]; UpdateBox2.ImageLocation = ImgLinkContent[1]; News_Item3_Title.Text = titleContent[2]; Item3_Description.Text = contentContent[2]; UpdateBox3.ImageLocation = ImgLinkContent[2]; News_Item4_Title.Text = titleContent[3]; Item4_Description.Text = contentContent[3]; UpdateBox4.ImageLocation = ImgLinkContent[3]; News_Item5_Title.Text = titleContent[4]; Item5_Description.Text = contentContent[4]; UpdateBox5.ImageLocation = ImgLinkContent[4]; News_Item6_Title.Text = titleContent[5]; Item6_Description.Text = contentContent[5]; UpdateBox6.ImageLocation = ImgLinkContent[5]; // END UPDATES SECTION ===================================== TransparencyKey = Color.Lime; downloadBar1.BarState = DownloadBar.DownloadBarState.Setup; try { string path = WoW.RealmListLocation; if (!string.IsNullOrEmpty(path) && File.Exists(path)) { using (StreamWriter writer = new StreamWriter(path)) { writer.WriteLine(Settings.Default.realmlist); writer.Flush(); writer.Close(); } } if (Settings.Default.patchDownloadURL != String.Empty) { startDownloadBackgroundWorker.RunWorkerAsync(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "NewAge Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MainForm_Load(object sender, EventArgs e) { //SERVER Connection ServerConnect(); // Transparency Toggle(SettingsForm.cs) if (Settings.Default.TransparencyToggle == false) { Opacity = 1.00; } if (Settings.Default.TransparencyToggle == true) { Opacity = .90; } // LOAD CUSTOM FONT loadFont(); //Alloc Font AllocFont(font, this.News_Item1_Title, 12, true); AllocFont(font, this.News_Item2_Title, 12, true); AllocFont(font, this.News_Item3_Title, 12, true); AllocFont(font, this.News_Item4_Title, 12, true); AllocFont(font, this.News_Item5_Title, 12, true); AllocFont(font, this.News_Item6_Title, 12, true); AllocFont(font, this.Item1_Description, 9, false); AllocFont(font, this.Item2_Description, 9, false); AllocFont(font, this.Item3_Description, 9, false); AllocFont(font, this.Item4_Description, 9, false); AllocFont(font, this.Item5_Description, 9, false); AllocFont(font, this.Item6_Description, 9, false); AllocFont(font, this.downloadProgressLabel, 14, false); //AllocFont(font, this.downloadSpeedLabel, 14, false); AllocFont(font, this.updatesLabel, 16, false); AllocFont(font, this.menuBar1, 14, false); //========================================= GET TITLE FROM DATABASE SECTION ================================================ MySqlConnection conn; int i = 0; int count = 6; //NUMBER OF NEWS DISPLAYED ON LAUNCHER string MyConString = "server=wownewage.com;uid=launcher;pwd=FiYeSO;database=website;"; conn = new MySqlConnection(MyConString); conn.Open(); MySqlCommand getTitle = new MySqlCommand("SELECT headline FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] titleContent = new string[count]; MySqlDataReader title_row = getTitle.ExecuteReader(); while (title_row.Read()) { string title = title_row["headline"].ToString(); //MessageBox.Show(title.Substring(12, title.Length-2-12)); //ENABLE FOR DEBUG titleContent[i] = title.Substring(12, title.Length - 2 - 12); i++; } conn.Close(); //========================================= GET CONTENT FROM DATABASE SECTION ================================================ conn.Open(); i = 0; // RESET i value for re-use it MySqlCommand getContent = new MySqlCommand("SELECT content FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] contentContent = new string[count]; MySqlDataReader content_row = getContent.ExecuteReader(); while (content_row.Read()) { string content = content_row["content"].ToString(); //MessageBox.Show(content.Substring(12, content.Length-2-12)); //ENABLE FOR DEBUG contentContent[i] = content.Substring(3, content.Length - 7).Replace("<p>", " ").Replace("</p>", "").Replace("nbsp", "\n"); i++; } conn.Close(); //========================================= GET IMG LINK FROM DATABASE SECTION ================================================ conn.Open(); i = 0; // RESET i value for re-use it MySqlCommand getImgLink = new MySqlCommand("SELECT imgLink FROM articles ORDER BY id DESC LIMIT 6;", conn); //MySqlCommand getRow = new MySqlCommand("SELECT COUNT(*) FROM articles", conn); //USELESS FOR NOW BUT CAN BE USED IN FUTURE //count = (int)getRow.ExecuteScalar(); //SAME AS BEFORE string[] ImgLinkContent = new string[count]; MySqlDataReader ImgLink_row = getImgLink.ExecuteReader(); while (ImgLink_row.Read()) { string ImgLink = ImgLink_row["imgLink"].ToString(); //MessageBox.Show(content.Substring(12, content.Length-2-12)); //ENABLE FOR DEBUG ImgLinkContent[i] = ImgLink; i++; } conn.Close(); //SET TITLE AND CONTENT SECTION News_Item1_Title.Text = titleContent[0]; Item1_Description.Text = contentContent[0]; if (string.IsNullOrEmpty(ImgLinkContent[0])) { UpdateBox1.Visible = false; } else { UpdateBox1.ImageLocation = ImgLinkContent[0]; } News_Item2_Title.Text = titleContent[1]; Item2_Description.Text = contentContent[1]; if (string.IsNullOrEmpty(ImgLinkContent[1])) { UpdateBox2.Visible = false; } else { UpdateBox2.ImageLocation = ImgLinkContent[1]; } News_Item3_Title.Text = titleContent[2]; Item3_Description.Text = contentContent[2]; if (string.IsNullOrEmpty(ImgLinkContent[2])) { UpdateBox3.Visible = false; } else { UpdateBox3.ImageLocation = ImgLinkContent[2]; } News_Item4_Title.Text = titleContent[3]; Item4_Description.Text = contentContent[3]; if (string.IsNullOrEmpty(ImgLinkContent[3])) { UpdateBox4.Visible = false; } else { UpdateBox4.ImageLocation = ImgLinkContent[3]; } News_Item5_Title.Text = titleContent[4]; Item5_Description.Text = contentContent[4]; if (string.IsNullOrEmpty(ImgLinkContent[4])) { UpdateBox5.Visible = false; } else { UpdateBox5.ImageLocation = ImgLinkContent[4]; } News_Item6_Title.Text = titleContent[5]; Item6_Description.Text = contentContent[5]; if (string.IsNullOrEmpty(ImgLinkContent[5])) { UpdateBox6.Visible = false; } else { UpdateBox6.ImageLocation = ImgLinkContent[5]; } // END UPDATES SECTION ===================================== if (string.IsNullOrEmpty(Settings.Default.WowLocation) || !Directory.Exists(Settings.Default.WowLocation)) { if (!string.IsNullOrEmpty(WoW.Directory)) { Settings.Default.WowLocation = WoW.Directory; Settings.Default.Save(); } else { using (SettingsForm form = new SettingsForm()) form.ShowDialog(); } } TransparencyKey = Color.Lime; downloadBar1.BarState = DownloadBar.DownloadBarState.Setup; checkServerStatusBackgroundWorker.RunWorkerAsync(); try { string path = WoW.RealmListLocation; if (!string.IsNullOrEmpty(path) && File.Exists(path)) { using (StreamWriter writer = new StreamWriter(path)) { writer.WriteLine(Settings.Default.realmlist); writer.Flush(); writer.Close(); } } if (Settings.Default.patchDownloadURL != String.Empty) { startDownloadBackgroundWorker.RunWorkerAsync(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "NewAge Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); } }