Guest User

Untitled

a guest
Jul 16th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.15 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 Microsoft.Win32;
  10. using System.Diagnostics;
  11. using System.IO;
  12. using System.Net;
  13.  
  14. namespace FarmingTimer
  15. {
  16. public partial class Form1 : Form
  17. {
  18. public int treeTime;
  19.  
  20. public Form1()
  21. {
  22. InitializeComponent();
  23. checkUpdates();
  24. initTimers();
  25. progressTimers();
  26. }
  27.  
  28. public void initTimers()
  29. {
  30. timer1.Interval = 1000;
  31. timer2.Interval = 1000;
  32. timer3.Interval = 1000;
  33. timer4.Interval = 1000;
  34. timer5.Interval = 1000;
  35. timer6.Interval = 1000;
  36. timer7.Interval = 1000;
  37. timer8.Interval = 1000;
  38. timer9.Interval = 1000;
  39. timer10.Interval = 1000;
  40. timer11.Interval = 1000;
  41. timer12.Interval = 1000;
  42. timer13.Interval = 1000;
  43. timer14.Interval = 1000;
  44. timer15.Interval = 1000;
  45.  
  46. timer1.Tick += new EventHandler(timer1_Tick);
  47. timer2.Tick += new EventHandler(timer2_Tick);
  48. timer3.Tick += new EventHandler(timer3_Tick);
  49. timer4.Tick += new EventHandler(timer4_Tick);
  50. timer5.Tick += new EventHandler(timer5_Tick);
  51. timer6.Tick += new EventHandler(timer6_Tick);
  52. timer7.Tick += new EventHandler(timer7_Tick);
  53. timer8.Tick += new EventHandler(timer8_Tick);
  54. timer9.Tick += new EventHandler(timer9_Tick);
  55. timer10.Tick += new EventHandler(timer10_Tick);
  56. timer11.Tick += new EventHandler(timer11_Tick);
  57. timer12.Tick += new EventHandler(timer12_Tick);
  58. timer13.Tick += new EventHandler(timer13_Tick);
  59. timer14.Tick += new EventHandler(timer14_Tick);
  60. timer15.Tick += new EventHandler(timer15_Tick);
  61. }
  62.  
  63. public void progressTimers()
  64. {
  65. progressBar1.Visible = true;
  66. progressBar2.Visible = true;
  67. progressBar3.Visible = true;
  68. progressBar4.Visible = true;
  69. progressBar5.Visible = true;
  70. progressBar6.Visible = true;
  71. progressBar7.Visible = true;
  72. progressBar8.Visible = true;
  73. progressBar9.Visible = true;
  74. progressBar10.Visible = true;
  75. progressBar11.Visible = true;
  76. progressBar12.Visible = true;
  77. progressBar13.Visible = true;
  78. progressBar14.Visible = true;
  79. progressBar15.Visible = true;
  80.  
  81. progressBar1.Value = 0;
  82. progressBar2.Value = 0;
  83. progressBar3.Value = 0;
  84. progressBar4.Value = 0;
  85. progressBar5.Value = 0;
  86. progressBar6.Value = 0;
  87. progressBar7.Value = 0;
  88. progressBar8.Value = 0;
  89. progressBar9.Value = 0;
  90. progressBar10.Value = 0;
  91. progressBar11.Value = 0;
  92. progressBar12.Value = 0;
  93. progressBar13.Value = 0;
  94. progressBar14.Value = 0;
  95. progressBar15.Value = 0;
  96.  
  97. progressBar1.Minimum = 0;
  98. progressBar2.Minimum = 0;
  99. progressBar3.Minimum = 0;
  100. progressBar4.Minimum = 0;
  101. progressBar5.Minimum = 0;
  102. progressBar6.Minimum = 0;
  103. progressBar7.Minimum = 0;
  104. progressBar8.Minimum = 0;
  105. progressBar9.Minimum = 0;
  106. progressBar10.Minimum = 0;
  107. progressBar11.Minimum = 0;
  108. progressBar12.Minimum = 0;
  109. progressBar13.Minimum = 0;
  110. progressBar14.Minimum = 0;
  111. progressBar15.Minimum = 0;
  112.  
  113. progressBar1.Maximum = 4800;
  114. progressBar2.Maximum = 4800;
  115. progressBar3.Maximum = 4800;
  116. progressBar4.Maximum = 4800;
  117. progressBar10.Maximum = 52560;
  118. progressBar11.Maximum = 52560;
  119. progressBar12.Maximum = 52560;
  120. progressBar13.Maximum = 52560;
  121. progressBar14.Maximum = 52560;
  122. progressBar15.Maximum = 52560;
  123. }
  124.  
  125. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  126. {
  127. if (comboBox1.SelectedItem.ToString() == "Oak")
  128. treeTime = 8400;
  129. else if (comboBox1.SelectedItem.ToString() == "Willow")
  130. treeTime = 13200;
  131. else if (comboBox1.SelectedItem.ToString() == "Maple")
  132. treeTime = 18000;
  133. else if (comboBox1.SelectedItem.ToString() == "Yew")
  134. treeTime = 22800;
  135. else if (comboBox1.SelectedItem.ToString() == "Magic")
  136. treeTime = 27600;
  137.  
  138. timer5.Stop();
  139. timer6.Stop();
  140. timer7.Stop();
  141. timer7.Stop();
  142. timer9.Stop();
  143.  
  144. progressBar5.Value = 0;
  145. progressBar6.Value = 0;
  146. progressBar7.Value = 0;
  147. progressBar8.Value = 0;
  148. progressBar9.Value = 0;
  149.  
  150. progressBar5.Maximum = treeTime;
  151. progressBar6.Maximum = treeTime;
  152. progressBar7.Maximum = treeTime;
  153. progressBar8.Maximum = treeTime;
  154. progressBar9.Maximum = treeTime;
  155. }
  156.  
  157. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  158. {
  159. try
  160. {
  161. Process.Start("http://www.youtube.com/tcoygames");
  162. }
  163. catch (Exception exp)
  164. {
  165. MessageBox.Show(exp.Message);
  166. }
  167. }
  168.  
  169. public void checkUpdates()
  170. {
  171. string news;
  172. WebClient web = new WebClient();
  173.  
  174. news = web.DownloadString("http://tcoy.netau.net/ftnews");
  175. label2.Text = news;
  176.  
  177. if (web.DownloadString("http://tcoy.netau.net/ftupdate") == "true")
  178. MessageBox.Show("Farming Timer updated! Please visit tcoy.netau.net/farmingtimer to download the newest version!");
  179. }
  180.  
  181. //###########################################################################\\
  182.  
  183. public void timer1_Tick(object sender, EventArgs e) //S.Falador timer
  184. {
  185. if (progressBar1.Value != progressBar1.Maximum)
  186. {
  187. progressBar1.Value += 1;
  188. }
  189. else
  190. {
  191. timer1.Stop();
  192. MessageBox.Show("S.Falador Herb patch ready to harvest!");
  193. }
  194. }
  195.  
  196. public void timer2_Tick(object sender, EventArgs e) // Phasmatys timer
  197. {
  198. if (progressBar2.Value != progressBar2.Maximum)
  199. {
  200. progressBar2.Value += 1;
  201. }
  202. else
  203. {
  204. timer2.Stop();
  205. MessageBox.Show("Port Phasmatys Herb patch ready to harvest!");
  206. }
  207. }
  208.  
  209. public void timer3_Tick(object sender, EventArgs e) // N.Catherby timer
  210. {
  211. if (progressBar3.Value != progressBar3.Maximum)
  212. {
  213. progressBar3.Value += 1;
  214. }
  215. else
  216. {
  217. timer3.Stop();
  218. MessageBox.Show("N.Catherby Herb patch ready to harvest!");
  219. }
  220. }
  221.  
  222. public void timer4_Tick(object sender, EventArgs e) // N.Ardougne timer
  223. {
  224. if (progressBar4.Value != progressBar4.Maximum)
  225. {
  226. progressBar4.Value += 1;
  227. }
  228. else
  229. {
  230. timer4.Stop();
  231. MessageBox.Show("N.Ardougne Herb patch ready to harvest!");
  232. }
  233. }
  234.  
  235. public void timer5_Tick(object sender, EventArgs e) // Lumbridge tree timer
  236. {
  237. if (progressBar5.Value != progressBar5.Maximum)
  238. {
  239. progressBar5.Value += 1;
  240. }
  241. else
  242. {
  243. timer5.Stop();
  244. MessageBox.Show("Lumbridge tree patch ready to harvest!");
  245. }
  246. }
  247.  
  248. public void timer6_Tick(object sender, EventArgs e) // Varrock tree timer
  249. {
  250. if (progressBar6.Value != progressBar6.Maximum)
  251. {
  252. progressBar6.Value += 1;
  253. }
  254. else
  255. {
  256. timer6.Stop();
  257. MessageBox.Show("Varrock tree patch ready to harvest!");
  258. }
  259. }
  260.  
  261. public void timer7_Tick(object sender, EventArgs e) // Falador tree timer
  262. {
  263. if (progressBar7.Value != progressBar7.Maximum)
  264. {
  265. progressBar7.Value += 1;
  266. }
  267. else
  268. {
  269. timer7.Stop();
  270. MessageBox.Show("Falador tree patch ready to harvest!");
  271. }
  272. }
  273.  
  274. public void timer8_Tick(object sender, EventArgs e) // Taverly tree timer
  275. {
  276. if (progressBar8.Value != progressBar8.Maximum)
  277. {
  278. progressBar8.Value += 1;
  279. }
  280. else
  281. {
  282. timer8.Stop();
  283. MessageBox.Show("Taverly tree patch ready to harvest!");
  284. }
  285. }
  286.  
  287. public void timer9_Tick(object sender, EventArgs e) // Stronghold tree timer
  288. {
  289. if (progressBar9.Value != progressBar9.Maximum)
  290. {
  291. progressBar9.Value += 1;
  292. }
  293. else
  294. {
  295. timer9.Stop();
  296. MessageBox.Show("Gnome Stronghold tree patch ready to harvest!");
  297. }
  298. }
  299.  
  300. public void timer10_Tick(object sender, EventArgs e) // Catherby Ftree timer
  301. {
  302. if (progressBar10.Value != progressBar10.Maximum)
  303. {
  304. progressBar10.Value += 1;
  305. }
  306. else
  307. {
  308. timer10.Stop();
  309. MessageBox.Show("Catherby fruit tree patch ready to harvest!");
  310. }
  311. }
  312.  
  313. public void timer11_Tick(object sender, EventArgs e) // Gnome Maze Ftree timer
  314. {
  315. if (progressBar11.Value != progressBar11.Maximum)
  316. {
  317. progressBar11.Value += 1;
  318. }
  319. else
  320. {
  321. timer11.Stop();
  322. MessageBox.Show("Gnome maze fruit tree patch ready to harvest!");
  323. }
  324. }
  325.  
  326. public void timer12_Tick(object sender, EventArgs e) // Brimhaven Ftree timer
  327. {
  328. if (progressBar12.Value != progressBar12.Maximum)
  329. {
  330. progressBar12.Value += 1;
  331. }
  332. else
  333. {
  334. timer12.Stop();
  335. MessageBox.Show("Brimhaven fruit tree patch ready to harvest!");
  336. }
  337. }
  338.  
  339. public void timer13_Tick(object sender, EventArgs e) // Agility Course Ftree timer
  340. {
  341. if (progressBar13.Value != progressBar13.Maximum)
  342. {
  343. progressBar13.Value += 1;
  344. }
  345. else
  346. {
  347. timer13.Stop();
  348. MessageBox.Show("Brimhaven fruit tree patch ready to harvest!");
  349. }
  350. }
  351.  
  352. public void timer14_Tick(object sender, EventArgs e) // Lletya Ftree timer
  353. {
  354. if (progressBar14.Value != progressBar14.Maximum)
  355. {
  356. progressBar14.Value += 1;
  357. }
  358. else
  359. {
  360. timer14.Stop();
  361. MessageBox.Show("Lletya fruit tree patch ready to harvest!");
  362. }
  363. }
  364.  
  365. public void timer15_Tick(object sender, EventArgs e) // Herblore Habitat Ftree timer
  366. {
  367. if (progressBar15.Value != progressBar15.Maximum)
  368. {
  369. progressBar15.Value += 1;
  370. }
  371. else
  372. {
  373. timer15.Stop();
  374. MessageBox.Show("Herblore Habitat fruit tree patch ready to harvest!");
  375. }
  376. }
  377.  
  378. //###########################################################################\\
  379.  
  380. private void button1_Click(object sender, EventArgs e) // S.Falador button
  381. {
  382. if (button1.Text == "S.Falador")
  383. {
  384. timer1.Start();
  385. button1.Text = "Stop";
  386. }
  387. else
  388. {
  389. progressBar1.Value = 0;
  390. timer1.Stop();
  391. button1.Text = "S.Falador";
  392. }
  393. }
  394.  
  395. private void button2_Click(object sender, EventArgs e) // Phasmatys button
  396. {
  397. if (button2.Text == "Phasmatys")
  398. {
  399. timer2.Start();
  400. button2.Text = "Stop";
  401. }
  402. else
  403. {
  404. progressBar2.Value = 0;
  405. timer2.Stop();
  406. button2.Text = "Phasmatys";
  407. }
  408. }
  409.  
  410. private void button3_Click(object sender, EventArgs e) // N.Catherby button
  411. {
  412. if (button3.Text == "N.Catherby")
  413. {
  414. timer3.Start();
  415. button3.Text = "Stop";
  416. }
  417. else
  418. {
  419. progressBar3.Value = 0;
  420. timer3.Stop();
  421. button3.Text = "N.Catherby";
  422. }
  423. }
  424.  
  425. private void button4_Click(object sender, EventArgs e) // N.Ardougne button
  426. {
  427. if (button4.Text == "N.Ardougne")
  428. {
  429. timer4.Start();
  430. button4.Text = "Stop";
  431. }
  432. else
  433. {
  434. progressBar4.Value = 0;
  435. timer4.Stop();
  436. button4.Text = "N.Ardougne";
  437. }
  438. }
  439.  
  440. private void button5_Click(object sender, EventArgs e) // Donation button
  441. {
  442. try
  443. {
  444. Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3YRSBENF7QDFN&lc=US&item_name=Donation%20to%20tcoy&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted");
  445. }
  446. catch (Exception exp)
  447. {
  448. MessageBox.Show(exp.Message);
  449. }
  450. }
  451.  
  452. private void button6_Click(object sender, EventArgs e) // Lumbridge tree button
  453. {
  454. if (button6.Text == "Lumbridge")
  455. {
  456. timer5.Start();
  457. button6.Text = "Stop";
  458. }
  459. else
  460. {
  461. progressBar5.Value = 0;
  462. timer5.Stop();
  463. button6.Text = "Lumbridge";
  464. }
  465. }
  466.  
  467. private void button7_Click(object sender, EventArgs e) // Varrock tree button
  468. {
  469. if (button7.Text == "Varrock")
  470. {
  471. timer6.Start();
  472. button7.Text = "Stop";
  473. }
  474. else
  475. {
  476. progressBar6.Value = 0;
  477. timer6.Stop();
  478. button7.Text = "Varrock";
  479. }
  480. }
  481.  
  482. private void button8_Click(object sender, EventArgs e) // Falador tree button
  483. {
  484. if (button8.Text == "Falador")
  485. {
  486. timer7.Start();
  487. button8.Text = "Stop";
  488. }
  489. else
  490. {
  491. progressBar7.Value = 0;
  492. timer7.Stop();
  493. button8.Text = "Falador";
  494. }
  495. }
  496.  
  497. private void button9_Click(object sender, EventArgs e) // Taverley tree button
  498. {
  499. if (button9.Text == "Taverley")
  500. {
  501. timer8.Start();
  502. button9.Text = "Stop";
  503. }
  504. else
  505. {
  506. progressBar8.Value = 0;
  507. timer8.Stop();
  508. button9.Text = "Taverley";
  509. }
  510. }
  511.  
  512. private void button10_Click(object sender, EventArgs e) // Stronghold tree button
  513. {
  514. if (button10.Text == "Stronghold")
  515. {
  516. timer9.Start();
  517. button10.Text = "Stop";
  518. }
  519. else
  520. {
  521. progressBar9.Value = 0;
  522. timer9.Stop();
  523. button10.Text = "Stronghold";
  524. }
  525. }
  526.  
  527. private void button11_Click(object sender, EventArgs e)
  528. {
  529. if (button11.Text == "Catherby")
  530. {
  531. timer10.Start();
  532. button11.Text = "Stop";
  533. }
  534. else
  535. {
  536. progressBar10.Value = 0;
  537. timer10.Stop();
  538. button11.Text = "Catherby";
  539. }
  540. } // Catherby Ftree button
  541.  
  542. private void button12_Click(object sender, EventArgs e)
  543. {
  544. if (button12.Text == "Gnome maze")
  545. {
  546. timer11.Start();
  547. button12.Text = "Stop";
  548. }
  549. else
  550. {
  551. progressBar11.Value = 0;
  552. timer11.Stop();
  553. button12.Text = "Gnome maze";
  554. }
  555. } // Gnome Maze Ftree button
  556.  
  557. private void button13_Click(object sender, EventArgs e)
  558. {
  559. if (button13.Text == "Brimhaven")
  560. {
  561. timer12.Start();
  562. button13.Text = "Stop";
  563. }
  564. else
  565. {
  566. progressBar12.Value = 0;
  567. timer12.Stop();
  568. button13.Text = "Brimhaven";
  569. }
  570. } // Brimhaven Ftree button
  571.  
  572. private void button14_Click(object sender, EventArgs e)
  573. {
  574. if (button14.Text == "Agility Course")
  575. {
  576. timer13.Start();
  577. button14.Text = "Stop";
  578. }
  579. else
  580. {
  581. progressBar13.Value = 0;
  582. timer13.Stop();
  583. button14.Text = "Agility Course";
  584. }
  585. } // Agility Course Ftree button
  586.  
  587. private void button15_Click(object sender, EventArgs e)
  588. {
  589. if (button15.Text == "Lletya")
  590. {
  591. timer14.Start();
  592. button15.Text = "Stop";
  593. }
  594. else
  595. {
  596. progressBar14.Value = 0;
  597. timer14.Stop();
  598. button15.Text = "Lletya";
  599. }
  600. } // Lletya Ftree button
  601.  
  602. private void button16_Click(object sender, EventArgs e)
  603. {
  604. if (button16.Text == "HerbHabitat")
  605. {
  606. timer15.Start();
  607. button16.Text = "Stop";
  608. }
  609. else
  610. {
  611. progressBar15.Value = 0;
  612. timer15.Stop();
  613. button16.Text = "HerbHabitat";
  614. }
  615. } // Herblore Habitat Ftree button
  616.  
  617. //###########################################################################\\
  618. }
  619. }
Advertisement
Add Comment
Please, Sign In to add comment