mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-25 16:32:55 +08:00
Merging GTAFolder changes
This commit is contained in:
commit
375db771ee
@ -125,7 +125,7 @@ Special thanks to:
|
||||
-- Neodymium -- tgascoigne -- CamxxCore --
|
||||
-- Tadden -- Gramz -- Kai -- Vertigo -- HL -- Pouaichh --
|
||||
-- Dilapidated -- dav90 -- Neos7 -- Jevi -- sollaholla --
|
||||
-- The .White team -- CP -- Kilian --</value>
|
||||
-- The .White team -- CP -- Kilian -- PNWParksFan --</value>
|
||||
</data>
|
||||
<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">
|
||||
|
@ -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>
|
@ -43,7 +43,7 @@ namespace CodeWalker
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
RpfMan = new RpfManager();
|
||||
RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, UpdateStatus, false, false);
|
||||
RpfMan.Init(GTAFolder.CurrentGTAFolder, UpdateStatus, UpdateStatus, false, false);
|
||||
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.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||
this.FolderTextBox.TabIndex = 1;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// ScanButton
|
||||
//
|
||||
|
@ -55,7 +55,7 @@ namespace CodeWalker
|
||||
}
|
||||
}
|
||||
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
DataHexLineCombo.Text = "16";
|
||||
|
||||
DataTextBox.SetTabStopWidth(3);
|
||||
@ -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)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
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
|
@ -390,6 +390,7 @@
|
||||
<DependentUpon>TextInputForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\DDSIO.cs" />
|
||||
<Compile Include="Utils\GTAFolder.cs" />
|
||||
<Compile Include="Utils\InputUtils.cs" />
|
||||
<Compile Include="Utils\MapUtils.cs" />
|
||||
<Compile Include="Utils\TextureLoader.cs" />
|
||||
|
@ -59,7 +59,10 @@ 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();
|
||||
return;
|
||||
@ -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)
|
||||
@ -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)
|
||||
{
|
||||
if (!Ready) return;
|
||||
@ -596,15 +554,14 @@ namespace CodeWalker
|
||||
|
||||
ClearMainTreeView();
|
||||
|
||||
var path = Settings.Default.GTAFolder;
|
||||
var replpath = path.EndsWith("\\") ? path : path + "\\";
|
||||
string fullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
|
||||
string[] allfiles = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
string[] allfiles = Directory.GetFiles(GTAFolder.CurrentGTAFolder, "*", SearchOption.AllDirectories);
|
||||
|
||||
Dictionary<string, MainTreeFolder> nodes = new Dictionary<string, MainTreeFolder>();
|
||||
|
||||
MainTreeFolder root = new MainTreeFolder();
|
||||
root.FullPath = GetRootPath();
|
||||
root.FullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
root.Path = "";
|
||||
root.Name = "GTA V";
|
||||
RootFolder = root;
|
||||
@ -613,7 +570,7 @@ namespace CodeWalker
|
||||
|
||||
foreach (var filepath in allfiles)
|
||||
{
|
||||
var relpath = filepath.Replace(replpath, "");
|
||||
var relpath = filepath.Replace(fullPath, "");
|
||||
var filepathl = filepath.ToLowerInvariant();
|
||||
|
||||
UpdateStatus("Scanning " + relpath + "...");
|
||||
@ -629,7 +586,7 @@ namespace CodeWalker
|
||||
var exists = nodes.TryGetValue(parentpath, out node);
|
||||
if (!exists)
|
||||
{
|
||||
node = CreateRootDirTreeFolder(parentname, parentpath, replpath + parentpath);
|
||||
node = CreateRootDirTreeFolder(parentname, parentpath, fullPath + parentpath);
|
||||
nodes[parentpath] = node;
|
||||
}
|
||||
if (parentnode == null)
|
||||
@ -703,7 +660,7 @@ namespace CodeWalker
|
||||
}
|
||||
private void RecurseMainTreeViewRPF(MainTreeFolder f, List<RpfFile> allRpfs)
|
||||
{
|
||||
var rootpath = GetRootPath();
|
||||
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
|
||||
var fld = f.RpfFolder;
|
||||
if (fld != null)
|
||||
@ -2026,7 +1983,7 @@ namespace CodeWalker
|
||||
|
||||
|
||||
string relpath = (CurrentFolder.Path ?? "") + "\\" + fname;
|
||||
var rootpath = GetRootPath();
|
||||
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
string fullpath = rootpath + relpath;
|
||||
|
||||
RpfDirectoryEntry newdir = null;
|
||||
@ -2103,7 +2060,7 @@ namespace CodeWalker
|
||||
else
|
||||
{
|
||||
//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)
|
||||
@ -2115,7 +2072,7 @@ namespace CodeWalker
|
||||
|
||||
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);
|
||||
AddNewFolderTreeNode(node);
|
||||
}
|
||||
@ -2284,7 +2241,7 @@ namespace CodeWalker
|
||||
if (newrpf != null)
|
||||
{
|
||||
//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);
|
||||
if (CurrentFolder.Children != null)
|
||||
{
|
||||
@ -2324,7 +2281,7 @@ namespace CodeWalker
|
||||
{
|
||||
if (MainListView.SelectedIndices.Count == 0)
|
||||
{
|
||||
Clipboard.SetText(CurrentFolder?.FullPath ?? GetRootPath());
|
||||
Clipboard.SetText(CurrentFolder?.FullPath ?? GTAFolder.GetCurrentGTAFolderWithTrailingSlash());
|
||||
}
|
||||
else if (MainListView.SelectedIndices.Count == 1)
|
||||
{
|
||||
@ -2985,7 +2942,7 @@ namespace CodeWalker
|
||||
private void TreeContextWinExplorerMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var folder = MainTreeView.SelectedNode?.Tag as MainTreeFolder;
|
||||
var path = folder?.FullPath ?? GetRootPath();
|
||||
var path = folder?.FullPath ?? GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
ShowInExplorer(path);
|
||||
}
|
||||
|
||||
@ -3288,7 +3245,7 @@ namespace CodeWalker
|
||||
if (ListItems == null)
|
||||
{
|
||||
ListItems = new List<MainListItem>();
|
||||
var rootpath = ExploreForm.GetRootPath();
|
||||
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
|
||||
if (Children != null)
|
||||
{
|
||||
@ -3350,7 +3307,7 @@ namespace CodeWalker
|
||||
resultcount++;
|
||||
}
|
||||
|
||||
var rootpath = ExploreForm.GetRootPath();
|
||||
var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash();
|
||||
|
||||
if (Files != null)
|
||||
{
|
||||
|
2
ExtractKeysForm.Designer.cs
generated
2
ExtractKeysForm.Designer.cs
generated
@ -77,9 +77,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.FolderTextBox.Location = new System.Drawing.Point(98, 25);
|
||||
this.FolderTextBox.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(345, 20);
|
||||
this.FolderTextBox.TabIndex = 57;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// StatusLabel
|
||||
//
|
||||
|
@ -26,7 +26,7 @@ namespace CodeWalker
|
||||
|
||||
private void ExtractKeysForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
|
||||
try
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
ExeTextBox.Text = GTAFolder.CurrentGTAFolder + @"\GTA5.exe";
|
||||
}
|
||||
|
||||
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.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||
this.FolderTextBox.TabIndex = 64;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
|
@ -26,7 +26,7 @@ namespace CodeWalker
|
||||
|
||||
private void ExtractRawForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
OutputFolderTextBox.Text = Settings.Default.ExtractedRawFilesFolder;
|
||||
|
||||
try
|
||||
@ -58,11 +58,6 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
||||
}
|
||||
|
||||
private void OutputFolderTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.Default.ExtractedRawFilesFolder = OutputFolderTextBox.Text;
|
||||
@ -70,12 +65,8 @@ namespace CodeWalker
|
||||
|
||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
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.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||
this.FolderTextBox.TabIndex = 42;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// ExtractScriptsForm
|
||||
//
|
||||
|
@ -28,7 +28,7 @@ namespace CodeWalker
|
||||
private void ExtractForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
DumpTextBox.Text = Settings.Default.GTAExeDumpFile;
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
OutputFolderTextBox.Text = Settings.Default.CompiledScriptFolder;
|
||||
|
||||
try
|
||||
@ -49,11 +49,6 @@ namespace CodeWalker
|
||||
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)
|
||||
{
|
||||
Settings.Default.CompiledScriptFolder = OutputFolderTextBox.Text;
|
||||
@ -61,12 +56,8 @@ namespace CodeWalker
|
||||
|
||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
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.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||
this.FolderTextBox.TabIndex = 64;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
|
@ -26,7 +26,7 @@ namespace CodeWalker
|
||||
|
||||
private void ExtractShadersForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
OutputFolderTextBox.Text = Settings.Default.ExtractedShadersFolder;
|
||||
|
||||
try
|
||||
@ -41,10 +41,7 @@ namespace CodeWalker
|
||||
}
|
||||
}
|
||||
|
||||
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.Default.GTAFolder = FolderTextBox.Text;
|
||||
}
|
||||
private void FolderTextBox_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)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
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.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(251, 20);
|
||||
this.FolderTextBox.TabIndex = 55;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// AbortButton
|
||||
//
|
||||
|
@ -27,7 +27,7 @@ namespace CodeWalker
|
||||
|
||||
private void ExtractTexForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
OutputFolderTextBox.Text = Settings.Default.ExtractedTexturesFolder;
|
||||
|
||||
try
|
||||
@ -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)
|
||||
{
|
||||
Settings.Default.ExtractedTexturesFolder = OutputFolderTextBox.Text;
|
||||
@ -54,12 +49,8 @@ namespace CodeWalker
|
||||
|
||||
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
|
||||
|
@ -117,9 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</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" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -149,7 +149,7 @@ namespace CodeWalker.Forms
|
||||
{
|
||||
if (string.IsNullOrEmpty(FileName)) 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;
|
||||
|
||||
var fn = FilePath;
|
||||
|
@ -137,38 +137,11 @@ namespace CodeWalker.Forms
|
||||
|
||||
MouseWheel += ModelForm_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
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
MetaName[] texsamplers = RenderableGeometry.GetTextureSamplerList();
|
||||
foreach (var texsampler in texsamplers)
|
||||
|
@ -130,7 +130,7 @@ namespace CodeWalker.Forms
|
||||
{
|
||||
if (string.IsNullOrEmpty(FileName)) 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;
|
||||
|
||||
var fn = FilePath;
|
||||
|
@ -155,7 +155,7 @@ namespace CodeWalker.Forms
|
||||
{
|
||||
if (string.IsNullOrEmpty(FileName)) 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;
|
||||
|
||||
var fn = FilePath;
|
||||
|
@ -121,7 +121,7 @@ namespace CodeWalker.GameFiles
|
||||
RpfMan = new RpfManager();
|
||||
RpfMan.ExcludePaths = GetExcludePaths();
|
||||
RpfMan.EnableMods = EnableMods;
|
||||
RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, ErrorLog);//, true);
|
||||
RpfMan.Init(GTAFolder.CurrentGTAFolder, UpdateStatus, ErrorLog);//, true);
|
||||
|
||||
//RE test area!
|
||||
//DecodeRelFiles();
|
||||
|
@ -36,7 +36,7 @@ namespace CodeWalker
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
GTA5Keys.LoadFromPath(Settings.Default.GTAFolder, Settings.Default.Key);
|
||||
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder, Settings.Default.Key);
|
||||
GameFileCache gfc = new GameFileCache();
|
||||
gfc.DoFullStringIndex = true;
|
||||
gfc.Init(UpdateStatus, UpdateStatus);
|
||||
|
@ -36,11 +36,18 @@ namespace CodeWalker
|
||||
Application.EnableVisualStyles();
|
||||
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
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (menumode)
|
||||
if (menumode)
|
||||
{
|
||||
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.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;
|
||||
}
|
||||
}
|
@ -25,7 +25,8 @@ namespace CodeWalker
|
||||
|
||||
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)
|
||||
@ -50,18 +51,19 @@ namespace CodeWalker
|
||||
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(SelectedFolder + "\\gta5.exe"))
|
||||
{
|
||||
MessageBox.Show("GTA5.exe not found in folder:\n" + SelectedFolder);
|
||||
MessageBox.Show("The selected folder could not be used:\n\n" + failReason, "Invalid GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Result = DialogResult.OK;
|
||||
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.ControlsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.MouseInvertCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
@ -79,8 +80,6 @@
|
||||
this.DoneButton = new System.Windows.Forms.Button();
|
||||
this.SaveButton = 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.ControlsTabPage.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@ -140,6 +139,17 @@
|
||||
this.groupBox2.TabStop = false;
|
||||
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
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
@ -739,9 +749,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.FolderTextBox.Location = new System.Drawing.Point(110, 28);
|
||||
this.FolderTextBox.Name = "FolderTextBox";
|
||||
this.FolderTextBox.ReadOnly = true;
|
||||
this.FolderTextBox.Size = new System.Drawing.Size(303, 20);
|
||||
this.FolderTextBox.TabIndex = 48;
|
||||
this.FolderTextBox.TextChanged += new System.EventHandler(this.FolderTextBox_TextChanged);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
@ -785,17 +795,6 @@
|
||||
this.ResetButton.UseVisualStyleBackColor = true;
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -857,7 +856,6 @@
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button FolderBrowseButton;
|
||||
private System.Windows.Forms.TextBox FolderTextBox;
|
||||
private System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.NumericUpDown ShadowCascadesUpDown;
|
||||
private System.Windows.Forms.Label label7;
|
||||
|
@ -71,7 +71,7 @@ namespace CodeWalker
|
||||
}
|
||||
private void LoadAdvancedSettings()
|
||||
{
|
||||
FolderTextBox.Text = Settings.Default.GTAFolder;
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
ExcludeFoldersTextBox.Text = Settings.Default.ExcludeFolders;
|
||||
ShadowCascadesUpDown.Value = Settings.Default.ShadowCascades;
|
||||
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)
|
||||
{
|
||||
FolderBrowserDialog.SelectedPath = Settings.Default.GTAFolder;
|
||||
DialogResult res = FolderBrowserDialog.ShowDialog();
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
||||
}
|
||||
GTAFolder.UpdateGTAFolder(false);
|
||||
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
||||
}
|
||||
|
||||
private void ExcludeFoldersTextBox_TextChanged(object sender, EventArgs e)
|
||||
|
@ -117,9 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</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" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<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;
|
||||
|
||||
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, Settings.Default.Key);
|
||||
GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder, Settings.Default.Key);
|
||||
|
||||
//save the key for later if it's not saved already. not really ideal to have this in this thread
|
||||
if (string.IsNullOrEmpty(Settings.Default.Key) && (GTA5Keys.PC_AES_KEY != null))
|
||||
|
Loading…
Reference in New Issue
Block a user