mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-08-19 08:29:19 +08:00
Merge pull request #10 from pnwparksfan/GTA_Folder_Management_Dev
Refactored and organized management of GTA folder
This commit is contained in:
commit
7a8e8702a0
@ -125,7 +125,7 @@ Special thanks to:
|
|||||||
-- Neodymium -- tgascoigne -- CamxxCore --
|
-- Neodymium -- tgascoigne -- CamxxCore --
|
||||||
-- Tadden -- Gramz -- Kai -- Vertigo -- HL -- Pouaichh --
|
-- Tadden -- Gramz -- Kai -- Vertigo -- HL -- Pouaichh --
|
||||||
-- Dilapidated -- dav90 -- Neos7 -- Jevi -- sollaholla --
|
-- Dilapidated -- dav90 -- Neos7 -- Jevi -- sollaholla --
|
||||||
-- The .White team -- CP -- Kilian --</value>
|
-- The .White team -- CP -- Kilian -- PNWParksFan --</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
@ -193,6 +193,9 @@
|
|||||||
<setting name="MouseInvert" serializeAs="String">
|
<setting name="MouseInvert" serializeAs="String">
|
||||||
<value>False</value>
|
<value>False</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="RememberGTAFolder" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</CodeWalker.Properties.Settings>
|
</CodeWalker.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
@ -41,9 +41,9 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
RpfMan = new RpfManager();
|
RpfMan = new RpfManager();
|
||||||
RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, UpdateStatus, false, false);
|
RpfMan.Init(GTAFolder.CurrentGTAFolder, UpdateStatus, UpdateStatus, false, false);
|
||||||
RPFScanComplete();
|
RPFScanComplete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
BrowseForm.Designer.cs
generated
2
BrowseForm.Designer.cs
generated
@ -128,9 +128,9 @@
|
|||||||
//
|
//
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(90, 6);
|
this.FolderTextBox.Location = new System.Drawing.Point(90, 6);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||||
this.FolderTextBox.TabIndex = 1;
|
this.FolderTextBox.TabIndex = 1;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// ScanButton
|
// ScanButton
|
||||||
//
|
//
|
||||||
|
@ -55,7 +55,7 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
DataHexLineCombo.Text = "16";
|
DataHexLineCombo.Text = "16";
|
||||||
|
|
||||||
DataTextBox.SetTabStopWidth(3);
|
DataTextBox.SetTabStopWidth(3);
|
||||||
@ -64,7 +64,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateStatus("Ready to scan...");
|
UpdateStatus("Ready to scan...");
|
||||||
}
|
}
|
||||||
@ -82,19 +82,10 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScanButton_Click(object sender, EventArgs e)
|
private void ScanButton_Click(object sender, EventArgs e)
|
||||||
|
1
CodeWalker Menu.cmd
Normal file
1
CodeWalker Menu.cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
start codewalker menu
|
@ -395,6 +395,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utils\Cache.cs" />
|
<Compile Include="Utils\Cache.cs" />
|
||||||
<Compile Include="Utils\DDSIO.cs" />
|
<Compile Include="Utils\DDSIO.cs" />
|
||||||
|
<Compile Include="Utils\GTAFolder.cs" />
|
||||||
<Compile Include="Utils\InputUtils.cs" />
|
<Compile Include="Utils\InputUtils.cs" />
|
||||||
<Compile Include="Utils\MapUtils.cs" />
|
<Compile Include="Utils\MapUtils.cs" />
|
||||||
<Compile Include="Utils\Matrices.cs" />
|
<Compile Include="Utils\Matrices.cs" />
|
||||||
|
@ -59,7 +59,10 @@ namespace CodeWalker
|
|||||||
|
|
||||||
InitFileTypes();
|
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();
|
Close();
|
||||||
return;
|
return;
|
||||||
@ -70,7 +73,7 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -241,44 +244,6 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EnsureGTAFolder()
|
|
||||||
{
|
|
||||||
string fldr = Settings.Default.GTAFolder;
|
|
||||||
if (string.IsNullOrEmpty(fldr) || !Directory.Exists(fldr))
|
|
||||||
{
|
|
||||||
if (!ChangeGTAFolder())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
fldr = Settings.Default.GTAFolder;
|
|
||||||
}
|
|
||||||
if (!Directory.Exists(fldr))
|
|
||||||
{
|
|
||||||
MessageBox.Show("The specified folder does not exist:\n" + fldr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!File.Exists(fldr + "\\gta5.exe"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("GTA5.exe not found in folder:\n" + fldr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Settings.Default.GTAFolder = fldr; //seems ok, save it for later
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private bool ChangeGTAFolder()
|
|
||||||
{
|
|
||||||
SelectFolderForm f = new SelectFolderForm();
|
|
||||||
f.ShowDialog();
|
|
||||||
if (f.Result == DialogResult.OK)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = f.SelectedFolder;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void UpdateStatus(string text)
|
public void UpdateStatus(string text)
|
||||||
@ -313,13 +278,6 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string GetRootPath()
|
|
||||||
{
|
|
||||||
var path = Settings.Default.GTAFolder;
|
|
||||||
return path.EndsWith("\\") ? path : path + "\\";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Navigate(MainTreeFolder f)
|
public void Navigate(MainTreeFolder f)
|
||||||
{
|
{
|
||||||
if (!Ready) return;
|
if (!Ready) return;
|
||||||
@ -596,15 +554,14 @@ namespace CodeWalker
|
|||||||
|
|
||||||
ClearMainTreeView();
|
ClearMainTreeView();
|
||||||
|
|
||||||
var path = Settings.Default.GTAFolder;
|
string fullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
var replpath = path.EndsWith("\\") ? path : path + "\\";
|
|
||||||
|
|
||||||
string[] allfiles = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
string[] allfiles = Directory.GetFiles(GTAFolder.CurrentGTAFolder, "*", SearchOption.AllDirectories);
|
||||||
|
|
||||||
Dictionary<string, MainTreeFolder> nodes = new Dictionary<string, MainTreeFolder>();
|
Dictionary<string, MainTreeFolder> nodes = new Dictionary<string, MainTreeFolder>();
|
||||||
|
|
||||||
MainTreeFolder root = new MainTreeFolder();
|
MainTreeFolder root = new MainTreeFolder();
|
||||||
root.FullPath = GetRootPath();
|
root.FullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
root.Path = "";
|
root.Path = "";
|
||||||
root.Name = "GTA V";
|
root.Name = "GTA V";
|
||||||
RootFolder = root;
|
RootFolder = root;
|
||||||
@ -613,7 +570,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
foreach (var filepath in allfiles)
|
foreach (var filepath in allfiles)
|
||||||
{
|
{
|
||||||
var relpath = filepath.Replace(replpath, "");
|
var relpath = filepath.Replace(fullPath, "");
|
||||||
var filepathl = filepath.ToLowerInvariant();
|
var filepathl = filepath.ToLowerInvariant();
|
||||||
|
|
||||||
UpdateStatus("Scanning " + relpath + "...");
|
UpdateStatus("Scanning " + relpath + "...");
|
||||||
@ -629,7 +586,7 @@ namespace CodeWalker
|
|||||||
var exists = nodes.TryGetValue(parentpath, out node);
|
var exists = nodes.TryGetValue(parentpath, out node);
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
node = CreateRootDirTreeFolder(parentname, parentpath, replpath + parentpath);
|
node = CreateRootDirTreeFolder(parentname, parentpath, fullPath + parentpath);
|
||||||
nodes[parentpath] = node;
|
nodes[parentpath] = node;
|
||||||
}
|
}
|
||||||
if (parentnode == null)
|
if (parentnode == null)
|
||||||
@ -703,7 +660,7 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
private void RecurseMainTreeViewRPF(MainTreeFolder f, List<RpfFile> allRpfs)
|
private void RecurseMainTreeViewRPF(MainTreeFolder f, List<RpfFile> allRpfs)
|
||||||
{
|
{
|
||||||
var rootpath = GetRootPath();
|
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
|
|
||||||
var fld = f.RpfFolder;
|
var fld = f.RpfFolder;
|
||||||
if (fld != null)
|
if (fld != null)
|
||||||
@ -2026,7 +1983,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
|
|
||||||
string relpath = (CurrentFolder.Path ?? "") + "\\" + fname;
|
string relpath = (CurrentFolder.Path ?? "") + "\\" + fname;
|
||||||
var rootpath = GetRootPath();
|
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
string fullpath = rootpath + relpath;
|
string fullpath = rootpath + relpath;
|
||||||
|
|
||||||
RpfDirectoryEntry newdir = null;
|
RpfDirectoryEntry newdir = null;
|
||||||
@ -2103,7 +2060,7 @@ namespace CodeWalker
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//adding a new RPF in the filesystem
|
//adding a new RPF in the filesystem
|
||||||
newrpf = RpfFile.CreateNew(Settings.Default.GTAFolder, relpath, encryption);
|
newrpf = RpfFile.CreateNew(GTAFolder.CurrentGTAFolder, relpath, encryption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -2115,7 +2072,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
if (newrpf != null)
|
if (newrpf != null)
|
||||||
{
|
{
|
||||||
var node = CreateRpfTreeFolder(newrpf, newrpf.Path, GetRootPath() + newrpf.Path);
|
var node = CreateRpfTreeFolder(newrpf, newrpf.Path, GTAFolder.GetCurrentGTAFolderWithTrailingSlash() + newrpf.Path);
|
||||||
RecurseMainTreeViewRPF(node, AllRpfs);
|
RecurseMainTreeViewRPF(node, AllRpfs);
|
||||||
AddNewFolderTreeNode(node);
|
AddNewFolderTreeNode(node);
|
||||||
}
|
}
|
||||||
@ -2284,7 +2241,7 @@ namespace CodeWalker
|
|||||||
if (newrpf != null)
|
if (newrpf != null)
|
||||||
{
|
{
|
||||||
//an RPF file was imported. add its structure to the UI!
|
//an RPF file was imported. add its structure to the UI!
|
||||||
var rootpath = GetRootPath();
|
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
var tnf = CreateRpfTreeFolder(newrpf, newrpf.Path, rootpath + newrpf.Path);
|
var tnf = CreateRpfTreeFolder(newrpf, newrpf.Path, rootpath + newrpf.Path);
|
||||||
if (CurrentFolder.Children != null)
|
if (CurrentFolder.Children != null)
|
||||||
{
|
{
|
||||||
@ -2324,7 +2281,7 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
if (MainListView.SelectedIndices.Count == 0)
|
if (MainListView.SelectedIndices.Count == 0)
|
||||||
{
|
{
|
||||||
Clipboard.SetText(CurrentFolder?.FullPath ?? GetRootPath());
|
Clipboard.SetText(CurrentFolder?.FullPath ?? GTAFolder.GetCurrentGTAFolderWithTrailingSlash());
|
||||||
}
|
}
|
||||||
else if (MainListView.SelectedIndices.Count == 1)
|
else if (MainListView.SelectedIndices.Count == 1)
|
||||||
{
|
{
|
||||||
@ -2985,7 +2942,7 @@ namespace CodeWalker
|
|||||||
private void TreeContextWinExplorerMenu_Click(object sender, EventArgs e)
|
private void TreeContextWinExplorerMenu_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var folder = MainTreeView.SelectedNode?.Tag as MainTreeFolder;
|
var folder = MainTreeView.SelectedNode?.Tag as MainTreeFolder;
|
||||||
var path = folder?.FullPath ?? GetRootPath();
|
var path = folder?.FullPath ?? GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
ShowInExplorer(path);
|
ShowInExplorer(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3288,7 +3245,7 @@ namespace CodeWalker
|
|||||||
if (ListItems == null)
|
if (ListItems == null)
|
||||||
{
|
{
|
||||||
ListItems = new List<MainListItem>();
|
ListItems = new List<MainListItem>();
|
||||||
var rootpath = ExploreForm.GetRootPath();
|
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
|
|
||||||
if (Children != null)
|
if (Children != null)
|
||||||
{
|
{
|
||||||
@ -3350,7 +3307,7 @@ namespace CodeWalker
|
|||||||
resultcount++;
|
resultcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootpath = ExploreForm.GetRootPath();
|
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||||
|
|
||||||
if (Files != null)
|
if (Files != null)
|
||||||
{
|
{
|
||||||
|
2
ExtractKeysForm.Designer.cs
generated
2
ExtractKeysForm.Designer.cs
generated
@ -77,9 +77,9 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(98, 25);
|
this.FolderTextBox.Location = new System.Drawing.Point(98, 25);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(345, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(345, 20);
|
||||||
this.FolderTextBox.TabIndex = 57;
|
this.FolderTextBox.TabIndex = 57;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// StatusLabel
|
// StatusLabel
|
||||||
//
|
//
|
||||||
|
@ -26,11 +26,11 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void ExtractKeysForm_Load(object sender, EventArgs e)
|
private void ExtractKeysForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateStatus("Keys loaded. Nothing to do here!");
|
UpdateStatus("Keys loaded. Nothing to do here!");
|
||||||
}
|
}
|
||||||
@ -41,20 +41,11 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
ExeTextBox.Text = FolderTextBox.Text + "\\" + "GTA5.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
ExeTextBox.Text = GTAFolder.CurrentGTAFolder + @"\GTA5.exe";
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExeBrowseButton_Click(object sender, EventArgs e)
|
private void ExeBrowseButton_Click(object sender, EventArgs e)
|
||||||
|
2
ExtractRawForm.Designer.cs
generated
2
ExtractRawForm.Designer.cs
generated
@ -127,9 +127,9 @@
|
|||||||
//
|
//
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(91, 12);
|
this.FolderTextBox.Location = new System.Drawing.Point(91, 12);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||||
this.FolderTextBox.TabIndex = 64;
|
this.FolderTextBox.TabIndex = 64;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
|
@ -26,12 +26,12 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void ExtractRawForm_Load(object sender, EventArgs e)
|
private void ExtractRawForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
OutputFolderTextBox.Text = Settings.Default.ExtractedRawFilesFolder;
|
OutputFolderTextBox.Text = Settings.Default.ExtractedRawFilesFolder;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateExtractStatus("Ready to extract.");
|
UpdateExtractStatus("Ready to extract.");
|
||||||
}
|
}
|
||||||
@ -58,11 +58,6 @@ namespace CodeWalker
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings.Default.ExtractedRawFilesFolder = OutputFolderTextBox.Text;
|
Settings.Default.ExtractedRawFilesFolder = OutputFolderTextBox.Text;
|
||||||
@ -70,12 +65,8 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
|
2
ExtractScriptsForm.Designer.cs
generated
2
ExtractScriptsForm.Designer.cs
generated
@ -188,9 +188,9 @@
|
|||||||
//
|
//
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(98, 26);
|
this.FolderTextBox.Location = new System.Drawing.Point(98, 26);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||||
this.FolderTextBox.TabIndex = 42;
|
this.FolderTextBox.TabIndex = 42;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// ExtractScriptsForm
|
// ExtractScriptsForm
|
||||||
//
|
//
|
||||||
|
@ -28,12 +28,12 @@ namespace CodeWalker
|
|||||||
private void ExtractForm_Load(object sender, EventArgs e)
|
private void ExtractForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DumpTextBox.Text = Settings.Default.GTAExeDumpFile;
|
DumpTextBox.Text = Settings.Default.GTAExeDumpFile;
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
OutputFolderTextBox.Text = Settings.Default.CompiledScriptFolder;
|
OutputFolderTextBox.Text = Settings.Default.CompiledScriptFolder;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateDumpStatus("Ready.");
|
UpdateDumpStatus("Ready.");
|
||||||
UpdateExtractStatus("Ready to extract.");
|
UpdateExtractStatus("Ready to extract.");
|
||||||
@ -49,11 +49,6 @@ namespace CodeWalker
|
|||||||
Settings.Default.GTAExeDumpFile = DumpTextBox.Text;
|
Settings.Default.GTAExeDumpFile = DumpTextBox.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings.Default.CompiledScriptFolder = OutputFolderTextBox.Text;
|
Settings.Default.CompiledScriptFolder = OutputFolderTextBox.Text;
|
||||||
@ -61,12 +56,8 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
|
1
ExtractShadersForm.Designer.cs
generated
1
ExtractShadersForm.Designer.cs
generated
@ -127,6 +127,7 @@
|
|||||||
//
|
//
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(93, 12);
|
this.FolderTextBox.Location = new System.Drawing.Point(93, 12);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||||
this.FolderTextBox.TabIndex = 64;
|
this.FolderTextBox.TabIndex = 64;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||||
|
@ -26,12 +26,12 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void ExtractShadersForm_Load(object sender, EventArgs e)
|
private void ExtractShadersForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
OutputFolderTextBox.Text = Settings.Default.ExtractedShadersFolder;
|
OutputFolderTextBox.Text = Settings.Default.ExtractedShadersFolder;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateExtractStatus("Ready to extract.");
|
UpdateExtractStatus("Ready to extract.");
|
||||||
}
|
}
|
||||||
@ -41,10 +41,7 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
private void FolderTextBox_TextChanged(object sender, EventArgs e){}
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -53,12 +50,8 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
|
2
ExtractTexForm.Designer.cs
generated
2
ExtractTexForm.Designer.cs
generated
@ -118,9 +118,9 @@
|
|||||||
//
|
//
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(90, 6);
|
this.FolderTextBox.Location = new System.Drawing.Point(90, 6);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||||
this.FolderTextBox.TabIndex = 55;
|
this.FolderTextBox.TabIndex = 55;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// AbortButton
|
// AbortButton
|
||||||
//
|
//
|
||||||
|
@ -27,12 +27,12 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void ExtractTexForm_Load(object sender, EventArgs e)
|
private void ExtractTexForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
OutputFolderTextBox.Text = Settings.Default.ExtractedTexturesFolder;
|
OutputFolderTextBox.Text = Settings.Default.ExtractedTexturesFolder;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
KeysLoaded = true;
|
KeysLoaded = true;
|
||||||
UpdateExtractStatus("Ready to extract.");
|
UpdateExtractStatus("Ready to extract.");
|
||||||
}
|
}
|
||||||
@ -42,11 +42,6 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings.Default.ExtractedTexturesFolder = OutputFolderTextBox.Text;
|
Settings.Default.ExtractedTexturesFolder = OutputFolderTextBox.Text;
|
||||||
@ -54,12 +49,8 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
|
@ -117,9 +117,6 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="FolderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
@ -149,7 +149,7 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
||||||
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
||||||
else if ((FilePath.ToLowerInvariant().StartsWith(Settings.Default.GTAFolder.ToLowerInvariant()))) saveAs = true;
|
else if ((FilePath.ToLowerInvariant().StartsWith(GTAFolder.CurrentGTAFolder.ToLowerInvariant()))) saveAs = true;
|
||||||
if (!File.Exists(FilePath)) saveAs = true;
|
if (!File.Exists(FilePath)) saveAs = true;
|
||||||
|
|
||||||
var fn = FilePath;
|
var fn = FilePath;
|
||||||
|
@ -137,38 +137,11 @@ namespace CodeWalker.Forms
|
|||||||
|
|
||||||
MouseWheel += ModelForm_MouseWheel;
|
MouseWheel += ModelForm_MouseWheel;
|
||||||
|
|
||||||
string fldr = Settings.Default.GTAFolder;
|
if (!GTAFolder.UpdateGTAFolder(true))
|
||||||
if (string.IsNullOrEmpty(fldr) || !Directory.Exists(fldr))
|
|
||||||
{
|
{
|
||||||
SelectFolderForm f = new SelectFolderForm();
|
|
||||||
f.ShowDialog();
|
|
||||||
if (f.Result == DialogResult.OK)
|
|
||||||
{
|
|
||||||
fldr = f.SelectedFolder;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Directory.Exists(fldr))
|
|
||||||
{
|
|
||||||
MessageBox.Show("The specified folder does not exist:\n" + fldr);
|
|
||||||
Close();
|
Close();
|
||||||
return;
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MetaName[] texsamplers = RenderableGeometry.GetTextureSamplerList();
|
MetaName[] texsamplers = RenderableGeometry.GetTextureSamplerList();
|
||||||
foreach (var texsampler in texsamplers)
|
foreach (var texsampler in texsamplers)
|
||||||
|
@ -130,7 +130,7 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
||||||
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
||||||
else if ((FilePath.ToLowerInvariant().StartsWith(Settings.Default.GTAFolder.ToLowerInvariant()))) saveAs = true;
|
else if ((FilePath.ToLowerInvariant().StartsWith(GTAFolder.CurrentGTAFolder.ToLowerInvariant()))) saveAs = true;
|
||||||
if (!File.Exists(FilePath)) saveAs = true;
|
if (!File.Exists(FilePath)) saveAs = true;
|
||||||
|
|
||||||
var fn = FilePath;
|
var fn = FilePath;
|
||||||
|
@ -155,7 +155,7 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
if (string.IsNullOrEmpty(FileName)) saveAs = true;
|
||||||
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
if (string.IsNullOrEmpty(FilePath)) saveAs = true;
|
||||||
else if ((FilePath.ToLowerInvariant().StartsWith(Settings.Default.GTAFolder.ToLowerInvariant()))) saveAs = true;
|
else if ((FilePath.ToLowerInvariant().StartsWith(GTAFolder.CurrentGTAFolder.ToLowerInvariant()))) saveAs = true;
|
||||||
if (!File.Exists(FilePath)) saveAs = true;
|
if (!File.Exists(FilePath)) saveAs = true;
|
||||||
|
|
||||||
var fn = FilePath;
|
var fn = FilePath;
|
||||||
|
@ -121,7 +121,7 @@ namespace CodeWalker.GameFiles
|
|||||||
RpfMan = new RpfManager();
|
RpfMan = new RpfManager();
|
||||||
RpfMan.ExcludePaths = GetExcludePaths();
|
RpfMan.ExcludePaths = GetExcludePaths();
|
||||||
RpfMan.EnableMods = EnableMods;
|
RpfMan.EnableMods = EnableMods;
|
||||||
RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, ErrorLog);//, true);
|
RpfMan.Init(GTAFolder.CurrentGTAFolder, UpdateStatus, ErrorLog);//, true);
|
||||||
|
|
||||||
//RE test area!
|
//RE test area!
|
||||||
//DecodeRelFiles();
|
//DecodeRelFiles();
|
||||||
|
@ -36,7 +36,7 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder);
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder);
|
||||||
GameFileCache gfc = new GameFileCache();
|
GameFileCache gfc = new GameFileCache();
|
||||||
gfc.DoFullStringIndex = true;
|
gfc.DoFullStringIndex = true;
|
||||||
gfc.Init(UpdateStatus, UpdateStatus);
|
gfc.Init(UpdateStatus, UpdateStatus);
|
||||||
|
@ -36,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 valid 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());
|
||||||
}
|
}
|
||||||
|
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.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 {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
@ -698,5 +698,17 @@ namespace CodeWalker.Properties {
|
|||||||
this["MouseInvert"] = value;
|
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">
|
<Setting Name="MouseInvert" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">False</Value>
|
<Value Profile="(Default)">False</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="RememberGTAFolder" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
19
SelectFolderForm.Designer.cs
generated
19
SelectFolderForm.Designer.cs
generated
@ -35,6 +35,7 @@
|
|||||||
this.FolderTextBox = new System.Windows.Forms.TextBox();
|
this.FolderTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||||
this.CancelButt = new System.Windows.Forms.Button();
|
this.CancelButt = new System.Windows.Forms.Button();
|
||||||
|
this.RememberFolderCheckbox = new System.Windows.Forms.CheckBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// OkButton
|
// OkButton
|
||||||
@ -81,6 +82,7 @@
|
|||||||
// CancelButt
|
// CancelButt
|
||||||
//
|
//
|
||||||
this.CancelButt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
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.Location = new System.Drawing.Point(238, 78);
|
||||||
this.CancelButt.Name = "CancelButt";
|
this.CancelButt.Name = "CancelButt";
|
||||||
this.CancelButt.Size = new System.Drawing.Size(75, 23);
|
this.CancelButt.Size = new System.Drawing.Size(75, 23);
|
||||||
@ -89,17 +91,33 @@
|
|||||||
this.CancelButt.UseVisualStyleBackColor = true;
|
this.CancelButt.UseVisualStyleBackColor = true;
|
||||||
this.CancelButt.Click += new System.EventHandler(this.CancelButton_Click);
|
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
|
// SelectFolderForm
|
||||||
//
|
//
|
||||||
|
this.AcceptButton = this.OkButton;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.CancelButton = this.CancelButt;
|
||||||
this.ClientSize = new System.Drawing.Size(406, 113);
|
this.ClientSize = new System.Drawing.Size(406, 113);
|
||||||
|
this.Controls.Add(this.RememberFolderCheckbox);
|
||||||
this.Controls.Add(this.CancelButt);
|
this.Controls.Add(this.CancelButt);
|
||||||
this.Controls.Add(this.OkButton);
|
this.Controls.Add(this.OkButton);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.FolderBrowseButton);
|
this.Controls.Add(this.FolderBrowseButton);
|
||||||
this.Controls.Add(this.FolderTextBox);
|
this.Controls.Add(this.FolderTextBox);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MaximizeBox = false;
|
||||||
this.MinimumSize = new System.Drawing.Size(422, 152);
|
this.MinimumSize = new System.Drawing.Size(422, 152);
|
||||||
this.Name = "SelectFolderForm";
|
this.Name = "SelectFolderForm";
|
||||||
this.Text = "Select GTAV folder - CodeWalker by dexyfex";
|
this.Text = "Select GTAV folder - CodeWalker by dexyfex";
|
||||||
@ -117,5 +135,6 @@
|
|||||||
private System.Windows.Forms.TextBox FolderTextBox;
|
private System.Windows.Forms.TextBox FolderTextBox;
|
||||||
private System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog;
|
private System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog;
|
||||||
private System.Windows.Forms.Button CancelButt;
|
private System.Windows.Forms.Button CancelButt;
|
||||||
|
private System.Windows.Forms.CheckBox RememberFolderCheckbox;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,8 @@ namespace CodeWalker
|
|||||||
|
|
||||||
private void SelectFolderForm_Load(object sender, EventArgs e)
|
private void SelectFolderForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
|
RememberFolderCheckbox.Checked = Settings.Default.RememberGTAFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
@ -50,18 +51,19 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RememberFolderCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Settings.Default.RememberGTAFolder = RememberFolderCheckbox.Checked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
SettingsForm.Designer.cs
generated
28
SettingsForm.Designer.cs
generated
@ -32,6 +32,7 @@
|
|||||||
this.MainTabControl = new System.Windows.Forms.TabControl();
|
this.MainTabControl = new System.Windows.Forms.TabControl();
|
||||||
this.ControlsTabPage = new System.Windows.Forms.TabPage();
|
this.ControlsTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.MouseInvertCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
@ -79,8 +80,6 @@
|
|||||||
this.DoneButton = new System.Windows.Forms.Button();
|
this.DoneButton = new System.Windows.Forms.Button();
|
||||||
this.SaveButton = new System.Windows.Forms.Button();
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
this.ResetButton = new System.Windows.Forms.Button();
|
this.ResetButton = new System.Windows.Forms.Button();
|
||||||
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
|
||||||
this.MouseInvertCheckBox = new System.Windows.Forms.CheckBox();
|
|
||||||
this.MainTabControl.SuspendLayout();
|
this.MainTabControl.SuspendLayout();
|
||||||
this.ControlsTabPage.SuspendLayout();
|
this.ControlsTabPage.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
@ -140,6 +139,17 @@
|
|||||||
this.groupBox2.TabStop = false;
|
this.groupBox2.TabStop = false;
|
||||||
this.groupBox2.Text = "Mouse settings";
|
this.groupBox2.Text = "Mouse settings";
|
||||||
//
|
//
|
||||||
|
// MouseInvertCheckBox
|
||||||
|
//
|
||||||
|
this.MouseInvertCheckBox.AutoSize = true;
|
||||||
|
this.MouseInvertCheckBox.Location = new System.Drawing.Point(240, 55);
|
||||||
|
this.MouseInvertCheckBox.Name = "MouseInvertCheckBox";
|
||||||
|
this.MouseInvertCheckBox.Size = new System.Drawing.Size(118, 17);
|
||||||
|
this.MouseInvertCheckBox.TabIndex = 9;
|
||||||
|
this.MouseInvertCheckBox.Text = "Invert mouse Y axis";
|
||||||
|
this.MouseInvertCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
this.MouseInvertCheckBox.CheckedChanged += new System.EventHandler(this.MouseInvertCheckBox_CheckedChanged);
|
||||||
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
this.label4.AutoSize = true;
|
this.label4.AutoSize = true;
|
||||||
@ -739,9 +749,9 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.FolderTextBox.Location = new System.Drawing.Point(110, 28);
|
this.FolderTextBox.Location = new System.Drawing.Point(110, 28);
|
||||||
this.FolderTextBox.Name = "FolderTextBox";
|
this.FolderTextBox.Name = "FolderTextBox";
|
||||||
|
this.FolderTextBox.ReadOnly = true;
|
||||||
this.FolderTextBox.Size = new System.Drawing.Size(303, 20);
|
this.FolderTextBox.Size = new System.Drawing.Size(303, 20);
|
||||||
this.FolderTextBox.TabIndex = 48;
|
this.FolderTextBox.TabIndex = 48;
|
||||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
|
||||||
//
|
//
|
||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
@ -785,17 +795,6 @@
|
|||||||
this.ResetButton.UseVisualStyleBackColor = true;
|
this.ResetButton.UseVisualStyleBackColor = true;
|
||||||
this.ResetButton.Click += new System.EventHandler(this.ResetButton_Click);
|
this.ResetButton.Click += new System.EventHandler(this.ResetButton_Click);
|
||||||
//
|
//
|
||||||
// MouseInvertCheckBox
|
|
||||||
//
|
|
||||||
this.MouseInvertCheckBox.AutoSize = true;
|
|
||||||
this.MouseInvertCheckBox.Location = new System.Drawing.Point(240, 55);
|
|
||||||
this.MouseInvertCheckBox.Name = "MouseInvertCheckBox";
|
|
||||||
this.MouseInvertCheckBox.Size = new System.Drawing.Size(118, 17);
|
|
||||||
this.MouseInvertCheckBox.TabIndex = 9;
|
|
||||||
this.MouseInvertCheckBox.Text = "Invert mouse Y axis";
|
|
||||||
this.MouseInvertCheckBox.UseVisualStyleBackColor = true;
|
|
||||||
this.MouseInvertCheckBox.CheckedChanged += new System.EventHandler(this.MouseInvertCheckBox_CheckedChanged);
|
|
||||||
//
|
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -857,7 +856,6 @@
|
|||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
private System.Windows.Forms.Button FolderBrowseButton;
|
private System.Windows.Forms.Button FolderBrowseButton;
|
||||||
private System.Windows.Forms.TextBox FolderTextBox;
|
private System.Windows.Forms.TextBox FolderTextBox;
|
||||||
private System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog;
|
|
||||||
private System.Windows.Forms.Label label8;
|
private System.Windows.Forms.Label label8;
|
||||||
private System.Windows.Forms.NumericUpDown ShadowCascadesUpDown;
|
private System.Windows.Forms.NumericUpDown ShadowCascadesUpDown;
|
||||||
private System.Windows.Forms.Label label7;
|
private System.Windows.Forms.Label label7;
|
||||||
|
@ -71,7 +71,7 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
private void LoadAdvancedSettings()
|
private void LoadAdvancedSettings()
|
||||||
{
|
{
|
||||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
ExcludeFoldersTextBox.Text = Settings.Default.ExcludeFolders;
|
ExcludeFoldersTextBox.Text = Settings.Default.ExcludeFolders;
|
||||||
ShadowCascadesUpDown.Value = Settings.Default.ShadowCascades;
|
ShadowCascadesUpDown.Value = Settings.Default.ShadowCascades;
|
||||||
CacheSizeUpDown.Value = Math.Min(Math.Max(Settings.Default.CacheSize / 1048576, CacheSizeUpDown.Minimum), CacheSizeUpDown.Maximum);
|
CacheSizeUpDown.Value = Math.Min(Math.Max(Settings.Default.CacheSize / 1048576, CacheSizeUpDown.Minimum), CacheSizeUpDown.Maximum);
|
||||||
@ -270,21 +270,10 @@ namespace CodeWalker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
GTAFolder.UpdateGTAFolder(false);
|
||||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||||
if (res == DialogResult.OK)
|
|
||||||
{
|
|
||||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExcludeFoldersTextBox_TextChanged(object sender, EventArgs e)
|
private void ExcludeFoldersTextBox_TextChanged(object sender, EventArgs e)
|
||||||
|
@ -117,9 +117,6 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="FolderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
98
Utils/GTAFolder.cs
Normal file
98
Utils/GTAFolder.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using CodeWalker.Properties;
|
||||||
|
|
||||||
|
namespace CodeWalker
|
||||||
|
{
|
||||||
|
public static class GTAFolder
|
||||||
|
{
|
||||||
|
public static string CurrentGTAFolder { get; private set; } = Settings.Default.GTAFolder;
|
||||||
|
|
||||||
|
public static bool ValidateGTAFolder(string folder, out string failReason)
|
||||||
|
{
|
||||||
|
failReason = "";
|
||||||
|
|
||||||
|
if(string.IsNullOrWhiteSpace(folder))
|
||||||
|
{
|
||||||
|
failReason = "No folder specified";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Directory.Exists(folder))
|
||||||
|
{
|
||||||
|
failReason = $"Folder \"{folder}\" does not exist";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!File.Exists(folder + @"\gta5.exe"))
|
||||||
|
{
|
||||||
|
failReason = $"GTA5.exe not found in folder \"{folder}\"";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ValidateGTAFolder(string folder) => ValidateGTAFolder(folder, out string reason);
|
||||||
|
|
||||||
|
public static bool IsCurrentGTAFolderValid() => ValidateGTAFolder(CurrentGTAFolder);
|
||||||
|
|
||||||
|
public static bool UpdateGTAFolder(bool UseCurrentIfValid = false)
|
||||||
|
{
|
||||||
|
if(UseCurrentIfValid && IsCurrentGTAFolderValid())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
string origFolder = CurrentGTAFolder;
|
||||||
|
string folder = CurrentGTAFolder;
|
||||||
|
SelectFolderForm f = new SelectFolderForm();
|
||||||
|
f.ShowDialog();
|
||||||
|
if(f.Result == DialogResult.OK && Directory.Exists(f.SelectedFolder))
|
||||||
|
{
|
||||||
|
folder = f.SelectedFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
string failReason;
|
||||||
|
if(ValidateGTAFolder(folder, out failReason))
|
||||||
|
{
|
||||||
|
SetGTAFolder(folder);
|
||||||
|
if(folder != origFolder)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Successfully changed GTA Folder to \"{folder}\"", "Set GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} 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.Question, MessageBoxDefaultButton.Button1);
|
||||||
|
if(tryAgain == DialogResult.Retry)
|
||||||
|
{
|
||||||
|
return UpdateGTAFolder(false);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool SetGTAFolder(string folder)
|
||||||
|
{
|
||||||
|
if(ValidateGTAFolder(folder))
|
||||||
|
{
|
||||||
|
CurrentGTAFolder = folder;
|
||||||
|
Settings.Default.GTAFolder = folder;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetCurrentGTAFolderWithTrailingSlash() =>CurrentGTAFolder.EndsWith(@"\") ? CurrentGTAFolder : CurrentGTAFolder + @"\";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
31
WorldForm.cs
31
WorldForm.cs
@ -226,38 +226,11 @@ namespace CodeWalker
|
|||||||
|
|
||||||
MouseWheel += WorldForm_MouseWheel;
|
MouseWheel += WorldForm_MouseWheel;
|
||||||
|
|
||||||
string fldr = Settings.Default.GTAFolder;
|
if (!GTAFolder.UpdateGTAFolder(true))
|
||||||
if (string.IsNullOrEmpty(fldr) || !Directory.Exists(fldr))
|
|
||||||
{
|
{
|
||||||
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();
|
Close();
|
||||||
return;
|
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.Position = new Vector3(1.0f, 10.0f, 100.0f);
|
||||||
Widget.Rotation = Quaternion.Identity;
|
Widget.Rotation = Quaternion.Identity;
|
||||||
@ -3889,7 +3862,7 @@ namespace CodeWalker
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); //now loads from magic
|
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); //now loads from magic
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user