diff --git a/CodeWalker.csproj b/CodeWalker.csproj index 6183c66..777b218 100644 --- a/CodeWalker.csproj +++ b/CodeWalker.csproj @@ -92,32 +92,32 @@ - packages\FCTB.2.16.21.0\lib\FastColoredTextBox.dll - False + False + bin\Debug\FastColoredTextBox.dll - packages\SharpDX.4.0.1\lib\net45\SharpDX.dll + ..\..\references\Codewalker Refs\SharpDX.dll - packages\SharpDX.D3DCompiler.4.0.1\lib\net45\SharpDX.D3DCompiler.dll + ..\..\references\Codewalker Refs\SharpDX.D3DCompiler.dll - packages\SharpDX.Direct2D1.4.0.1\lib\net45\SharpDX.Direct2D1.dll + ..\..\references\Codewalker Refs\SharpDX.Direct2D1.dll - packages\SharpDX.Direct3D11.4.0.1\lib\net45\SharpDX.Direct3D11.dll + ..\..\references\Codewalker Refs\SharpDX.Direct3D11.dll - packages\SharpDX.DXGI.4.0.1\lib\net45\SharpDX.DXGI.dll + ..\..\references\Codewalker Refs\SharpDX.DXGI.dll - packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll + ..\..\references\Codewalker Refs\SharpDX.Mathematics.dll - packages\SharpDX.XAudio2.4.0.1\lib\net45\SharpDX.XAudio2.dll + ..\..\references\Codewalker Refs\SharpDX.XAudio2.dll - packages\SharpDX.XInput.4.0.1\lib\net45\SharpDX.XInput.dll + ..\..\references\Codewalker Refs\SharpDX.XInput.dll @@ -395,6 +395,7 @@ + @@ -479,6 +480,7 @@ FxcForm.cs + Designer GxtForm.cs diff --git a/ExploreForm.Designer.cs b/ExploreForm.Designer.cs index 8f1dc64..b6ac238 100644 --- a/ExploreForm.Designer.cs +++ b/ExploreForm.Designer.cs @@ -91,6 +91,12 @@ this.MainSizeColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.MainAttrColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.MainPathColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.EditModeBaseWarningPanel = new System.Windows.Forms.Panel(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + this.EditModeModsWarningPanel = new System.Windows.Forms.Panel(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); this.ListContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.ListContextViewMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ListContextViewHexMenu = new System.Windows.Forms.ToolStripMenuItem(); @@ -116,6 +122,8 @@ this.ListContextReplaceMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ListContextDeleteMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ListContextEditSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.ListContextDefragmentMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ListContextDefragmentSeparator = new System.Windows.Forms.ToolStripSeparator(); this.ListContextSelectAllMenu = new System.Windows.Forms.ToolStripMenuItem(); this.TreeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.TreeContextCopyPathMenu = new System.Windows.Forms.ToolStripMenuItem(); @@ -127,14 +135,6 @@ this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog(); this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); - this.EditModeBaseWarningPanel = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.EditModeModsWarningPanel = new System.Windows.Forms.Panel(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.label2 = new System.Windows.Forms.Label(); - this.ListContextDefragmentMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.ListContextDefragmentSeparator = new System.Windows.Forms.ToolStripSeparator(); this.MainMenu.SuspendLayout(); this.MainToolbar.SuspendLayout(); this.StatusBar.SuspendLayout(); @@ -142,12 +142,12 @@ this.MainSplitContainer.Panel1.SuspendLayout(); this.MainSplitContainer.Panel2.SuspendLayout(); this.MainSplitContainer.SuspendLayout(); - this.ListContextMenu.SuspendLayout(); - this.TreeContextMenu.SuspendLayout(); this.EditModeBaseWarningPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.EditModeModsWarningPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.ListContextMenu.SuspendLayout(); + this.TreeContextMenu.SuspendLayout(); this.SuspendLayout(); // // MainMenu @@ -374,21 +374,21 @@ // ViewLargeIconsMenu // this.ViewLargeIconsMenu.Name = "ViewLargeIconsMenu"; - this.ViewLargeIconsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewLargeIconsMenu.Size = new System.Drawing.Size(152, 22); this.ViewLargeIconsMenu.Text = "Large Icons"; this.ViewLargeIconsMenu.Click += new System.EventHandler(this.ViewLargeIconsMenu_Click); // // ViewSmallIconsMenu // this.ViewSmallIconsMenu.Name = "ViewSmallIconsMenu"; - this.ViewSmallIconsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewSmallIconsMenu.Size = new System.Drawing.Size(152, 22); this.ViewSmallIconsMenu.Text = "Small Icons"; this.ViewSmallIconsMenu.Click += new System.EventHandler(this.ViewSmallIconsMenu_Click); // // ViewListMenu // this.ViewListMenu.Name = "ViewListMenu"; - this.ViewListMenu.Size = new System.Drawing.Size(134, 22); + this.ViewListMenu.Size = new System.Drawing.Size(152, 22); this.ViewListMenu.Text = "List"; this.ViewListMenu.Click += new System.EventHandler(this.ViewListMenu_Click); // @@ -397,7 +397,7 @@ this.ViewDetailsMenu.Checked = true; this.ViewDetailsMenu.CheckState = System.Windows.Forms.CheckState.Checked; this.ViewDetailsMenu.Name = "ViewDetailsMenu"; - this.ViewDetailsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewDetailsMenu.Size = new System.Drawing.Size(152, 22); this.ViewDetailsMenu.Text = "Details"; this.ViewDetailsMenu.Click += new System.EventHandler(this.ViewDetailsMenu_Click); // @@ -754,6 +754,72 @@ this.MainPathColumnHeader.Text = "Path"; this.MainPathColumnHeader.Width = 225; // + // EditModeBaseWarningPanel + // + this.EditModeBaseWarningPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.EditModeBaseWarningPanel.BackColor = System.Drawing.Color.DarkRed; + this.EditModeBaseWarningPanel.Controls.Add(this.pictureBox1); + this.EditModeBaseWarningPanel.Controls.Add(this.label1); + this.EditModeBaseWarningPanel.Location = new System.Drawing.Point(1, 3); + this.EditModeBaseWarningPanel.Name = "EditModeBaseWarningPanel"; + this.EditModeBaseWarningPanel.Size = new System.Drawing.Size(559, 24); + this.EditModeBaseWarningPanel.TabIndex = 1; + // + // pictureBox1 + // + this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); + this.pictureBox1.Location = new System.Drawing.Point(6, 3); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(16, 16); + this.pictureBox1.TabIndex = 1; + this.pictureBox1.TabStop = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.White; + this.label1.Location = new System.Drawing.Point(25, 5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(285, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Warning: You are directly editing base game files"; + // + // EditModeModsWarningPanel + // + this.EditModeModsWarningPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.EditModeModsWarningPanel.BackColor = System.Drawing.Color.DarkGreen; + this.EditModeModsWarningPanel.Controls.Add(this.pictureBox2); + this.EditModeModsWarningPanel.Controls.Add(this.label2); + this.EditModeModsWarningPanel.Location = new System.Drawing.Point(1, 28); + this.EditModeModsWarningPanel.Name = "EditModeModsWarningPanel"; + this.EditModeModsWarningPanel.Size = new System.Drawing.Size(559, 24); + this.EditModeModsWarningPanel.TabIndex = 2; + // + // pictureBox2 + // + this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); + this.pictureBox2.Location = new System.Drawing.Point(6, 3); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(16, 16); + this.pictureBox2.TabIndex = 1; + this.pictureBox2.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Transparent; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.Color.White; + this.label2.Location = new System.Drawing.Point(25, 5); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(225, 13); + this.label2.TabIndex = 0; + this.label2.Text = "You are editing files in the mods folder"; + // // ListContextMenu // this.ListContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -783,7 +849,7 @@ this.ListContextDefragmentSeparator, this.ListContextSelectAllMenu}); this.ListContextMenu.Name = "MainContextMenu"; - this.ListContextMenu.Size = new System.Drawing.Size(208, 464); + this.ListContextMenu.Size = new System.Drawing.Size(208, 442); // // ListContextViewMenu // @@ -967,6 +1033,18 @@ this.ListContextEditSeparator.Name = "ListContextEditSeparator"; this.ListContextEditSeparator.Size = new System.Drawing.Size(204, 6); // + // ListContextDefragmentMenu + // + this.ListContextDefragmentMenu.Name = "ListContextDefragmentMenu"; + this.ListContextDefragmentMenu.Size = new System.Drawing.Size(207, 22); + this.ListContextDefragmentMenu.Text = "Defragment Archive..."; + this.ListContextDefragmentMenu.Click += new System.EventHandler(this.ListContextDefragmentMenu_Click); + // + // ListContextDefragmentSeparator + // + this.ListContextDefragmentSeparator.Name = "ListContextDefragmentSeparator"; + this.ListContextDefragmentSeparator.Size = new System.Drawing.Size(204, 6); + // // ListContextSelectAllMenu // this.ListContextSelectAllMenu.Name = "ListContextSelectAllMenu"; @@ -1033,84 +1111,6 @@ // this.OpenFileDialog.Multiselect = true; // - // EditModeBaseWarningPanel - // - this.EditModeBaseWarningPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.EditModeBaseWarningPanel.BackColor = System.Drawing.Color.DarkRed; - this.EditModeBaseWarningPanel.Controls.Add(this.pictureBox1); - this.EditModeBaseWarningPanel.Controls.Add(this.label1); - this.EditModeBaseWarningPanel.Location = new System.Drawing.Point(1, 3); - this.EditModeBaseWarningPanel.Name = "EditModeBaseWarningPanel"; - this.EditModeBaseWarningPanel.Size = new System.Drawing.Size(559, 24); - this.EditModeBaseWarningPanel.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.White; - this.label1.Location = new System.Drawing.Point(25, 5); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(285, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Warning: You are directly editing base game files"; - // - // pictureBox1 - // - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(6, 3); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(16, 16); - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // EditModeModsWarningPanel - // - this.EditModeModsWarningPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.EditModeModsWarningPanel.BackColor = System.Drawing.Color.DarkGreen; - this.EditModeModsWarningPanel.Controls.Add(this.pictureBox2); - this.EditModeModsWarningPanel.Controls.Add(this.label2); - this.EditModeModsWarningPanel.Location = new System.Drawing.Point(1, 28); - this.EditModeModsWarningPanel.Name = "EditModeModsWarningPanel"; - this.EditModeModsWarningPanel.Size = new System.Drawing.Size(559, 24); - this.EditModeModsWarningPanel.TabIndex = 2; - // - // pictureBox2 - // - this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); - this.pictureBox2.Location = new System.Drawing.Point(6, 3); - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(16, 16); - this.pictureBox2.TabIndex = 1; - this.pictureBox2.TabStop = false; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(25, 5); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(225, 13); - this.label2.TabIndex = 0; - this.label2.Text = "You are editing files in the mods folder"; - // - // ListContextDefragmentMenu - // - this.ListContextDefragmentMenu.Name = "ListContextDefragmentMenu"; - this.ListContextDefragmentMenu.Size = new System.Drawing.Size(207, 22); - this.ListContextDefragmentMenu.Text = "Defragment Archive..."; - this.ListContextDefragmentMenu.Click += new System.EventHandler(this.ListContextDefragmentMenu_Click); - // - // ListContextDefragmentSeparator - // - this.ListContextDefragmentSeparator.Name = "ListContextDefragmentSeparator"; - this.ListContextDefragmentSeparator.Size = new System.Drawing.Size(204, 6); - // // ExploreForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1135,14 +1135,14 @@ this.MainSplitContainer.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).EndInit(); this.MainSplitContainer.ResumeLayout(false); - this.ListContextMenu.ResumeLayout(false); - this.TreeContextMenu.ResumeLayout(false); this.EditModeBaseWarningPanel.ResumeLayout(false); this.EditModeBaseWarningPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.EditModeModsWarningPanel.ResumeLayout(false); this.EditModeModsWarningPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.ListContextMenu.ResumeLayout(false); + this.TreeContextMenu.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ExploreForm.cs b/ExploreForm.cs index a8627b3..af04766 100644 --- a/ExploreForm.cs +++ b/ExploreForm.cs @@ -59,7 +59,8 @@ namespace CodeWalker InitFileTypes(); - if (!EnsureGTAFolder()) + /*if (!EnsureGTAFolder())*/ + if(!GTAFolder.UpdateGTAFolder(true)) { Close(); return; diff --git a/ExploreForm.resx b/ExploreForm.resx index 3cb5ae8..22688de 100644 --- a/ExploreForm.resx +++ b/ExploreForm.resx @@ -271,16 +271,6 @@ e2d2SZBn3BDEyPiVG5X23Ap3LtwYqxPDuBkxUEmGNWnPzTCEn1GZjBBcYawROqpiopbZ8v/CtN9mmB+9 1vZY1yV7KT9+37JAwB1LBeyfTv8N11OX0LGtniroCF2hd2L+f3A9qqp2iWbL30hjPP3/CJi+jvVtWwLw A4Rmgl76+inbAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIx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ry3WeaQsQPvnNKd1hjo1V/TdpFAAAAAElFTkSuQmCC - - 126 diff --git a/Utils/GTAFolderCheck.cs b/Utils/GTAFolderCheck.cs new file mode 100644 index 0000000..392e48c --- /dev/null +++ b/Utils/GTAFolderCheck.cs @@ -0,0 +1,91 @@ +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 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); + MessageBox.Show($"Successfully set 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{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); + if(tryAgain == DialogResult.Retry) + { + return UpdateGTAFolder(false); + } else + { + return false; + } + } + } + + public static bool SetGTAFolder(string folder) + { + if(ValidateGTAFolder(folder)) + { + CurrentGTAFolder = folder; + Settings.Default.GTAFolder = folder; + return true; + } + + return false; + } + } +}