public LoginGUI() { InitializeComponent(); this.FormClosing += (o, x) => { if (username.Text.Length > 0 && password.Text.Length > 0) { settings.Update("username", username.Text); settings.Update("password", password.Text); settings.Update("remember", rememberCredentials.Checked); } if (rememberCredentials.Checked) { settings.writeOPT(); } }; if (settings.GetBool("remember")) { username.Text = settings.GetString("username"); password.Text = settings.GetString("password"); rememberCredentials.Checked = settings.GetBool("remember"); } }
static void Main(string[] args) { Output.Splash(); Console.Write("Loading settings from config.opt..."); settings.Start(); Output.Write(new Message() { Lines = new List <string>() { "[OK]" }, ForeColors = new List <ConsoleColor>() { ConsoleColor.Green } }); Console.WriteLine("\t- {0} settings loaded!", settings.Count); if (settings.GetString("client.path") == "0") { Console.WriteLine("This appears to be your first start! You must configure me!"); Configure(); settings.Write(); } if (settings.GetBool("backups")) { Console.WriteLine("Reminder: Backups are currently on."); } Console.Write("Starting the File Manager..."); FileManager.Start(); Output.Write(new Message() { Lines = new List <string>() { "[OK]" }, ForeColors = new List <ConsoleColor>() { ConsoleColor.Green } }); if (settings.GetBool("auto.load")) { loadIndex(); } else { Console.WriteLine("Would you like to load your data.000 now?"); if (Input.YesNo) { loadIndex(); } } wait(); }
public ClientPackets() { debug = OPT.GetBool("debug"); // Loads PacketsDb PacketsDb = new Dictionary <ushort, PacketAction>(); #region Client Packets PacketsDb.Add(0x0001, CS_RequestUpdateDateTime); PacketsDb.Add(0x0002, CS_RequestSelfUpdate); PacketsDb.Add(0x0008, CS_RequestUpdatesDisabled); PacketsDb.Add(0x0010, CS_RequestDataUpdateIndex); PacketsDb.Add(0x0110, CS_RequestResourceUpdateIndex); PacketsDb.Add(0x0040, CS_RequestSendType); PacketsDb.Add(0x0041, CS_RequestFileSize); PacketsDb.Add(0x0042, CS_RequestFileTransfer); PacketsDb.Add(0x0030, CS_RequestArguments); PacketsDb.Add(0x0100, CS_RequestValidation); PacketsDb.Add(0x00DC, CS_RequestDisconnect); PacketsDb.Add(0x0999, CS_RequestAuthenticationType); PacketsDb.Add(0x9999, CS_RequestDesKey); #endregion #region Updater Packets PacketsDb.Add(0x1000, US_RequestLauncherInfo); PacketsDb.Add(0x1100, US_RequestLauncherDownload); #endregion }
private void GUI_Shown(object sender, EventArgs e) { OPT.Load(); StructureManager.Load(); CreateTab(TabStyle.RDB, "tab_0", "<Uknown>"); useASCIIBtn.Checked = OPT.GetBool("use.ascii"); }
/// <summary> /// Triggered when a client tries to connect /// </summary> /// <param name="ar"></param> private void AcceptCallback(IAsyncResult ar) { Socket listener = (Socket)ar.AsyncState; Socket socket = listener.EndAccept(ar); // Starts to accept another connection listener.BeginAccept(new AsyncCallback(AcceptCallback), listener); Client client = new Client(socket); if (OPT.GetBool("debug")) { Output.Write(new Message() { Text = string.Format("Client [{0}] connected from: {1} [{2}]", client.Id, client.Ip, client.Port), AddBreak = true }); } ClientManager.Instance.Add(client); socket.BeginReceive( client.Buffer, 0, PacketStream.MaxBuffer, SocketFlags.None, new AsyncCallback(ReadCallback), client ); }
private void ts_save_w_ascii_Click(object sender, EventArgs e) { bool newVal = OPT.GetBool("rdb.use.ascii") ? false : true; OPT.Update("rdb.use.ascii", Convert.ToInt32(newVal).ToString()); ts_save_w_ascii.Checked = newVal; lManager.Enter(Logs.Sender.RDB, Logs.Level.NOTICE, "Save With ASCII: {0} for tab: {1}", (newVal) ? "Enabled" : "Disabled", tManager.Text); }
private void initializeCore() { bool backup = OPT.GetBool("data.backup"); int codepage = OPT.GetInt("data.encoding"); Encoding encoding = Encoding.GetEncoding(codepage); core = new Core(backup, encoding); hook_core_events(); }
public rdbTab(string key) { InitializeComponent(); this.key = key; gridUtil = new Utilities.Grid(); ts_save_enc.Checked = OPT.GetBool("rdb.save.hashed"); ts_save_w_ascii.Checked = OPT.GetBool("rdb.use.ascii"); structsDir = OPT.GetString("rdb.structures.directory") ?? string.Format(@"{0}\Structures\", Directory.GetCurrentDirectory()); }
private void structureList_SelectedIndexChanged(object sender, EventArgs e) { if (RDBControls.StructureListIndex != -1) { if (OPT.GetBool("structure.autoload")) { loadStructure(); } } }
private void initializeCore() { bool backup = OPT.GetBool("data.backup"); int codepage = OPT.GetInt("data.encoding"); Encoding encoding = Encoding.GetEncoding(codepage); core = new Core(backup, encoding); core.CurrentMaxDetermined += Core_CurrentMaxDetermined; core.CurrentProgressChanged += Core_CurrentProgressChanged; core.CurrentProgressReset += Core_CurrentProgressReset; core.MessageOccured += Core_MessageOccured; }
public async void TS_File_New_Click(object sender, EventArgs e) { Paths.Description = "Please select a Dump Directory"; string dumpDirectory = Paths.FolderPath; if (Paths.FolderResult != DialogResult.OK) { return; } string buildDirectory = OPT.GetString("build.directory"); lManager.Enter(Logs.Sender.DATA, Logs.Level.NOTICE, "Building new client to:\n\t-{0}", buildDirectory); tab_disabled = true; await Task.Run(() => { try { core.Backups = false; core.BuildDataFiles(dumpDirectory, buildDirectory); } catch (Exception ex) { MessageBox.Show(ex.Message, "Build Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); lManager.Enter(Logs.Sender.DATA, Logs.Level.ERROR, ex); return; } finally { string msg = "Client build completed!"; MessageBox.Show(msg, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); lManager.Enter(Logs.Sender.DATA, Logs.Level.NOTICE, msg); if (OPT.GetBool("data.clear_on_create")) { core.Clear(); } else { display_data(); } core.Backups = true; } }); ts_status.Text = string.Empty; tab_disabled = false; }
public Item() { InitializeComponent(); imageList = new ImageList(); imageList.ImageSize = new Size(34, 34); bool backup = OPT.GetBool("data.backup"); int codepage = OPT.GetInt("data.encoding"); Encoding encoding = Encoding.GetEncoding(codepage); Core = new Core(backup, encoding); spr = new SPR(); loadCore(); itemList.LargeImageList = imageList; setEnums(); }
public ClientPackets() { debug = OPT.GetBool("debug"); // Loads PacketsDb PacketsDb = new Dictionary <ushort, PacketAction>(); #region Packets PacketsDb.Add(0x0001, CS_RequestUpdateDateTime); PacketsDb.Add(0x0002, CS_RequestSelfUpdate); PacketsDb.Add(0x0003, CS_RequestUpdater); PacketsDb.Add(0x0010, CS_RequestUpdateIndex); PacketsDb.Add(0x0040, CS_RequestSendType); PacketsDb.Add(0x0041, CS_RequestFileTransfer); PacketsDb.Add(0x0030, CS_RequestArguments); PacketsDb.Add(0x0100, CS_RequestValidation); PacketsDb.Add(0x00DC, CS_RequestDisconnect); PacketsDb.Add(0x9999, CS_RequestDesKey); #endregion }
/// <summary> /// Triggered when a client tries to connect /// </summary> /// <param name="ar"></param> private void AcceptCallback(IAsyncResult ar) { Socket listener = (Socket)ar.AsyncState; Socket socket = listener.EndAccept(ar); // Starts to accept another connection listener.BeginAccept(new AsyncCallback(AcceptCallback), listener); Client client = new Client(socket); if (OPT.GetBool("debug")) { Console.WriteLine("Client [{0}] connected from: {1} [{2}]", client.Id, client.Ip, client.Port); } clientList.Add(client); socket.BeginReceive( client.Buffer, 0, PacketStream.MaxBuffer, SocketFlags.None, new AsyncCallback(ReadCallback), client ); }
private async void saveFileBtn_Click(object sender, EventArgs e) { DataCore.Core dCore = new DataCore.Core(); if (RDBControls.GridRows > 0) { string savePath = OPT.GetString("save.directory"); if (string.IsNullOrEmpty(savePath)) { string structFileName = structFileName = string.Format(@"{0}.{1}", StructureManager.FileName(RDBControls.StructureListValue), rCore.Extension); string fileName = OPT.GetBool("save.hashed") ? dCore.EncodeName(structFileName) : structFileName; using (SaveFileDialog sfDlg = new SaveFileDialog() { Filter = "All files (*.*)|*.*|RDB files (*.rdb)|*.rdb|REF files (*.ref)|*.ref", Title = "Define the name of your rdb", FileName = fileName }) { if (sfDlg.ShowDialog(this) == DialogResult.OK) { if (!string.IsNullOrEmpty(sfDlg.FileName)) { savePath = sfDlg.FileName; } } } } else { savePath += GuessName.Result(RDBControls.StructureListValue, NameType.File); } if (!string.IsNullOrEmpty(savePath)) { await Task.Run(() => { rdbCores[tabIdx].WriteRDB(savePath); }); } } }
private void networkListenerMaintenance_Click(object sender, EventArgs e) { OPT.UpdateSetting("maintenance", (OPT.GetBool("maintenance") ? "0" : "1")); }