mirror of
https://github.com/JuniorDark/RustyHearts-Launcher.git
synced 2026-05-07 13:31:45 -04:00
Extended the localization system to easily include additional languages in the future
This commit is contained in:
parent
d5ec712d0f
commit
ae34584021
50 changed files with 45079 additions and 24129 deletions
11
RHLauncher.LauncherForm/LauncherForm.Designer.cs
generated
11
RHLauncher.LauncherForm/LauncherForm.Designer.cs
generated
|
|
@ -67,6 +67,7 @@
|
|||
InstallButton = new Button();
|
||||
InstallPanel = new Panel();
|
||||
UninstallButton = new Button();
|
||||
notifyIcon = new NotifyIcon(components);
|
||||
((System.ComponentModel.ISupportInitialize)CharPictureBox).BeginInit();
|
||||
getUpdatePanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)webView21).BeginInit();
|
||||
|
|
@ -667,6 +668,13 @@
|
|||
UninstallButton.MouseLeave += MenuButton_MouseLeave;
|
||||
UninstallButton.MouseHover += MenuButton_MouseHover;
|
||||
//
|
||||
// notifyIcon
|
||||
//
|
||||
notifyIcon.Icon = (Icon)resources.GetObject("notifyIcon.Icon");
|
||||
notifyIcon.Text = "Rusty Hearts";
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.MouseClick += notifyIcon_MouseClick;
|
||||
//
|
||||
// LauncherForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
|
|
@ -698,6 +706,7 @@
|
|||
FormClosing += LauncherForm_FormClosing;
|
||||
Load += LauncherForm_Load;
|
||||
MouseDown += OnMouseDown;
|
||||
Resize += LauncherForm_Resize;
|
||||
((System.ComponentModel.ISupportInitialize)CharPictureBox).EndInit();
|
||||
getUpdatePanel.ResumeLayout(false);
|
||||
getUpdatePanel.PerformLayout();
|
||||
|
|
@ -736,7 +745,6 @@
|
|||
private Button LaunchOptionsButton;
|
||||
private ImageList imageListLaunchOpt;
|
||||
private Panel LaunchPanel;
|
||||
private Label CheckUpdateLabel;
|
||||
private Button CheckUpdateButton;
|
||||
private ImageList imageListMenuButton;
|
||||
private Button LogoutButton;
|
||||
|
|
@ -749,5 +757,6 @@
|
|||
private Button OpenSettingsButton;
|
||||
private ImageList imageListStopBtn;
|
||||
private Button StopButton;
|
||||
private NotifyIcon notifyIcon;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,9 +22,8 @@ namespace RHLauncher
|
|||
public partial class LauncherForm : Form
|
||||
{
|
||||
private RegistryHandler registryHandler = new();
|
||||
private readonly CancellationTokenSource? cancellationTokenSource;
|
||||
public string? installDirectory;
|
||||
private static readonly string DefaultIniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini");
|
||||
private static readonly string DefaultIniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.ini");
|
||||
private readonly IniFile _iniFile = new(DefaultIniFilePath);
|
||||
private readonly string _windyCode;
|
||||
private readonly string _password;
|
||||
|
|
@ -44,7 +43,17 @@ namespace RHLauncher
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
notifyIcon.Text = LocalizedStrings.RustyHearts;
|
||||
Text = LocalizedStrings.LauncherFormTitle;
|
||||
LabelNews.Text = LocalizedStrings.LabelNews;
|
||||
InstallButton.Text = LocalizedStrings.InstallLocation;
|
||||
UninstallButton.Text = LocalizedStrings.Uninstall;
|
||||
OpenSettingsButton.Text = LocalizedStrings.GameSettings;
|
||||
CheckUpdateButton.Text = LocalizedStrings.CheckUpdate;
|
||||
OpenInstallDirButton.Text = LocalizedStrings.OpenInstallDir;
|
||||
ManageButton.Text = LocalizedStrings.Manage;
|
||||
ChangePwdButton.Text = LocalizedStrings.ChangePassword;
|
||||
LogoutButton.Text = LocalizedStrings.Logout;
|
||||
|
||||
_windyCode = windyCode;
|
||||
_password = password;
|
||||
|
|
@ -70,7 +79,7 @@ namespace RHLauncher
|
|||
}
|
||||
else
|
||||
{
|
||||
var updater = new ServiceFileHandler("config.ini", installDirectory);
|
||||
ServiceFileHandler updater = new("Config.ini", installDirectory);
|
||||
updater.UpdateService();
|
||||
|
||||
await CheckForUpdates();
|
||||
|
|
@ -138,7 +147,6 @@ namespace RHLauncher
|
|||
LaunchButton.Enabled = true;
|
||||
LaunchButton.Click -= LaunchGameButton_Click;
|
||||
LaunchButton.Click += InstallUpdateButton_Click;
|
||||
|
||||
break;
|
||||
case UpdateState.NoUpdateAvailable:
|
||||
LaunchButton.Text = LocalizedStrings.Launch;
|
||||
|
|
@ -406,8 +414,16 @@ namespace RHLauncher
|
|||
};
|
||||
Process? process = Process.Start(startInfo);
|
||||
WindowState = FormWindowState.Minimized;
|
||||
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
{
|
||||
Hide();
|
||||
notifyIcon.Visible = true;
|
||||
}
|
||||
await process.WaitForExitAsync();
|
||||
WindowState = FormWindowState.Maximized;
|
||||
Show();
|
||||
WindowState = FormWindowState.Normal;
|
||||
notifyIcon.Visible = false;
|
||||
await CheckForUpdates();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -471,7 +487,7 @@ namespace RHLauncher
|
|||
}
|
||||
else
|
||||
{
|
||||
LoginForm newLoginForm = new LoginForm();
|
||||
LoginForm newLoginForm = new();
|
||||
newLoginForm.Show();
|
||||
Close();
|
||||
}
|
||||
|
|
@ -576,7 +592,7 @@ namespace RHLauncher
|
|||
changePwd.ShowDialog();
|
||||
}
|
||||
|
||||
private async void ChangePwd_FormClosing(object sender, FormClosingEventArgs e)
|
||||
private void ChangePwd_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (sender is ChangePwd changePwd)
|
||||
{
|
||||
|
|
@ -597,6 +613,25 @@ namespace RHLauncher
|
|||
|
||||
#region Button Events
|
||||
|
||||
private void LauncherForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
{
|
||||
notifyIcon.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyIcon_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
// Restore the form and hide the NotifyIcon when clicked
|
||||
Show();
|
||||
WindowState = FormWindowState.Normal;
|
||||
notifyIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuButton_MouseHover(object sender, EventArgs e)
|
||||
{
|
||||
Button button = (Button)sender;
|
||||
|
|
@ -698,6 +733,7 @@ namespace RHLauncher
|
|||
StopButton.ImageIndex = 2;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue