private async Task <List <string> > GetUpdates() { var updateList = new List <string>(); var osbVersion = OSBotHelper.GetLocalBotVersion(); var osbLatestVersion = await GetOSBotVersion(); if (osbVersion == string.Empty || osbVersion != osbLatestVersion) { await DownloadFile(App.AppPath + "osbot.jar", $"{UpdatesHost}/api/osbotlatest"); } var request = await HttpHelper.GetRequest($"{UpdatesHost}/api/updates"); if (string.IsNullOrEmpty(request)) { return(updateList); } var files = request.Split (new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); if (files.Any()) { double ppToUp = Math.Ceiling((100 / (double)files.Length)); for (int i = 0; i < files.Length; i++) { var file = files[i].Split('|'); var path = (App.AppPath + file[0]); var hash = string.Empty; if (File.Exists(path)) { try { using (var sha1 = SHA1.Create()) using (var stream = File.OpenRead(path)) { hash = BitConverter.ToString(sha1.ComputeHash(stream)).Replace("-", "").ToLower(); } } catch { continue; } } if (hash != file[1]) { updateList.Add(file[0]); } // Update progress AddToProgressLine(ppToUp); } } return(updateList); }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { Log("RS Master 1.0.0"); Log("OSBot Version: " + (OSBotHelper.GetLocalBotVersion() ?? "Unknown")); Log("HWID: " + Util.GetHWID()); CheckJavaExists(); ShowLoginDialog(); }
private void LoadSettings() { Settings = Settings.GetSettings(); var osbotUserLocation = OSBotHelper.UserLocation; if (OSBotHelper.UserLocationExists() && string.IsNullOrEmpty(Settings.BotBaseLocation)) { Settings.BotBaseLocation = osbotUserLocation; TxtBoxBotLocation.PreviewMouseDown -= TxtBoxBotLocation_MouseDown; } // Set data contexts SettingsTab.DataContext = Settings; ClientOptionsTab.DataContext = Settings; }
private void CheckJavaExists() { if (OSBotHelper.JavaInPath()) { return; } if (!OSBotHelper.JavaInstalled()) { Log("Warning: Java doesn't seem to be installed on your system, please install it to ensure full functionality."); return; } var javaPath = OSBotHelper.GetJavaInstallPath(); if (javaPath != null) { OSBotHelper.SetJavaSystemPath(javaPath); Log("Notice: Java path was not set in your system env, automatically set."); } }
internal async Task LaunchAccount(AccountModel account, bool autoLaunch = false) { #region Validation if (!OSBotHelper.LocalBotExists()) { Log("Cannot find local OSBot Jar, please run updater to obtain the latest."); return; } if (Util.AnyStringNullOrEmpty (account.Username, account.Password, Settings.Username, Settings.Password)) { Log("Missing OSBot client or accounts details."); return; } #endregion if (account.ProxyEnabled != 0 && !string.IsNullOrEmpty(account.ProxyName)) { account.Proxy = Invoke(() => proxyListItems.FirstOrDefault(x => x.Alias == account.ProxyName)); } var result = await AccountManager.LaunchAccount(account, autoLaunch); if (result.success) { Log("Account launched!"); return; } #region Error Handling switch (result.errorCode) { case 2: if (!account.AutoLaunched) { var dialogResult = await ShowMessageDialog ("OSBot Client Update", "Your OSBot client is out of date, update now?"); if (dialogResult) { updatesRequest = true; Application.Current.Shutdown(); } } else { Log("Your OSBot client is out of date, please close the program and run updater."); } break; case 3: Log("Invalid OSBot client username or password!"); break; case 5: Log("Web Walking has been updated, please manually run osbot.jar and install it through Boot UI."); break; case 6: Log("Your OSBot account is banned, can't launch accounts."); break; default: Log("Launching account " + account.Username + " timed out!"); break; } #endregion }