Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tool made by CamxxCore/iN1NJA
- // Mostly everything in Program.cs written by
- // the original maker of the XenonKerbAuthenticator tool. Full credit to him.
- // Credit to XeClutch for the XBDM send/ receive code
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using DevComponents.DotNetBar;
- using System.IO;
- using XRPCLib;
- using XDevkit;
- using System.Diagnostics;
- using System.Threading;
- namespace XenonKerbAuthenticator
- {
- public partial class Form1 : DevComponents.DotNetBar.Metro.MetroForm
- {
- private string[] subFiles;
- private bool renameCheck;
- IList<String> Names = new List<String>();
- XRPC Jtag = new XRPC();
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- populatelistBox();
- }
- private void populatelistBox()
- {
- listBox1.Items.Clear();
- string path = AppDomain.CurrentDomain.BaseDirectory + "KVs\\";
- string[] filesList = Directory.GetFiles(path);
- string[] directories = Directory.GetDirectories(path);
- foreach (string d in directories)
- {
- subFiles = Directory.GetFiles(d);
- foreach (string sub in subFiles)
- {
- if (!sub.EndsWith(".bin"))
- continue;
- else
- {
- int num1 = d.LastIndexOf('\\');
- int num2 = num1 > 0 ? sub.LastIndexOf('\\', num1 - 1) : -1;
- string subName = sub.Substring(num2 + 1);
- Names.Add(subName);
- listBox1.Items.Add(subName);
- }
- }
- }
- foreach (string s in filesList)
- {
- if (!s.EndsWith(".bin"))
- continue;
- else
- {
- int num1 = s.LastIndexOf('\\');
- int num2 = num1 > 0 ? s.LastIndexOf('\\', num1 - 1) : -1;
- string kvName = s.Substring(num2 + 1);
- Names.Add(kvName);
- listBox1.Items.Add(kvName);
- }
- }
- listBox1.SelectedIndex = 0;
- listBox1.Refresh();
- }
- private void progressBarStep()
- {
- progressBarX1.Step = 100 / Names.Count();
- progressBarX1.PerformStep();
- progressBarX1.Refresh();
- }
- private void buttonX1_Click(object sender, EventArgs e)
- {
- listBox1.Items.Clear();
- buttonX1.Enabled = false;
- buttonX4.Enabled = false;
- var instance = new Program();
- if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "KVs\\log.txt"))
- {
- File.Delete(AppDomain.CurrentDomain.BaseDirectory + "KVs\\log.txt");
- }
- ThreadPool.QueueUserWorkItem(new WaitCallback(doWork));
- }
- void doWork(object state)
- {
- var instance = new Program();
- string status;
- Invoke((MethodInvoker)((() => progressBarX1.Value = 0)));
- foreach (string name in Names)
- {
- instance.getStatus(name);
- if (instance.returnStatus() == false)
- {
- status = name + " is Unbanned";
- Invoke((MethodInvoker)(() => listBox1.Items.Add(status)));
- Invoke((MethodInvoker)(() => listBox1.Refresh()));
- }
- else
- {
- status = name + " is Banned";
- Invoke((MethodInvoker)(() => listBox1.Items.Add(status)));
- Invoke((MethodInvoker)(() => listBox1.Refresh()));
- }
- Invoke((MethodInvoker)(() => progressBarStep()));
- Invoke((MethodInvoker)(() => progressBarX1.Refresh()));
- }
- Invoke((MethodInvoker)(() => progressBarX1.Value = 100));
- Invoke((MethodInvoker)(() => buttonX1.Enabled = true));
- Invoke((MethodInvoker)(() => buttonX4.Enabled = true));
- Invoke((MethodInvoker)(() => listBox1.SelectedIndex = 0));
- }
- private void buttonX2_Click_1(object sender, EventArgs e)
- {
- Jtag.Connect();
- if (Jtag.activeConnection)
- {
- string currentItem = listBox1.GetItemText(listBox1.SelectedItem);
- if (currentItem.EndsWith(" is Banned"))
- {
- currentItem = currentItem.Substring(0,currentItem.Length - 10);
- DialogResult result = MessageBox.Show(currentItem+ " is banned are you sure you want to send the file?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
- if (!(result == DialogResult.Yes))
- {return;}
- }
- if (currentItem.EndsWith(" is Unbanned"))
- currentItem = currentItem.Substring(0,currentItem.Length - 12);
- foreach (string name in Names)
- {
- if (name == currentItem)
- try
- {
- string fileName = name.Substring(name.LastIndexOf('\\') + 1);
- if (renameCheck == true)
- {
- Jtag.xbCon.SendFile(AppDomain.CurrentDomain.BaseDirectory + name, @"HDD:\" + fileName);
- progressBarX1.Value = 100;
- MessageBox.Show("Sent KV Successfully", "Success");
- progressBarX1.Value = 100;
- }
- else if (renameCheck == false)
- {
- Jtag.xbCon.SendFile(AppDomain.CurrentDomain.BaseDirectory + name, @"HDD:\KV.bin");
- progressBarX1.Value = 100;
- MessageBox.Show("Sent KV Successfully", "Success");
- }
- progressBarX1.Value = 0;
- }
- catch (Exception ex)
- {
- MessageBox.Show("Sorry, Sending the KV.bin file has failed\n" + ex);
- }
- }
- }
- else MessageBox.Show("Sorry, could not connect to console\nVerify your connection and try again","Error");
- }
- private static string checkNames(string item)
- {
- if (item.EndsWith(" is Banned"))
- {
- item = item.Substring(item.Length - 10, 10);
- }
- else if (item.EndsWith(" is Unbanned"))
- {
- item = item.Substring(item.Length - 12, 12);
- }
- return item;
- }
- private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
- {
- if (e.Index < 0) return;
- if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
- e = new DrawItemEventArgs(e.Graphics,e.Font,e.Bounds,e.Index,e.State ^ DrawItemState.Selected,e.ForeColor,Color.DarkOrange);
- e.DrawBackground();
- e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault);
- e.DrawFocusRectangle();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox1.Checked)
- renameCheck = false;
- else
- renameCheck = true;
- }
- private void buttonX4_Click(object sender, EventArgs e)
- {
- Names.Clear();
- populatelistBox();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement