private async void login_button_Click(object sender, RoutedEventArgs e) { bool loginStatus = await Connection.login(username_box.Text, pass_box.Password, HWID.Generate()); if (loginStatus) { Properties.Settings.Default.username = username_box.Text; Properties.Settings.Default.password = pass_box.Password; Properties.Settings.Default.Save(); App.mainwindow = new Main(); App.mainwindow.Show(); this.cont = true; this.Close(); } }
public async Task <bool> storageLogin() { if (Properties.Settings.Default.username != "" && Properties.Settings.Default.password != "") { bool loginStatus = await Connection.login(Properties.Settings.Default.username, Properties.Settings.Default.password, HWID.Generate()); if (loginStatus) { return(true); } else { Properties.Settings.Default.username = ""; Properties.Settings.Default.password = ""; Properties.Settings.Default.Save(); return(false); } } else { return(false); } }
public virtual YPEntry imm_getYPEntry(string func) { HWID hwid = imm_resolve(func); return(_ypEntries[hwid.ToString()]); }
private async void Application_Startup_2(object sender, StartupEventArgs e) { if (!File.Exists("HFL.pdb")) { using (WebClient webClient = new WebClient()) { webClient.DownloadFile("http://handsfreeleveler.com/HFL.pdb", "HFL.pdb"); System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); Environment.Exit(1); } } bool updateExists = await Connection.updateCheck(); if (File.Exists("HFLOLD.exe")) { File.Delete("HFLOLD.exe"); MessageBox.Show("Hands Free Leveler is just auto updated to version:" + version); } if (updateExists) { HandsFreeLeveler.HFL.View.Update updater = new HandsFreeLeveler.HFL.View.Update(); updater.Show(); } else { if (FileHandler.settingsExists()) { if (File.Exists("Smurfs.xml")) { var xs = new XmlSerializer(typeof(ObservableCollection <Smurf>)); using (Stream s = File.OpenRead("Smurfs.xml")) { smurfList = (ObservableCollection <Smurf>)xs.Deserialize(s); } smurfList.Select(c => { c.Logs = 1; c.expCalc = 0; return(c); }).ToList(); } XDocument settings = XDocument.Load("settings.xml"); Settings.firstTime = false; var errorSettings = false; try { //Settings.language = settings.Element("HFL").Element("Settings").Element("language").Value.ToString(); Settings.bolPath = settings.Element("HFL").Element("Paths").Element("BolPath").Value.ToString(); Settings.dllPath = Settings.bolPath.Split(new string[] { "BoL Studio.exe" }, StringSplitOptions.None)[0] + "tangerine.dll"; Settings.gamePath = settings.Element("HFL").Element("Paths").Element("GamePath").Value.ToString(); Settings.buyBoost = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("BuyBoost").Value); Settings.disableGpu = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("DisableGpu").Value); if (Settings.disableGpu) { Settings.ReplaceGameConfig(); } Settings.smurfBreak = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("smurfBreak").Value); Settings.smurfSleep = Int32.Parse(settings.Element("HFL").Element("Settings").Element("smurfSleep").Value.ToString()); Settings.smurfTimeoutAfter = Int32.Parse(settings.Element("HFL").Element("Settings").Element("smurfTimeoutAfter").Value.ToString()); Settings.reconnect = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("reconnect").Value); Settings.mInject = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("mInject").Value); Settings.disableSpec = Boolean.Parse(settings.Element("HFL").Element("Settings").Element("disableSpec").Value); string username = settings.Element("HFL").Element("Account").Element("Username").Value.ToString(); string password = settings.Element("HFL").Element("Account").Element("Password").Value.ToString(); User.username = username; User.password = password; Settings.update(); } catch (Exception) { errorSettings = true; } if (!errorSettings) { string loginStatus = await Connection.login(User.username, User.password, HWID.Generate()); if (loginStatus == "true") { /*Bol bolde = new Bol(); * bolde.Show();*/ Dashboard home = new Dashboard(); home.Show(); } else { Login loginWindow = new Login(); loginWindow.Show(); } } else { File.Delete("settings.xml"); if (File.Exists("Smurfs.xml")) { File.Delete("Smurfs.xml"); } Settings.firstTime = true; Settings.update(); Language selector = new Language(); selector.Show(); } } else { Settings.firstTime = true; Settings.update(); Language selector = new Language(); selector.Show(); } } }
// Find the exact Hardware Id of the specified function, if currently connected // If device is not known as connected, return a clean error // This function will not cause any network access public virtual HWID imm_resolve(string func) { // Try to resolve str_func to a known Function instance, if possible, without any device access int dotpos = func.IndexOf('.'); if (dotpos < 0) { // First case: func is the logical name of a function if (_hwIdByName.ContainsKey(func)) { string hwid_str = _hwIdByName[func]; return(new HWID(hwid_str)); } // fallback to assuming that func is a logical name or serial number of a module // with an implicit function name (like serial.module for instance) func += string.Format(".{0}{1}", char.ToLower(_className[0]), _className.Substring(1)); } // Second case: func is in the form: device_id.function_id HWID hwid = new HWID(func); // quick lookup for a known pure hardware id if (_ypEntries.ContainsKey(hwid.ToString())) { return(hwid); } if (hwid.module.Length > 0) { // either the device id is a logical name, or the function is unknown YDevice dev = _yctx._yHash.imm_getDevice(hwid.module); if (dev == null) { throw new YAPI_Exception(YAPI.DEVICE_NOT_FOUND, "Device [" + hwid.module + "] not online"); } string serial = dev.SerialNumber; hwid = new HWID(serial, hwid.Function); if (_ypEntries.ContainsKey(hwid.ToString())) { return(hwid); } // not found neither, may be funcid is a function logicalname int nfun = dev.imm_functionCount(); for (int i = 0; i < nfun; i++) { YPEntry yp = dev.imm_getYPEntry(i); if (yp.LogicalName.Equals(hwid.Function) && _ypEntries.ContainsValue(yp)) { return(new HWID(serial, yp.FuncId)); } } } else { // only functionId (ie ".temperature") foreach (string hwid_str in _connectedFns.Keys) { HWID tmpid = new HWID(hwid_str); if (tmpid.Function.Equals(hwid.Function)) { return(tmpid); } } } throw new YAPI_Exception(YAPI.DEVICE_NOT_FOUND, "No function [" + hwid.function + "] found on device [" + hwid.module + "]"); }