Advertisement
jaeseph23

Uwow Launcher

Aug 21st, 2011
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Diagnostics;
  10. using System.IO;
  11.  
  12. namespace Create_Your_Own_Launcher
  13. {
  14. public partial class Form1 : Form
  15. {
  16. string location;
  17. string realm;
  18.  
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. }
  23.  
  24. private void b_web_Click(object sender, EventArgs e)
  25. {
  26. Process openWeb = Process.Start("http://unforgivenwow.com");
  27.  
  28.  
  29. private void Form1_Load(object sender, EventArgs e)
  30. {
  31. realm = "set realmlist logon.unforgivenwow.com";
  32. this.Text = "UnforgivenWoW's Launcher";
  33. toolTip1.SetToolTip(b_web, "Click to visit http://unforgivenwow.com");
  34. toolTip1.SetToolTip(c_realm, "Check, if you want to set your realmlist to \"" + realm + "\".");
  35. locateWow(false);
  36. }
  37.  
  38. public void locateWow(bool recreate)
  39. {
  40. if (recreate == true)
  41. {
  42. try
  43. {
  44. File.Delete("data");
  45. }
  46. catch
  47. { }
  48. }
  49. if (!File.Exists("data"))
  50. {
  51. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  52. {
  53. try
  54. {
  55. StreamWriter write = new StreamWriter("data", true);
  56. write.Write(folderBrowserDialog1.SelectedPath);
  57. write.Close();
  58. location = folderBrowserDialog1.SelectedPath.ToString();
  59. }
  60. catch
  61. {
  62. }
  63.  
  64.  
  65. }
  66. else
  67. {
  68. DialogResult dr = MessageBox.Show("For full launcher functionability, you have to set your wow directory. Hit 'Retry' to repeat your selection, hiting 'Cancel' will close the launcher.", "Repeat directory selection?", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
  69. if (dr == DialogResult.Retry)
  70. {
  71. locateWow(false);
  72. }
  73. else
  74. {
  75. this.Close();
  76. }
  77. }
  78.  
  79. }
  80. else
  81. {
  82. try
  83. {
  84. StreamReader reader = new StreamReader("data");
  85. location = reader.ReadToEnd();
  86. reader.Close();
  87.  
  88. }
  89. catch
  90. { }
  91. }
  92.  
  93. }
  94.  
  95. private void b_locate_Click(object sender, EventArgs e)
  96. {
  97. locateWow(true);
  98. }
  99.  
  100. private void b_launch_Click(object sender, EventArgs e)
  101. {
  102. if (c_realm.Checked == true)
  103. {
  104. try
  105. {
  106. string path = location;
  107.  
  108.  
  109. if (Directory.Exists(location + "\\Data\\enUS"))
  110. {
  111. path = location + "\\Data\\enUS";
  112. }
  113. else if (Directory.Exists(location + "\\Data\\enGB"))
  114. {
  115. path = location + "\\Data\\enGB";
  116. }
  117.  
  118.  
  119. if (File.Exists(path + "\\realmlist.wtf"))
  120. {
  121. File.Delete(path + "\\realmlist.wtf");
  122. }
  123. StreamWriter writer = new StreamWriter(path + "\\realmlist.wtf", true);
  124. writer.Write(realm);
  125. writer.Close();
  126.  
  127. }
  128. catch
  129. {
  130. MessageBox.Show("An error occoured while working with realmlist.wtf. This file wasnt probably edited.", "An error occoured while working with realmlist.wtf:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  131. }
  132. }
  133. if (c_cache.Checked == true)
  134. {
  135. try
  136. {
  137. if (Directory.Exists(location + "\\cache"))
  138. {
  139. Directory.Delete(location + "\\cache", true);
  140. }
  141. Directory.CreateDirectory(location + "\\cache");
  142. }
  143. catch
  144. {
  145. MessageBox.Show("An error occoured while working with cache folder. This folder probably wasnt deleted.", "An error occoured while working with cache folder:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  146. }
  147. }
  148.  
  149. try
  150. {
  151. Process.Start(location + "\\Wow.exe");
  152. }
  153. catch
  154. {
  155. MessageBox.Show("Launching Wow.exe failed. Are you sure you have choosen right directory?", "Launching Wow.exe failed:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  156. }
  157. }
  158.  
  159. private void c_cache_CheckedChanged(object sender, EventArgs e)
  160. {
  161.  
  162. }
  163.  
  164. private void button2_Click(object sender, EventArgs e)
  165. {
  166. process1.Start();
  167. MessageBox.Show("Before trying to join Ventrilo, you must set your server information up. Host:unforgivenwow.instantvent.com,Port:3444! Remeber to set this before you try to log into Vent!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  168. }
  169.  
  170. private void b_for_Click(object sender, EventArgs e)
  171. {
  172. Process openWeb = Process.Start("http://forum.unforgivenwow.com");
  173.  
  174. }
  175. private void c_realm_CheckedChanged(object sender, EventArgs e)
  176. {
  177.  
  178. }
  179.  
  180. private void button1_Click(object sender, EventArgs e)
  181. {
  182. Process openWeb = Process.Start("http://torrents.thepiratebay.org/6163279/World_of_Warcraft__Wrath_of_the_Lich_King_3.3.5a_(12340).6163279.TPB.torrent");
  183. }
  184. }
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement