Guest User

Untitled

a guest
Jan 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.48 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.Runtime.InteropServices;
  10. using System.IO;
  11.  
  12. namespace Le_Spam_Tool
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public const int WM_NCLBUTTONDOWN = 0xA1;
  17.         public const int HT_CAPTION = 0x2;
  18.  
  19.         [DllImportAttribute("user32.dll")]
  20.         public static extern int SendMessage(IntPtr hWnd,
  21.                          int Msg, int wParam, int lParam);
  22.         [DllImportAttribute("user32.dll")]
  23.         public static extern bool ReleaseCapture();
  24.         private string sysdrive;
  25.         public Form1()
  26.         {
  27.             InitializeComponent();
  28.         }
  29.         private void Form1_MouseDown(object sender,
  30.         System.Windows.Forms.MouseEventArgs e)
  31.         {
  32.             if (e.Button == MouseButtons.Left)
  33.             {
  34.                 ReleaseCapture();
  35.                 SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  36.             }
  37.         }
  38.  
  39.         private void panel1_MouseDown(object sender,MouseEventArgs e)
  40.         {
  41.             if (e.Button == MouseButtons.Left)
  42.             {
  43.                 ReleaseCapture();
  44.                 SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  45.             }
  46.         }
  47.  
  48.         public void check_border_type()
  49.         {
  50.             StreamReader rBorder = new StreamReader(Application.StartupPath + "\\settings\\2.txt");
  51.             if (rBorder.ReadToEnd().Contains("1"))
  52.             {
  53.                 this.ControlBox = true;
  54.                     this.MaximizeBox = false;
  55.                 this.Text = Application.ProductName;
  56.             }
  57.             else
  58.             {
  59.                 this.ControlBox = false;
  60.                 this.Text = "";
  61.             }
  62.             rBorder.Close();
  63.         }
  64.  
  65.         private void Form1_Load(object sender, EventArgs e)
  66.         {
  67.             label1.Text = textBox1.MaxLength.ToString();
  68.             installReqFont();
  69.             check_border_type();
  70.         }
  71.  
  72.         private void panel1_Paint(object sender, PaintEventArgs e)
  73.         {
  74.  
  75.         }
  76.  
  77.         private void installReqFont()
  78.         {
  79.             sysdrive = Directory.GetDirectoryRoot(Application.ExecutablePath);
  80.             if (File.Exists(sysdrive + "windows\\fonts\\04B03.TTF"))
  81.             {
  82.                 goto end;
  83.             }
  84.             string[] files = Directory.GetFiles(Application.StartupPath + "\\fonts\\");
  85.             foreach (string f in files)
  86.             {
  87.                 FileInfo fi = new FileInfo(f);
  88.                 string fn = fi.Name;
  89.                 try
  90.                 {
  91.                     File.Copy(Application.StartupPath + "\\fonts\\" + fn, sysdrive + "windows\\fonts\\" + fn);
  92.                 }
  93.                 catch (Exception ex)
  94.                 {
  95.                     if (ex.ToString().Contains("denied"))
  96.                     {
  97.                         this.Hide();
  98.                         MessageBox.Show("Could not install font. Please launch as administrator.\r\n\r\nYou can manually install the font (File Location: '" + Application.StartupPath + "\\fonts\\" + fn + "').", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  99.                         System.Diagnostics.Process.Start(Application.StartupPath);
  100.                         Application.Exit();
  101.                     }
  102.                     else
  103.                     {
  104.                         MessageBox.Show(ex.ToString(),"Exception Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
  105.                     }
  106.                 }
  107.             }
  108.         end: ;
  109.         }
  110.  
  111.         private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  112.         {
  113.             Application.Exit();
  114.         }
  115.  
  116.         private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  117.         {
  118.             this.WindowState = FormWindowState.Minimized;
  119.         }
  120.  
  121.         private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  122.         {
  123.             Form3Settings f3 = new Form3Settings();
  124.             f3.Show();
  125.         }
  126.  
  127.         private void pictureBox1_Click(object sender, EventArgs ee)
  128.         {
  129.             bool e = false;
  130.             string sl = Application.StartupPath + "\\settings\\";
  131.             if (!File.Exists(sl + "1.txt") || !File.Exists(sl + "2.txt") || !File.Exists(sl + "3.txt"))
  132.             {
  133.                 e = true;
  134.                 MessageBox.Show("Y U TRY N SPAM WITH NO OPTIONS CONFIGURED?! >:(", "", MessageBoxButtons.OK, MessageBoxIcon.Question);
  135.                 Form3Settings f3 = new Form3Settings();
  136.                 f3.Show();
  137.             }
  138.  
  139.             if (!e)
  140.             {
  141.                 ReadD();
  142.             }
  143.         }
  144.  
  145.         private int secAmount, Amount;
  146.         private string _string;
  147.         bool sendkeys, secondAmount, pressEnter;
  148.         private void ReadD()
  149.         {
  150.             if (textBox1.Text.Equals(""))
  151.             {
  152.                 MessageBox.Show("I'm not spamming nothing. >_>\r\nEnter some text and try again!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  153.                 goto end;
  154.             }
  155.             string sl = Application.StartupPath + "\\settings\\";
  156.             _string = textBox1.Text;
  157.             StreamReader r1 = new StreamReader(sl + "1.txt");
  158.             // r1 = 1 (seconds) | r1 = 0 (amount)
  159.             StreamReader r2 = new StreamReader(sl + "2.txt");
  160.             StreamReader r3 = new StreamReader(sl + "3.txt");
  161.             StreamReader r4 = new StreamReader(sl + "4.txt");
  162.             if (r2.ReadToEnd().Contains("1"))
  163.             {
  164.                 sendkeys = true;
  165.             }
  166.             else
  167.             {
  168.                 sendkeys = false;
  169.             }
  170.             if (r1.ReadToEnd().Contains("1"))
  171.             {
  172.                 secondAmount = true;
  173.             }
  174.             else
  175.             {
  176.                 secondAmount = false;
  177.             }
  178.             if (r4.ReadToEnd().Contains("1"))
  179.             {
  180.                 pressEnter = true;
  181.             }
  182.             else
  183.             {
  184.                 pressEnter = false;
  185.             }
  186.             try
  187.             {
  188.                 if (secondAmount)
  189.                 {
  190.                     secAmount = Convert.ToInt32(r3.ReadToEnd());
  191.                 }
  192.                 else if (!secondAmount)
  193.                 {
  194.                     Amount = Convert.ToInt32(r3.ReadToEnd());
  195.                 }
  196.             }
  197.             catch
  198.             {
  199.                 MessageBox.Show("Error reading settings :S", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  200.                 goto end;
  201.             }
  202.             this.Enabled = false;
  203.             this.Hide();
  204.  
  205.             if (secondAmount)
  206.             {
  207.                 spam_seconds();
  208.             }
  209.             else
  210.             {
  211.                 spam_amount();
  212.             }
  213.            
  214.         end: ;
  215.         }
  216.  
  217.         Timer timer, t_timeout;
  218.         private bool spam = false;
  219.         private int timeout, timeout_seconds;
  220.         private int v;
  221.         private void spam_seconds()
  222.         {
  223.             timer = new Timer();
  224.             t_timeout = new Timer();
  225.             timeout_seconds = secAmount;
  226.             spam = true;
  227.             timer.Interval = 10;
  228.             timer.Enabled = true;
  229.             timer.Tick += new EventHandler(timer_Tick);
  230.             t_timeout.Enabled = true;
  231.             t_timeout.Interval = 1000;
  232.             t_timeout.Tick +=new EventHandler(t_timeout_Tick);
  233.             timeout = 0;
  234.             v = 0;
  235.         }
  236.  
  237.         private void timer_Tick(object sender, EventArgs e)
  238.         {
  239.             v++;
  240.             if (pressEnter)
  241.             {
  242.                 SendKeys.Send(_string + "{ENTER}");
  243.             }
  244.             else
  245.             {
  246.                 SendKeys.Send(_string);
  247.             }
  248.         }
  249.  
  250.         private void t_timeout_Tick(object sender, EventArgs e)
  251.         {
  252.             if (timeout == timeout_seconds)
  253.             {
  254.                 spam = false;
  255.                 timer.Enabled = false;
  256.                 t_timeout.Enabled = false;
  257.                 this.Enabled = true;
  258.                 this.Show();
  259.             }
  260.             timeout++;
  261.         }
  262.  
  263.         private void spam_amount()
  264.         {
  265.             int v = 0;
  266.             for (int i = 0; i < Amount; i++)
  267.             {
  268.                 v++;
  269.                 if (pressEnter)
  270.                 {
  271.                     SendKeys.Send(_string + "{ENTER}");
  272.                 }
  273.                 else
  274.                 {
  275.                     SendKeys.Send(_string);
  276.                 }
  277.             }
  278.  
  279.             this.Enabled = true;
  280.             this.Show();
  281.         }
  282.  
  283.         private void textBox1_TextChanged(object sender, EventArgs e)
  284.         {
  285.             //Update amount of characters left in TextBox
  286.             string s = textBox1.Text;
  287.             int sl = Convert.ToInt32(s.Length);
  288.             int ml = Convert.ToInt32(textBox1.MaxLength.ToString());
  289.             int r = ml - sl; //Maxlength - Current Text Length = x
  290.             label1.Text = r.ToString();
  291.         }
  292.  
  293.         private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  294.         {
  295.             Form2Contact f2 = new Form2Contact();
  296.             f2.Show();
  297.         }
  298.  
  299.         private void label1_Click(object sender, EventArgs e)
  300.         {
  301.             System.Diagnostics.Process.Start(Application.StartupPath);
  302.         }
  303.     }
  304. }
Add Comment
Please, Sign In to add comment