Implemented a custom theme with a new color scheme and extensively refined UI logic and architecture for improved modernity and consistency. Relocated and reworked numerous options (mount device, select device, share app, uninstall app, pull-to-desktop, filters, etc.), and updated all message boxes to use the new themed styling with enhanced visual polish. All message boxes now use custom themed styling with enhanced visual polish. Corrected grammatical or logical flaws across text, tooltips, and title updates throughout the application. Added smooth animations to left-side navigation / container elements. Fine-tuned sizing, positioning, and colors across numerous UI components. Enhanced GalleryView with proper favorites support including context menu integration, favorite border styling and favorite badge, as well as some bug fixes. Implemented custom modern ToggleSwitch component (iOS-like) with animations. Completely overhauled quest option and rookie option menus to utilize new toggle switches in modernized layouts. Refined sorting and installation status logic to streamline UX; rookie now also functions as an efficient installed-quest-app browser with easily accessible view/uninstall controls. Added WebView2.dll validation to ensure runtime dependencies exist. Re-implemented trailer option. GalleryView is now shown on very first launch, but rookie remembers your preferred view thereafter, so list-view users won't be bothered, while everyone still gets to see the new gallery view at least once. Gallery performance has also been validated on very-low-spec hardware and confirmed to run fine and fast there, due to numerous optimizations. Given the extensive scope of changes across this commit series for beta-2.35-yt, I believe this update represents a significant milestone warranting v3.0 designation. In my opinion these changes represent one of the most significant set of logical and visual changes and enhancements the rookie application has seen in years. Changes have been summarized in changelog.txt for update.
330 lines
12 KiB
C#
330 lines
12 KiB
C#
using AndroidSideloader.Utilities;
|
|
using JR.Utils.GUI.Forms;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AndroidSideloader
|
|
{
|
|
public partial class SettingsForm : Form
|
|
{
|
|
private static readonly SettingsManager _settings = SettingsManager.Instance;
|
|
|
|
public SettingsForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SettingsForm_Load(object sender, EventArgs e)
|
|
{
|
|
CenterToParent();
|
|
initSettings();
|
|
initToolTips();
|
|
}
|
|
|
|
private void initSettings()
|
|
{
|
|
// Use SetCheckedSilent to avoid triggering events during initialization
|
|
toggleCheckForUpdates.SetCheckedSilent(_settings.CheckForUpdates);
|
|
toggleMessageBoxes.SetCheckedSilent(_settings.EnableMessageBoxes);
|
|
toggleDeleteAfterInstall.SetCheckedSilent(_settings.DeleteAllAfterInstall);
|
|
toggleUpdateConfig.SetCheckedSilent(_settings.AutoUpdateConfig);
|
|
toggleUserJson.SetCheckedSilent(_settings.UserJsonOnGameInstall);
|
|
toggleNoDeviceMode.SetCheckedSilent(_settings.NodeviceMode);
|
|
toggleBMBF.SetCheckedSilent(_settings.BMBFChecked);
|
|
toggleAutoReinstall.SetCheckedSilent(_settings.AutoReinstall);
|
|
toggleSingleThread.SetCheckedSilent(_settings.SingleThreadMode);
|
|
toggleVirtualFilesystem.SetCheckedSilent(_settings.VirtualFilesystemCompatibility);
|
|
toggleUseDownloadedFiles.SetCheckedSilent(_settings.UseDownloadedFiles);
|
|
toggleTrailers.SetCheckedSilent(_settings.TrailersEnabled);
|
|
bandwidthLimitTextBox.Text = _settings.BandwidthLimit.ToString();
|
|
|
|
// Handle no device mode disabling delete after install
|
|
if (toggleNoDeviceMode.Checked)
|
|
{
|
|
toggleDeleteAfterInstall.SetCheckedSilent(false);
|
|
toggleDeleteAfterInstall.Enabled = false;
|
|
lblDeleteAfterInstall.ForeColor = System.Drawing.Color.FromArgb(100, 100, 100);
|
|
}
|
|
}
|
|
|
|
private void initToolTips()
|
|
{
|
|
ToolTip toolTip = new ToolTip();
|
|
toolTip.SetToolTip(toggleCheckForUpdates, "Check for available application updates on startup");
|
|
toolTip.SetToolTip(lblCheckForUpdates, "Check for available application updates on startup");
|
|
toolTip.SetToolTip(toggleMessageBoxes, "Show message boxes after every completed task");
|
|
toolTip.SetToolTip(lblMessageBoxes, "Show message boxes after every completed task");
|
|
toolTip.SetToolTip(toggleDeleteAfterInstall, "Delete game files after downloading and installing");
|
|
toolTip.SetToolTip(lblDeleteAfterInstall, "Delete game files after downloading and installing");
|
|
toolTip.SetToolTip(toggleUseDownloadedFiles, "Always install downloaded files without prompting to re-download");
|
|
toolTip.SetToolTip(lblUseDownloadedFiles, "Always install downloaded files without prompting to re-download");
|
|
toolTip.SetToolTip(toggleTrailers, "Show game trailers in the sidebar when selecting a game");
|
|
toolTip.SetToolTip(lblTrailers, "Show game trailers in the sidebar when selecting a game");
|
|
}
|
|
|
|
private void SaveAllSettings()
|
|
{
|
|
string input = bandwidthLimitTextBox.Text;
|
|
Regex regex = new Regex(@"^\d+(\.\d+)?$");
|
|
|
|
if (regex.IsMatch(input) && float.TryParse(input, out float bandwidthLimit))
|
|
{
|
|
_settings.BandwidthLimit = bandwidthLimit;
|
|
}
|
|
|
|
_settings.CheckForUpdates = toggleCheckForUpdates.Checked;
|
|
_settings.EnableMessageBoxes = toggleMessageBoxes.Checked;
|
|
_settings.DeleteAllAfterInstall = toggleDeleteAfterInstall.Checked;
|
|
_settings.AutoUpdateConfig = toggleUpdateConfig.Checked;
|
|
_settings.UserJsonOnGameInstall = toggleUserJson.Checked;
|
|
_settings.NodeviceMode = toggleNoDeviceMode.Checked;
|
|
_settings.BMBFChecked = toggleBMBF.Checked;
|
|
_settings.AutoReinstall = toggleAutoReinstall.Checked;
|
|
_settings.SingleThreadMode = toggleSingleThread.Checked;
|
|
_settings.VirtualFilesystemCompatibility = toggleVirtualFilesystem.Checked;
|
|
_settings.UseDownloadedFiles = toggleUseDownloadedFiles.Checked;
|
|
_settings.TrailersEnabled = toggleTrailers.Checked;
|
|
|
|
if (Program.form != null)
|
|
{
|
|
Program.form.SetTrailerVisibility(toggleTrailers.Checked);
|
|
}
|
|
|
|
if (_settings.AutoUpdateConfig)
|
|
{
|
|
_settings.CreatePubMirrorFile = true;
|
|
}
|
|
|
|
_settings.Save();
|
|
}
|
|
|
|
public void btnUploadDebug_click(object sender, EventArgs e)
|
|
{
|
|
if (File.Exists($"{_settings.CurrentLogPath}"))
|
|
{
|
|
string UUID = SideloaderUtilities.UUID();
|
|
string debugLogPath = $"{Environment.CurrentDirectory}\\{UUID}.log";
|
|
System.IO.File.Copy("debuglog.txt", debugLogPath);
|
|
|
|
Clipboard.SetText(UUID);
|
|
|
|
_ = RCLONE.runRcloneCommand_UploadConfig($"copy \"{debugLogPath}\" RSL-gameuploads:DebugLogs");
|
|
_ = MessageBox.Show($"Your debug log has been copied to the server. ID: {UUID}");
|
|
}
|
|
}
|
|
|
|
public void btnResetDebug_click(object sender, EventArgs e)
|
|
{
|
|
if (File.Exists($"{_settings.CurrentLogPath}"))
|
|
{
|
|
File.Delete($"{_settings.CurrentLogPath}");
|
|
}
|
|
|
|
if (File.Exists($"{Environment.CurrentDirectory}\\debuglog.txt"))
|
|
{
|
|
File.Delete($"{Environment.CurrentDirectory}\\debuglog.txt");
|
|
}
|
|
}
|
|
|
|
private void applyButton_Click(object sender, EventArgs e)
|
|
{
|
|
string input = bandwidthLimitTextBox.Text;
|
|
Regex regex = new Regex(@"^\d+(\.\d+)?$");
|
|
|
|
if (!regex.IsMatch(input) || !float.TryParse(input, out _))
|
|
{
|
|
MessageBox.Show("Please enter a valid number for the bandwidth limit.");
|
|
return;
|
|
}
|
|
|
|
SaveAllSettings();
|
|
this.Close();
|
|
}
|
|
|
|
private void toggleCheckForUpdates_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleUseDownloadedFiles_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleMessageBoxes_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleTrailers_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void resetSettingsButton_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void toggleDeleteAfterInstall_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleUpdateConfig_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleUserJson_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void SettingsForm_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar == (char)Keys.Escape)
|
|
{
|
|
Close();
|
|
}
|
|
}
|
|
|
|
private void SettingsForm_Leave(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void Form_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Escape)
|
|
{
|
|
Close();
|
|
}
|
|
}
|
|
|
|
protected override bool ProcessDialogKey(Keys keyData)
|
|
{
|
|
if (Form.ModifierKeys == Keys.None && keyData == Keys.Escape)
|
|
{
|
|
Close();
|
|
return true;
|
|
}
|
|
return base.ProcessDialogKey(keyData);
|
|
}
|
|
|
|
private void toggleNoDeviceMode_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Update UI state only - settings saved on form close
|
|
if (!toggleNoDeviceMode.Checked)
|
|
{
|
|
toggleDeleteAfterInstall.Checked = true;
|
|
toggleDeleteAfterInstall.Enabled = true;
|
|
lblDeleteAfterInstall.ForeColor = System.Drawing.Color.White;
|
|
}
|
|
else
|
|
{
|
|
toggleDeleteAfterInstall.SetCheckedSilent(false);
|
|
toggleDeleteAfterInstall.Enabled = false;
|
|
lblDeleteAfterInstall.ForeColor = System.Drawing.Color.FromArgb(100, 100, 100);
|
|
}
|
|
}
|
|
|
|
private void toggleBMBF_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleAutoReinstall_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleAutoReinstall_Click(object sender, EventArgs e)
|
|
{
|
|
if (toggleAutoReinstall.Checked)
|
|
{
|
|
DialogResult dialogResult = FlexibleMessageBox.Show(this,
|
|
"WARNING: This enables automatic reinstall when installs fail.\n\n" +
|
|
"Some games (less than 5%) don't allow access to their save data, " +
|
|
"which can lead to losing your progress.\n\n" +
|
|
"However, with this option enabled, you won't have to confirm reinstalls manually " +
|
|
"(ideal for queue installations).\n\n" +
|
|
"NOTE: If your USB/wireless ADB connection is slow, this may cause " +
|
|
"larger APK installations to fail.\n\nEnable anyway?",
|
|
"WARNING", MessageBoxButtons.OKCancel);
|
|
|
|
if (dialogResult == DialogResult.Cancel)
|
|
{
|
|
toggleAutoReinstall.SetCheckedSilent(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnOpenDebug_Click(object sender, EventArgs e)
|
|
{
|
|
if (File.Exists($"{Environment.CurrentDirectory}\\debuglog.txt"))
|
|
{
|
|
_ = Process.Start($"{Environment.CurrentDirectory}\\debuglog.txt");
|
|
}
|
|
}
|
|
|
|
private void setDownloadDirectory_Click(object sender, EventArgs e)
|
|
{
|
|
if (downloadDirectorySetter.ShowDialog() == DialogResult.OK)
|
|
{
|
|
_settings.CustomDownloadDir = true;
|
|
_settings.DownloadDir = downloadDirectorySetter.SelectedPath;
|
|
}
|
|
}
|
|
|
|
private void setBackupDirectory_Click(object sender, EventArgs e)
|
|
{
|
|
if (backupDirectorySetter.ShowDialog() == DialogResult.OK)
|
|
{
|
|
_settings.CustomBackupDir = true;
|
|
_settings.BackupDir = backupDirectorySetter.SelectedPath;
|
|
MainForm.backupFolder = _settings.BackupDir;
|
|
}
|
|
}
|
|
|
|
private void toggleSingleThread_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void toggleVirtualFilesystem_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// Settings saved on form close
|
|
}
|
|
|
|
private void openDownloadDirectory_Click(object sender, EventArgs e)
|
|
{
|
|
string pathToOpen = _settings.CustomDownloadDir ? _settings.DownloadDir : Environment.CurrentDirectory;
|
|
MainForm.OpenDirectory(pathToOpen);
|
|
}
|
|
|
|
private void openBackupDirectory_Click(object sender, EventArgs e)
|
|
{
|
|
string pathToOpen = _settings.CustomBackupDir
|
|
? Path.Combine(_settings.BackupDir, "Rookie Backups")
|
|
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Rookie Backups");
|
|
MainForm.OpenDirectory(pathToOpen);
|
|
}
|
|
|
|
private void bandwidthLimitTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
|
|
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
}
|
|
} |