-
Notifications
You must be signed in to change notification settings - Fork 388
Implemented run as admin and randomize window title option #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ReClass.NET/Forms/MainForm.cs
Outdated
@@ -63,21 +63,25 @@ public MainForm() | |||
|
|||
InitializeComponent(); | |||
|
|||
Text = $"{Constants.ApplicationName} ({Constants.Platform})"; | |||
string randomWindowTitle = Utils.RandomString(Program.GlobalRandom.Next(15, 20)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace the three changes with a single (inline) method? Possible implementation:
void SetWindowTitle(string extra = null)
{
var title = $"{(Program.Settings.RandomizeWindowTitle ? Utils.RandomString(Program.GlobalRandom.Next(15, 20)) : Constants.ApplicationName)} ({Constants.Platform})";
if (!string.IsNullOrEmpty(extra))
{
title += $" - {extra}";
}
Text = title;
}
ReClass.NET/Forms/SettingsForm.cs
Outdated
|
||
if (runAsAdminCheckBox.Checked && !WinUtil.IsAdministrator) | ||
{ | ||
var msgboxResult = MessageBox.Show("Would you like to restart ReClass.NET as administrator now?", "ReClass.NET", MessageBoxButtons.YesNo, MessageBoxIcon.Information); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just notify the user that he has to restart ReClass to apply the change. This would remove the logic code from the settings form.
ReClass.NET/Program.cs
Outdated
@@ -66,6 +67,12 @@ static void Main(string[] args) | |||
Settings = SettingsSerializer.Load(); | |||
Logger = new GuiLogger(); | |||
|
|||
if(Settings.RunAsAdmin && !WinUtil.IsAdministrator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add NativeMethods.IsUnix()
. Otherwise this will fail on unix systems.
ReClass.NET/Forms/SettingsForm.cs
Outdated
@@ -149,5 +152,20 @@ private void SetTypedefinitionBindings() | |||
SetBinding(utf16TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf16Text)); | |||
SetBinding(functionPtrTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeFunctionPtr)); | |||
} | |||
|
|||
private void runAsAdminCheckBox_CheckedChanged(object sender, EventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the checkboxes should be disabled if NativeMethods.IsUnix()
.
Thank you for the changes! |
only thing im not sure about is using MainForm.Close for leaving the checkbox event