Guest User

Untitled

a guest
Jul 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 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.IO;
  10. using Fluent.Toc;
  11.  
  12. namespace D2NTxt
  13. {
  14. public partial class D2NTxt : Form
  15. {
  16. public D2NTxt()
  17. {
  18. InitializeComponent();
  19. }
  20. private void aimPass_TextChanged(object sender, EventArgs e)
  21. {
  22.  
  23. }
  24.  
  25. private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
  26. {
  27. //Display the Form in normal state
  28. if (WindowState == FormWindowState.Minimized)
  29. {
  30. this.Show();
  31. WindowState = FormWindowState.Normal;
  32. }
  33. else
  34. {
  35. WindowState = FormWindowState.Minimized;
  36. this.Hide();
  37. }
  38. }
  39.  
  40. private void D2NTxt_Load(object sender, EventArgs e)
  41. {
  42. button2.Enabled = false;
  43. string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
  44. char[] trimF = { 'f', 'i', 'l', 'e', ':', '\\' };
  45. string newdir = dir.TrimStart(trimF);
  46. string newdir2 = newdir + "\\config.txt";
  47. if (System.IO.File.Exists(newdir2))
  48. {
  49. string[] lines = System.IO.File.ReadAllLines(newdir2);
  50. if (lines != null)
  51. {
  52. aimAccount.Text = lines[0];
  53. aimPass.Text = lines[1];
  54. aimScreen.Text = lines[2];
  55. }
  56. }
  57. }
  58.  
  59. private void groupBox1_Enter(object sender, EventArgs e)
  60. {
  61.  
  62. }
  63.  
  64. private void D2NTxt_Resize(object sender, EventArgs e)
  65. {
  66. //On minimize mode, show the form in System Tray only
  67. if (WindowState == FormWindowState.Minimized)
  68. {
  69. this.Hide();
  70. }
  71. if (WindowState == FormWindowState.Normal)
  72. {
  73. this.Show();
  74. }
  75. }
  76.  
  77. private void button1_Click(object sender, EventArgs e)
  78. {
  79. timer1.Enabled = true;
  80. button2.Enabled = true;
  81. button1.Enabled = false;
  82. }
  83.  
  84. private void button2_Click(object sender, EventArgs e)
  85. {
  86. timer1.Enabled = false;
  87. button2.Enabled = false;
  88. button1.Enabled = true;
  89. }
  90.  
  91. private void timer1_Tick(object sender, EventArgs e)
  92. {
  93. string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
  94. char[] trimF = { 'f', 'i', 'l', 'e', ':', '\\' };
  95. string newdir = dir.TrimStart(trimF);
  96. string newdir2 = newdir + "\\im.txt";
  97. if (System.IO.File.Exists(newdir2))
  98. {
  99. string text = System.IO.File.ReadAllText(newdir2);
  100. if (text.Length > 0)
  101. {
  102. TocClient tc = new TocClient();
  103. tc.SignOn(aimAccount.Text, aimPass.Text);
  104. tc.Send(aimScreen.Text, text);
  105. tc.SignOff();
  106. System.IO.File.Delete(newdir2);
  107. }
  108. }
  109. }
  110.  
  111. private void saveButton_Click(object sender, EventArgs e)
  112. {
  113. string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
  114. char[] trimF = { 'f', 'i', 'l', 'e', ':', '\\' };
  115. string newdir = dir.TrimStart(trimF);
  116. string newdir2 = newdir + "\\config.txt";
  117. string[] lines = { aimAccount.Text, aimPass.Text, aimScreen.Text };
  118. System.IO.File.WriteAllLines(newdir2, lines);
  119. }
  120.  
  121. private void aimAccount_TextChanged(object sender, EventArgs e)
  122. {
  123.  
  124. }
  125.  
  126.  
  127. }
  128. }
Add Comment
Please, Sign In to add comment