mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-21 22:42:54 +08:00
Added GTA V folder check to main entry point in Program.cs, improved folder selection dialog
- Added bool app setting for remember GTA folder (vs. prompt every start) - Added checkbox to folder selection dialog for remember GTA folder - Changed folder selection dialog to fixed dialog window border - Set default Enter/Esc buttons on folder selection dialog
This commit is contained in:
parent
9f91e34b5a
commit
d7938dd1d8
@ -193,6 +193,9 @@
|
||||
<setting name="MouseInvert" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="RememberGTAFolder" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</CodeWalker.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
@ -59,7 +59,9 @@ namespace CodeWalker
|
||||
|
||||
InitFileTypes();
|
||||
|
||||
/*if (!EnsureGTAFolder())*/
|
||||
// This is probably not necessary now that the GTA folder is checked
|
||||
// in the Program.cs when the game is initiated, but we will leave it
|
||||
// here for now to make sure
|
||||
if(!GTAFolder.UpdateGTAFolder(true))
|
||||
{
|
||||
Close();
|
||||
|
@ -14,6 +14,12 @@ namespace CodeWalker
|
||||
[STAThread]
|
||||
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 explorermode = false;
|
||||
|
14
Properties/Settings.Designer.cs
generated
14
Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace CodeWalker.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -698,5 +698,17 @@ namespace CodeWalker.Properties {
|
||||
this["MouseInvert"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool RememberGTAFolder {
|
||||
get {
|
||||
return ((bool)(this["RememberGTAFolder"]));
|
||||
}
|
||||
set {
|
||||
this["RememberGTAFolder"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,5 +183,8 @@
|
||||
<Setting Name="MouseInvert" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="RememberGTAFolder" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
19
SelectFolderForm.Designer.cs
generated
19
SelectFolderForm.Designer.cs
generated
@ -35,6 +35,7 @@
|
||||
this.FolderTextBox = new System.Windows.Forms.TextBox();
|
||||
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.CancelButt = new System.Windows.Forms.Button();
|
||||
this.RememberFolderCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OkButton
|
||||
@ -81,6 +82,7 @@
|
||||
// CancelButt
|
||||
//
|
||||
this.CancelButt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelButt.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelButt.Location = new System.Drawing.Point(238, 78);
|
||||
this.CancelButt.Name = "CancelButt";
|
||||
this.CancelButt.Size = new System.Drawing.Size(75, 23);
|
||||
@ -89,17 +91,33 @@
|
||||
this.CancelButt.UseVisualStyleBackColor = true;
|
||||
this.CancelButt.Click += new System.EventHandler(this.CancelButton_Click);
|
||||
//
|
||||
// RememberFolderCheckbox
|
||||
//
|
||||
this.RememberFolderCheckbox.AutoSize = true;
|
||||
this.RememberFolderCheckbox.Location = new System.Drawing.Point(12, 82);
|
||||
this.RememberFolderCheckbox.Name = "RememberFolderCheckbox";
|
||||
this.RememberFolderCheckbox.Size = new System.Drawing.Size(134, 17);
|
||||
this.RememberFolderCheckbox.TabIndex = 66;
|
||||
this.RememberFolderCheckbox.Text = "Remember GTA Folder";
|
||||
this.RememberFolderCheckbox.UseVisualStyleBackColor = true;
|
||||
this.RememberFolderCheckbox.CheckedChanged += new System.EventHandler(this.RememberFolderCheckbox_CheckedChanged);
|
||||
//
|
||||
// SelectFolderForm
|
||||
//
|
||||
this.AcceptButton = this.OkButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.CancelButt;
|
||||
this.ClientSize = new System.Drawing.Size(406, 113);
|
||||
this.Controls.Add(this.RememberFolderCheckbox);
|
||||
this.Controls.Add(this.CancelButt);
|
||||
this.Controls.Add(this.OkButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.FolderBrowseButton);
|
||||
this.Controls.Add(this.FolderTextBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(422, 152);
|
||||
this.Name = "SelectFolderForm";
|
||||
this.Text = "Select GTAV folder - CodeWalker by dexyfex";
|
||||
@ -117,5 +135,6 @@
|
||||
private System.Windows.Forms.TextBox FolderTextBox;
|
||||
private System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog;
|
||||
private System.Windows.Forms.Button CancelButt;
|
||||
private System.Windows.Forms.CheckBox RememberFolderCheckbox;
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ namespace CodeWalker
|
||||
private void SelectFolderForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
RememberFolderCheckbox.Checked = Settings.Default.RememberGTAFolder;
|
||||
}
|
||||
|
||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||
@ -63,5 +64,10 @@ namespace CodeWalker
|
||||
Result = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void RememberFolderCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.Default.RememberGTAFolder = RememberFolderCheckbox.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ namespace CodeWalker
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\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.Warning, MessageBoxDefaultButton.Button1);
|
||||
if(tryAgain == DialogResult.Retry)
|
||||
{
|
||||
return UpdateGTAFolder(false);
|
||||
|
31
WorldForm.cs
31
WorldForm.cs
@ -226,38 +226,11 @@ namespace CodeWalker
|
||||
|
||||
MouseWheel += WorldForm_MouseWheel;
|
||||
|
||||
string fldr = Settings.Default.GTAFolder;
|
||||
if (string.IsNullOrEmpty(fldr) || !Directory.Exists(fldr))
|
||||
if (!GTAFolder.UpdateGTAFolder(true))
|
||||
{
|
||||
SelectFolderForm f = new SelectFolderForm();
|
||||
f.ShowDialog();
|
||||
if (f.Result == DialogResult.OK)
|
||||
{
|
||||
fldr = f.SelectedFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
//MessageBox.Show("No GTAV folder was chosen. CodeWalker will now exit.");
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(fldr))
|
||||
{
|
||||
MessageBox.Show("The specified folder does not exist:\n" + fldr);
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(fldr + "\\gta5.exe"))
|
||||
{
|
||||
MessageBox.Show("GTA5.exe not found in folder:\n" + fldr);
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.Default.GTAFolder = fldr; //seems ok, save it for later
|
||||
|
||||
|
||||
Widget.Position = new Vector3(1.0f, 10.0f, 100.0f);
|
||||
Widget.Rotation = Quaternion.Identity;
|
||||
@ -3889,7 +3862,7 @@ namespace CodeWalker
|
||||
|
||||
try
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); //now loads from magic
|
||||
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); //now loads from magic
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user