mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-30 02:42:54 +08:00
Fixed order of code in Program.cs causing exception from creating windows form before SetCompatibleTextRenderingDefault, changed dialog boxes a bit and cleaned up validation code in SelectFolderForm
This commit is contained in:
parent
d7938dd1d8
commit
d82c34c542
15
Program.cs
15
Program.cs
@ -14,12 +14,6 @@ namespace CodeWalker
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
// Always check the GTA folder first thing
|
|
||||||
if(!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Could not load CodeWalker because no GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menumode = false;
|
bool menumode = false;
|
||||||
bool explorermode = false;
|
bool explorermode = false;
|
||||||
@ -42,11 +36,18 @@ namespace CodeWalker
|
|||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
|
|
||||||
|
// Always check the GTA folder first thing
|
||||||
|
if (!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Could not load CodeWalker because no GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
if (menumode)
|
if (menumode)
|
||||||
{
|
{
|
||||||
Application.Run(new MenuForm());
|
Application.Run(new MenuForm());
|
||||||
}
|
}
|
||||||
|
@ -51,16 +51,12 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void OkButton_Click(object sender, EventArgs e)
|
private void OkButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(SelectedFolder))
|
if(!GTAFolder.ValidateGTAFolder(SelectedFolder, out string failReason))
|
||||||
{
|
{
|
||||||
MessageBox.Show("The folder \"" + SelectedFolder + "\" does not exist, or cannot be accessed. Please select another.");
|
MessageBox.Show("The selected folder could not be used:\n\n" + failReason, "Invalid GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!File.Exists(SelectedFolder + "\\gta5.exe"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("GTA5.exe not found in folder:\n" + SelectedFolder);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result = DialogResult.OK;
|
Result = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ namespace CodeWalker
|
|||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\n\n{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
|
var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\n\n{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
|
||||||
if(tryAgain == DialogResult.Retry)
|
if(tryAgain == DialogResult.Retry)
|
||||||
{
|
{
|
||||||
return UpdateGTAFolder(false);
|
return UpdateGTAFolder(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user