Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.29 KB | None | 0 0
  1. // Tool made by CamxxCore/iN1NJA
  2. // Mostly everything in Program.cs written by
  3. // the original maker of the XenonKerbAuthenticator tool. Full credit to him.
  4. // Credit to XeClutch for the XBDM send/ receive code
  5.  
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. using DevComponents.DotNetBar;
  15. using System.IO;
  16. using XRPCLib;
  17. using XDevkit;
  18. using System.Diagnostics;
  19. using System.Threading;
  20.  
  21. namespace XenonKerbAuthenticator
  22. {
  23. public partial class Form1 : DevComponents.DotNetBar.Metro.MetroForm
  24. {
  25. private string[] subFiles;
  26. private bool renameCheck;
  27. IList<String> Names = new List<String>();
  28. XRPC Jtag = new XRPC();
  29.  
  30. public Form1()
  31. {
  32. InitializeComponent();
  33. }
  34.  
  35. private void Form1_Load(object sender, EventArgs e)
  36. {
  37. populatelistBox();
  38. }
  39.  
  40. private void populatelistBox()
  41. {
  42. listBox1.Items.Clear();
  43. string path = AppDomain.CurrentDomain.BaseDirectory + "KVs\\";
  44. string[] filesList = Directory.GetFiles(path);
  45. string[] directories = Directory.GetDirectories(path);
  46.  
  47. foreach (string d in directories)
  48. {
  49. subFiles = Directory.GetFiles(d);
  50. foreach (string sub in subFiles)
  51. {
  52. if (!sub.EndsWith(".bin"))
  53. continue;
  54. else
  55. {
  56. int num1 = d.LastIndexOf('\\');
  57. int num2 = num1 > 0 ? sub.LastIndexOf('\\', num1 - 1) : -1;
  58. string subName = sub.Substring(num2 + 1);
  59. Names.Add(subName);
  60. listBox1.Items.Add(subName);
  61. }
  62. }
  63. }
  64.  
  65. foreach (string s in filesList)
  66. {
  67. if (!s.EndsWith(".bin"))
  68. continue;
  69.  
  70. else
  71. {
  72. int num1 = s.LastIndexOf('\\');
  73. int num2 = num1 > 0 ? s.LastIndexOf('\\', num1 - 1) : -1;
  74. string kvName = s.Substring(num2 + 1);
  75. Names.Add(kvName);
  76. listBox1.Items.Add(kvName);
  77. }
  78. }
  79. listBox1.SelectedIndex = 0;
  80. listBox1.Refresh();
  81. }
  82.  
  83. private void progressBarStep()
  84. {
  85. progressBarX1.Step = 100 / Names.Count();
  86. progressBarX1.PerformStep();
  87. progressBarX1.Refresh();
  88. }
  89.  
  90.  
  91. private void buttonX1_Click(object sender, EventArgs e)
  92. {
  93. listBox1.Items.Clear();
  94. buttonX1.Enabled = false;
  95. buttonX4.Enabled = false;
  96. var instance = new Program();
  97. if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "KVs\\log.txt"))
  98. {
  99. File.Delete(AppDomain.CurrentDomain.BaseDirectory + "KVs\\log.txt");
  100. }
  101.  
  102. ThreadPool.QueueUserWorkItem(new WaitCallback(doWork));
  103.  
  104. }
  105.  
  106. void doWork(object state)
  107. {
  108. var instance = new Program();
  109. string status;
  110. Invoke((MethodInvoker)((() => progressBarX1.Value = 0)));
  111.  
  112. foreach (string name in Names)
  113. {
  114. instance.getStatus(name);
  115. if (instance.returnStatus() == false)
  116. {
  117. status = name + " is Unbanned";
  118. Invoke((MethodInvoker)(() => listBox1.Items.Add(status)));
  119. Invoke((MethodInvoker)(() => listBox1.Refresh()));
  120. }
  121. else
  122. {
  123. status = name + " is Banned";
  124. Invoke((MethodInvoker)(() => listBox1.Items.Add(status)));
  125. Invoke((MethodInvoker)(() => listBox1.Refresh()));
  126. }
  127. Invoke((MethodInvoker)(() => progressBarStep()));
  128. Invoke((MethodInvoker)(() => progressBarX1.Refresh()));
  129. }
  130. Invoke((MethodInvoker)(() => progressBarX1.Value = 100));
  131. Invoke((MethodInvoker)(() => buttonX1.Enabled = true));
  132. Invoke((MethodInvoker)(() => buttonX4.Enabled = true));
  133. Invoke((MethodInvoker)(() => listBox1.SelectedIndex = 0));
  134. }
  135.  
  136.  
  137. private void buttonX2_Click_1(object sender, EventArgs e)
  138. {
  139. Jtag.Connect();
  140. if (Jtag.activeConnection)
  141. {
  142. string currentItem = listBox1.GetItemText(listBox1.SelectedItem);
  143. if (currentItem.EndsWith(" is Banned"))
  144. {
  145. currentItem = currentItem.Substring(0,currentItem.Length - 10);
  146. DialogResult result = MessageBox.Show(currentItem+ " is banned are you sure you want to send the file?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
  147. if (!(result == DialogResult.Yes))
  148. {return;}
  149. }
  150. if (currentItem.EndsWith(" is Unbanned"))
  151. currentItem = currentItem.Substring(0,currentItem.Length - 12);
  152.  
  153. foreach (string name in Names)
  154. {
  155. if (name == currentItem)
  156. try
  157. {
  158. string fileName = name.Substring(name.LastIndexOf('\\') + 1);
  159. if (renameCheck == true)
  160. {
  161. Jtag.xbCon.SendFile(AppDomain.CurrentDomain.BaseDirectory + name, @"HDD:\" + fileName);
  162. progressBarX1.Value = 100;
  163. MessageBox.Show("Sent KV Successfully", "Success");
  164. progressBarX1.Value = 100;
  165. }
  166. else if (renameCheck == false)
  167. {
  168. Jtag.xbCon.SendFile(AppDomain.CurrentDomain.BaseDirectory + name, @"HDD:\KV.bin");
  169. progressBarX1.Value = 100;
  170. MessageBox.Show("Sent KV Successfully", "Success");
  171. }
  172. progressBarX1.Value = 0;
  173. }
  174. catch (Exception ex)
  175. {
  176. MessageBox.Show("Sorry, Sending the KV.bin file has failed\n" + ex);
  177. }
  178. }
  179. }
  180. else MessageBox.Show("Sorry, could not connect to console\nVerify your connection and try again","Error");
  181.  
  182. }
  183.  
  184. private static string checkNames(string item)
  185. {
  186. if (item.EndsWith(" is Banned"))
  187. {
  188. item = item.Substring(item.Length - 10, 10);
  189. }
  190. else if (item.EndsWith(" is Unbanned"))
  191. {
  192. item = item.Substring(item.Length - 12, 12);
  193. }
  194. return item;
  195. }
  196.  
  197.  
  198.  
  199. private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
  200. {
  201. }
  202.  
  203. private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
  204. {
  205. if (e.Index < 0) return;
  206. if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  207. e = new DrawItemEventArgs(e.Graphics,e.Font,e.Bounds,e.Index,e.State ^ DrawItemState.Selected,e.ForeColor,Color.DarkOrange);
  208. e.DrawBackground();
  209. e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault);
  210. e.DrawFocusRectangle();
  211. }
  212.  
  213. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  214. {
  215. if (checkBox1.Checked)
  216. renameCheck = false;
  217. else
  218. renameCheck = true;
  219. }
  220.  
  221. private void buttonX4_Click(object sender, EventArgs e)
  222. {
  223. Names.Clear();
  224. populatelistBox();
  225. }
  226. }
  227. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement