VintageRice

[Visual Studio] - Callsign Editor v2

Nov 3rd, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 15.08 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. using System.Resources;
  12.  
  13. /*
  14.  * Program created by VintageRice/vRice
  15.  * Original source by MassTumor, but complerely rescripted by myself.
  16. */
  17.  
  18. namespace Callsign_Editor
  19. {
  20.     public partial class Form1 : Form
  21.     {
  22.         public Form1()
  23.         {
  24.             InitializeComponent();
  25.         }
  26.  
  27.         public Process[] aTekno = Process.GetProcessesByName("iw5mp");
  28.         public Process[] bTekno = Process.GetProcessesByName("iw5m.dat");
  29.  
  30.         getProcess.processReader TeknoMw3 = new getProcess.processReader();
  31.  
  32.         void aError() { MessageBox.Show("Error writing to the TeknoMw3 process!"); }
  33.         void bError() { MessageBox.Show("Couldn't locate the TeknoMw3 process!"); }
  34.  
  35.         public Random randInt = new Random();
  36.         public int panelCount = 0;
  37.         public int fadeNum = 255;
  38.         public int pCycle = 0;
  39.         public int doCount = 0;
  40.  
  41.         //Had to collect these manually because they were 'random' in the other rool
  42.         byte[] titleValue = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x99, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2E, 0x30, 0x31, 0x32, 0x33, 0x36, 0x38, 0x3B, 0x3E, 0x3F, 0x40, 0x43, 0x44, 0x46, 0x4A, 0x4B, 0x50, 0x51, 0x55, 0x56, 0x58, 0x5B, 0x5C, 0x5F, 0x61, 0x62, 0x64, 0x66, 0x67, 0x6B, 0x6C, 0x6F, 0x74, 0x76, 0x7A, 0x7F, 0x80, 0x82, 0x83, 0x85, 0x86, 0x87, 0x88, 0x8B, 0x8F, 0x90, 0x93, 0x96, 0x9C, 0x9F, 0xA0, 0xA1, 0xC0, 0xC6, 0xF0, 0xF1, 0xF2, 0xF3, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF9, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF };
  43.  
  44.         private void timer1_Tick(object sender, EventArgs e)
  45.         {
  46.             if (aTekno.Length != 0 || bTekno.Length != 0)
  47.             {
  48.                 if (bTekno.Length != 0) aTekno = bTekno;
  49.  
  50.                 doCount++;
  51.                 if (doCount < 2)
  52.                 {
  53.                     foreach (Process aPath in Process.GetProcessesByName("iw5mp"))
  54.                     {
  55.                         try
  56.                         {
  57.                             string fullPath = aPath.MainModule.FileName;
  58.                             var aString = fullPath;
  59.  
  60.                             var aToReplace = new string[] { "\\" };
  61.                             foreach (var c in aToReplace) aString = aString.Replace(c, "\\\\");
  62.                             var bString = aString;
  63.  
  64.                             var bToReplace = new string[] { "\\\\iw5mp", ".exe" };
  65.                             foreach (var c in bToReplace) bString = bString.Replace(c, "");
  66.  
  67.                             string cString = bString + "\\\\players2\\\\config_mp.cfg";
  68.  
  69.                             System.IO.FileInfo getInfo = new System.IO.FileInfo(cString);
  70.                             if (getInfo.IsReadOnly) File.SetAttributes(cString, FileAttributes.Normal);
  71.                         }
  72.                         catch (Exception E) { MessageBox.Show(E.Message); }
  73.                     }
  74.  
  75.                     foreach (Process bPath in Process.GetProcessesByName("iw5mp.dat"))
  76.                     {
  77.                         try
  78.                         {
  79.                             string fullPath = bPath.MainModule.FileName;
  80.                             var aString = fullPath;
  81.  
  82.                             var aToReplace = new string[] { "\\" };
  83.                             foreach (var c in aToReplace) aString = aString.Replace(c, "\\\\");
  84.                             var bString = aString;
  85.  
  86.                             var bToReplace = new string[] { "\\\\iw5m", ".exe", ".dat" };
  87.                             foreach (var c in bToReplace) bString = bString.Replace(c, "");
  88.  
  89.                             string cString = bString + "\\\\players2\\\\config_mp.cfg";
  90.  
  91.                             System.IO.FileInfo getInfo = new System.IO.FileInfo(cString);
  92.                             if (getInfo.IsReadOnly) File.SetAttributes(cString, FileAttributes.Normal);
  93.                         }
  94.                         catch (Exception E) { MessageBox.Show(E.Message); }
  95.                     }
  96.                 }
  97.  
  98.                 label1.Text = "TeknoMw3 is Running";
  99.                 label1.ForeColor = Color.ForestGreen;
  100.  
  101.                 foreach (Control C in this.Controls) C.Enabled = true;
  102.             }
  103.             else
  104.             {
  105.                 label1.Text = "TeknoMw3 isn't Running!";
  106.                 label1.ForeColor = Color.Firebrick;
  107.  
  108.                 if (doCount != 0) doCount = 0;
  109.                 foreach (Control C in this.Controls) C.Enabled = false;
  110.             }
  111.         }
  112.  
  113.         private void setColour(object sender, EventArgs e)
  114.         {
  115.             Button getClicked = (Button)sender;
  116.             Clipboard.SetText("^" + getClicked.Text);
  117.         }
  118.  
  119.         private void Form1_Load(object sender, EventArgs e)
  120.         {
  121.             //Creating of all the pictureboxex programmatically instead of manually
  122.             for(int i = 2; i < 144; i++)
  123.             {
  124.                 PictureBox newBox = new PictureBox();
  125.  
  126.                 newBox.Location = new System.Drawing.Point(15 + ((i - 1) * 155), 57);
  127.                 newBox.Height = 30;
  128.                 newBox.Width = 150;
  129.                 newBox.Name = "Title_" + i;
  130.                 newBox.BorderStyle = BorderStyle.FixedSingle;
  131.                 newBox.Cursor = Cursors.Hand;
  132.  
  133.                 object newImage = Properties.Resources.ResourceManager.GetObject("titleImage_" + i);
  134.                 newBox.Image = (Image)newImage;
  135.                 newBox.SizeMode = PictureBoxSizeMode.StretchImage;
  136.  
  137.                 newBox.Click += new EventHandler(this.changeTitle);
  138.                 newBox.MouseHover += new EventHandler(this.titleHover);
  139.                 newBox.MouseLeave += new EventHandler(this.titleLeave);
  140.  
  141.                 this.Controls.Add(newBox);
  142.  
  143.                 panelCount++;
  144.             }
  145.         }
  146.  
  147.         private void titleHover(object sender, EventArgs e)
  148.         {
  149.             foreach (Control C in this.Controls) if (C.Name.Contains("Title_")) C.Visible = false;
  150.  
  151.             PictureBox titleCard = (PictureBox)sender;
  152.             titleCard.Visible = true;
  153.         }
  154.  
  155.         private void titleLeave(object sender, EventArgs e)
  156.         {
  157.             foreach (Control C in this.Controls) if (C.Name.Contains("Title_")) C.Visible = true;
  158.         }
  159.  
  160.         private void timer3_Tick(object sender, EventArgs e)
  161.         {
  162.             foreach (Control P in this.Controls)
  163.             {
  164.                 if (P.Name.Contains("Title_")) ((PictureBox)P).SetBounds(((PictureBox)P).Location.X - 10, ((PictureBox)P).Location.Y, 150, 30);
  165.             }
  166.         }
  167.  
  168.         private void timer4_Tick(object sender, EventArgs e)
  169.         {
  170.             foreach (Control P in this.Controls)
  171.             {
  172.                 if (P.Name.Contains("Title_")) ((PictureBox)P).SetBounds(((PictureBox)P).Location.X + 10, ((PictureBox)P).Location.Y, 150, 30);
  173.             }
  174.         }
  175.  
  176.         private void panel2_MouseHover(object sender, EventArgs e)
  177.         {
  178.             titleScrollLeft.Start();
  179.         }
  180.  
  181.         private void panel2_MouseLeave(object sender, EventArgs e)
  182.         {
  183.             titleScrollLeft.Stop();
  184.         }
  185.  
  186.         private void panel1_MouseHover(object sender, EventArgs e)
  187.         {
  188.             titleScrollRight.Start();
  189.         }
  190.  
  191.         private void panel1_MouseLeave(object sender, EventArgs e)
  192.         {
  193.             titleScrollRight.Stop();
  194.         }
  195.  
  196.         private void button11_Click(object sender, EventArgs e)
  197.         {
  198.             titleClear();
  199.  
  200.             if (aTekno.Length != 0 || bTekno.Length != 0)
  201.             {
  202.                 try
  203.                 {
  204.                     if (bTekno.Length != 0) aTekno = bTekno;
  205.  
  206.                     TeknoMw3.ReadProcess = aTekno[0];
  207.                     TeknoMw3.OpenProcess();
  208.  
  209.                     int i;
  210.                     byte[] a = { 0xFF };
  211.                     byte[] b = new ASCIIEncoding().GetBytes(textBox1.Text);
  212.  
  213.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D34, a, out i);
  214.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D35, b, out i);
  215.                 }
  216.                 catch { aError(); }
  217.             }
  218.             else { bError(); }
  219.         }
  220.  
  221.         private void titleClear()
  222.         {
  223.             if (aTekno.Length != 0 || bTekno.Length != 0)
  224.             {
  225.                 try
  226.                 {
  227.                     if (bTekno.Length != 0) aTekno = bTekno;
  228.  
  229.                     TeknoMw3.ReadProcess = aTekno[0];
  230.                     TeknoMw3.OpenProcess();
  231.  
  232.                     int i;
  233.                     byte[] b = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  234.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D35, b, out i);
  235.                 }
  236.                 catch { aError(); }
  237.             }
  238.             else { bError(); }
  239.         }
  240.  
  241.         private void clanClear()
  242.         {
  243.             if (aTekno.Length != 0 || bTekno.Length != 0)
  244.             {
  245.                 try
  246.                 {
  247.                     if (bTekno.Length != 0) aTekno = bTekno;
  248.  
  249.                     TeknoMw3.ReadProcess = aTekno[0];
  250.                     TeknoMw3.OpenProcess();
  251.  
  252.                     int i;
  253.                     byte[] b = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  254.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D54, b, out i);
  255.                 }
  256.                 catch { aError(); }
  257.             }
  258.             else { bError(); }
  259.         }
  260.  
  261.         private void changeTitle(object sender, EventArgs e)
  262.         {
  263.             PictureBox getClicked = (PictureBox)sender;
  264.  
  265.             string getInt = getClicked.Name.Replace("Title_", "");
  266.             int newInt = Convert.ToInt16(getInt);
  267.  
  268.             if(aTekno.Length != 0 || bTekno.Length != 0)
  269.             {
  270.                 try
  271.                 {
  272.                     if (bTekno.Length != 0) aTekno = bTekno;
  273.  
  274.                     TeknoMw3.ReadProcess = aTekno[0];
  275.                     TeknoMw3.OpenProcess();
  276.  
  277.                     int i;
  278.                     byte b;
  279.  
  280.                     if(newInt <= 102) b = 0x00;
  281.                     else b = 0x01;
  282.  
  283.                     byte[] finalByte = { titleValue[newInt], b };
  284.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D50, finalByte, out i);
  285.                 }
  286.                 catch { aError(); }
  287.             }
  288.             else { bError(); }
  289.         }
  290.  
  291.         private void button3_Click(object sender, EventArgs e)
  292.         {
  293.             if(prestigeCycle.Enabled)
  294.             {
  295.                 prestigeCycle.Stop();
  296.                 button3.Text = "Prestige Cycle [Disabled]";
  297.             }
  298.             else
  299.             {
  300.                 prestigeCycle.Start();
  301.                 button3.Text = "Prestige Cycle [Enabled]";
  302.             }
  303.         }
  304.  
  305.         private void timer2_Tick(object sender, EventArgs e)
  306.         {
  307.             if (pCycle != 20) pCycle++;
  308.             else pCycle = 0;
  309.  
  310.             if (aTekno.Length != 0 || bTekno.Length != 0)
  311.             {
  312.                 try
  313.                 {
  314.                     if (bTekno.Length != 0) aTekno = bTekno;
  315.  
  316.                     TeknoMw3.ReadProcess = aTekno[0];
  317.                     TeknoMw3.OpenProcess();
  318.  
  319.                     int i;
  320.                     byte[] b = { Convert.ToByte(pCycle), 0x00 };
  321.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1CDBC64, b, out i);
  322.                 }
  323.                 catch { aError(); }
  324.             }
  325.             else { bError(); }
  326.         }
  327.  
  328.         private void button2_Click(object sender, EventArgs e)
  329.         {
  330.             titleClear();
  331.             clanClear();
  332.         }
  333.  
  334.         private void button1_Click(object sender, EventArgs e)
  335.         {
  336.             clanClear();
  337.  
  338.             if (aTekno.Length != 0 || bTekno.Length != 0)
  339.             {
  340.                 try
  341.                 {
  342.                     if (bTekno.Length != 0) aTekno = bTekno;
  343.  
  344.                     TeknoMw3.ReadProcess = aTekno[0];
  345.                     TeknoMw3.OpenProcess();
  346.  
  347.                     int i;
  348.                     byte[] a = { 0xFF };
  349.                     byte[] b = new ASCIIEncoding().GetBytes(textBox2.Text);
  350.  
  351.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D33, a, out i);
  352.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D54, b, out i);
  353.                 }
  354.                 catch { aError(); }
  355.             }
  356.             else { bError(); }
  357.         }
  358.  
  359.         private void button4_Click(object sender, EventArgs e)
  360.         {
  361.             clanClear();
  362.             titleClear();
  363.  
  364.             string randomChars = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890[]{}():;";
  365.             int randomColour = randInt.Next(0, 8);
  366.  
  367.             //Random Clantag
  368.             string clanBuild = ("^" + randomColour);
  369.             for (int i1 = 0; i1 < 2; i1++) clanBuild += randomChars[randInt.Next(0, randomChars.Length)];
  370.  
  371.             //Random Title
  372.             string titleBuild = ("^" + randomColour);
  373.             for (int i2 = 0; i2 < 20; i2++) titleBuild += randomChars[randInt.Next(0, randomChars.Length)];
  374.  
  375.             if (aTekno.Length != 0 || bTekno.Length != 0)
  376.             {
  377.                 try
  378.                 {
  379.                     if (bTekno.Length != 0) aTekno = bTekno;
  380.  
  381.                     TeknoMw3.ReadProcess = aTekno[0];
  382.                     TeknoMw3.OpenProcess();
  383.  
  384.                     int i;
  385.                     byte[] b1 = { 0xFF };
  386.  
  387.                     //Clantag
  388.                     byte[] b2 = new ASCIIEncoding().GetBytes(clanBuild);
  389.  
  390.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D33, b1, out i);
  391.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D54, b2, out i);
  392.  
  393.                     //Title Image
  394.                     byte b3;
  395.  
  396.                     if (randInt.Next(0, 1) == 1) b3 = 0x00;
  397.                     else b3 = 0x01;
  398.  
  399.                     byte[] finalByte = { titleValue[randInt.Next(0, 144)], b3 };
  400.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D50, finalByte, out i);
  401.  
  402.                     //Title Text
  403.                     byte[] b4 = new ASCIIEncoding().GetBytes(titleBuild);
  404.  
  405.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D34, b1, out i);
  406.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1328D35, b4, out i);
  407.  
  408.                     //Prestige
  409.                     byte[] b5 = { Convert.ToByte(randInt.Next(0, 20)), 0x00 };
  410.                     TeknoMw3.WriteProcessMemory((IntPtr)0x1CDBC64, b5, out i);
  411.                 }
  412.                 catch { aError(); }
  413.             }
  414.             else { bError(); }
  415.         }
  416.     }
  417. }
Advertisement
Add Comment
Please, Sign In to add comment