From 77565808172ebbd280c874cbb287c3516aaec861 Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Sat, 17 Feb 2018 17:26:35 -0800 Subject: [PATCH 1/9] Moved GTA Folder detection logic to new class --- CodeWalker.csproj | 22 ++--- ExploreForm.Designer.cs | 190 ++++++++++++++++++++-------------------- ExploreForm.cs | 3 +- ExploreForm.resx | 58 ++++++------ Utils/GTAFolderCheck.cs | 91 +++++++++++++++++++ 5 files changed, 229 insertions(+), 135 deletions(-) create mode 100644 Utils/GTAFolderCheck.cs 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 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ - MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM - TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo - 6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD - NQar60zqQI0AAAAASUVORK5CYII= @@ -300,6 +290,16 @@ lVY67e7NJiI/2QxXrEetVVZsAY5938U5NzUbthbgknMW7735iOnYsB0AqBXXlJL5jOnYsDUBqA1uMcbh mYyuz6aAU/M9hKDP3GR0ffYegNrwXEpRADdZr5+aAlB7UAB3j1V/Anh1j1UD4Fub4YrN8HPL9gAVE1vf J6IiRgAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ + MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM + TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo + 6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD + NQar60zqQI0AAAAASUVORK5CYII= @@ -313,7 +313,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo - HwAAAk1TRnQBSQFMAgEBGAEAAdgBAAHYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + HwAAAk1TRnQBSQFMAgEBGAEAAeABAAHgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAXADAAEBAQABCAYAARwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -450,6 +450,24 @@ AQABAQHAAQEBAAEDAcABAQEAAQEBwAEBAQABAwHAAQEBAAEBAQABAQEAAQcBwAEDAQABAQEAAQEBAAEP AcABAwEAAQEBAAEBAQABDwHAAQMBAAEBAQABAQEAAQ8BwAEDAQABAQHAAQcBAAEPAcABAwEAAQMB4AEP AQABDwHAAQMBAAEHCw== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAAJtJREFUOE+Vj8ENgCAMRdnE1ZzLCwt5cQJvjkDiRfyfUIJQEJo8U2rof5hWOedW + 4CNrHI8XLp3PsXjCPo7Hion3tXm/mwD7KQtJlwVTFmW6MGyRp+MYYD9kUaZjlBaQX4s8XVvQtSjTtQWk + aVGmE4yrBaqFlt6jstDSCX5VBuRj0UtvLSDJopX+R7LAx868X4gGVp5hAQcz4LIxLycs8rg+vnkMAAAA + AElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAALVJREFUOE/dk70NQjEMhLMHDZuRBZiAadgD6YmGNjNAhaB4okkb/IEtvfgZIaDj + pCvi853y4ySPWmsWDsLmSC1r2xwiLoVlON7aandui+2pIzU0euhV2xNqHtf7y8zouTlcCRm7EFkUBN9s + 8HUNKWbObM03QUOk6XEyAUN05nfEg5eAsAEaIg3i/ZOAl5doiLTpJf72jDoLJZpCg693gwRk8RjlaBo9 + w1EGGvLdZ5pCxA++c0p3WGOjVX9N2kUAAAAASUVORK5CYII= @@ -574,24 +592,6 @@ 152, 56 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAACbSURBVDhPlY/BDYAgDEXZxNWcywsLeXECb45A4kX8n1CC - UBCaPFNq6H+YVjnnVuAjaxyPFy6dz7F4wj6Ox4qJ97V5v5sA+ykLSZcFUxZlujBskafjGGA/ZFGmY5QW - kF+LPF1b0LUo07UFpGlRphOMqwWqhZbeo7LQ0gl+VQbkY9FLby0gyaKV/keywMfOvF+IBlaeYQEHM+Cy - MS8nLPK4Pr55DAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAC1SURBVDhP3ZO9DUIxDISzBw2bkQWYgGnYA+mJhjYzQIWg - eKJJG/yBLb34GSGg46Qr4vOd8uMkj1prFg7C5kgta9scIi6FZTje2mp3bovtqSM1NHroVdsTah7X+8vM - 6Lk5XAkZuxBZFATfbPB1DSlmzmzNN0FDpOlxMgFDdOZ3xIOXgLABGiIN4v2TgJeXaIi06SX+9ow6CyWa - QoOvd4MEZPEY5WgaPcNRBhry3WeaQsQPvnNKd1hjo1V/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; + } + } +} From 5dff45a54d0586314e91258532572eb6f23d34e3 Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Sun, 18 Feb 2018 01:20:39 -0800 Subject: [PATCH 2/9] Finished converting ExploreForm.cs to use new GTA folder code --- CodeWalker.csproj | 12 +++++-- ExploreForm.cs | 78 +++++++++-------------------------------- Utils/GTAFolderCheck.cs | 3 ++ 3 files changed, 28 insertions(+), 65 deletions(-) diff --git a/CodeWalker.csproj b/CodeWalker.csproj index 777b218..0341276 100644 --- a/CodeWalker.csproj +++ b/CodeWalker.csproj @@ -578,9 +578,15 @@ - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/ExploreForm.cs b/ExploreForm.cs index af04766..3ac2c2f 100644 --- a/ExploreForm.cs +++ b/ExploreForm.cs @@ -71,7 +71,7 @@ namespace CodeWalker { try { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); } catch { @@ -242,45 +242,7 @@ 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) { @@ -314,13 +276,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; @@ -597,15 +552,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 nodes = new Dictionary(); MainTreeFolder root = new MainTreeFolder(); - root.FullPath = GetRootPath(); + root.FullPath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash(); root.Path = ""; root.Name = "GTA V"; RootFolder = root; @@ -614,7 +568,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 + "..."); @@ -630,7 +584,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) @@ -704,7 +658,7 @@ namespace CodeWalker } private void RecurseMainTreeViewRPF(MainTreeFolder f, List allRpfs) { - var rootpath = GetRootPath(); + var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash(); var fld = f.RpfFolder; if (fld != null) @@ -2027,7 +1981,7 @@ namespace CodeWalker string relpath = (CurrentFolder.Path ?? "") + "\\" + fname; - var rootpath = GetRootPath(); + var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash(); string fullpath = rootpath + relpath; RpfDirectoryEntry newdir = null; @@ -2104,7 +2058,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) @@ -2116,7 +2070,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); } @@ -2285,7 +2239,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) { @@ -2325,7 +2279,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) { @@ -2986,7 +2940,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); } @@ -3289,7 +3243,7 @@ namespace CodeWalker if (ListItems == null) { ListItems = new List(); - var rootpath = ExploreForm.GetRootPath(); + var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash(); if (Children != null) { @@ -3351,7 +3305,7 @@ namespace CodeWalker resultcount++; } - var rootpath = ExploreForm.GetRootPath(); + var rootpath = GTAFolder.GetCurrentGTAFolderWithTrailingSlash(); if (Files != null) { diff --git a/Utils/GTAFolderCheck.cs b/Utils/GTAFolderCheck.cs index 392e48c..abcd3d9 100644 --- a/Utils/GTAFolderCheck.cs +++ b/Utils/GTAFolderCheck.cs @@ -87,5 +87,8 @@ namespace CodeWalker return false; } + + public static string GetCurrentGTAFolderWithTrailingSlash() =>CurrentGTAFolder.EndsWith(@"\") ? CurrentGTAFolder : CurrentGTAFolder + @"\"; + } } From bd3c527ceca61e18d2bbf3b5e09eba4532e858ed Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Tue, 20 Feb 2018 23:30:30 -0800 Subject: [PATCH 3/9] Restored accidentally edited files --- CodeWalker.csproj | 34 +++---- ExploreForm.Designer.cs | 190 ++++++++++++++++++++-------------------- ExploreForm.resx | 58 ++++++------ 3 files changed, 137 insertions(+), 145 deletions(-) diff --git a/CodeWalker.csproj b/CodeWalker.csproj index 0341276..6183c66 100644 --- a/CodeWalker.csproj +++ b/CodeWalker.csproj @@ -92,32 +92,32 @@ - False - bin\Debug\FastColoredTextBox.dll + packages\FCTB.2.16.21.0\lib\FastColoredTextBox.dll + False - ..\..\references\Codewalker Refs\SharpDX.dll + packages\SharpDX.4.0.1\lib\net45\SharpDX.dll - ..\..\references\Codewalker Refs\SharpDX.D3DCompiler.dll + packages\SharpDX.D3DCompiler.4.0.1\lib\net45\SharpDX.D3DCompiler.dll - ..\..\references\Codewalker Refs\SharpDX.Direct2D1.dll + packages\SharpDX.Direct2D1.4.0.1\lib\net45\SharpDX.Direct2D1.dll - ..\..\references\Codewalker Refs\SharpDX.Direct3D11.dll + packages\SharpDX.Direct3D11.4.0.1\lib\net45\SharpDX.Direct3D11.dll - ..\..\references\Codewalker Refs\SharpDX.DXGI.dll + packages\SharpDX.DXGI.4.0.1\lib\net45\SharpDX.DXGI.dll - ..\..\references\Codewalker Refs\SharpDX.Mathematics.dll + packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll - ..\..\references\Codewalker Refs\SharpDX.XAudio2.dll + packages\SharpDX.XAudio2.4.0.1\lib\net45\SharpDX.XAudio2.dll - ..\..\references\Codewalker Refs\SharpDX.XInput.dll + packages\SharpDX.XInput.4.0.1\lib\net45\SharpDX.XInput.dll @@ -395,7 +395,6 @@ - @@ -480,7 +479,6 @@ FxcForm.cs - Designer GxtForm.cs @@ -578,15 +576,9 @@ - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - + + + diff --git a/ExploreForm.Designer.cs b/ExploreForm.Designer.cs index b6ac238..8f1dc64 100644 --- a/ExploreForm.Designer.cs +++ b/ExploreForm.Designer.cs @@ -91,12 +91,6 @@ 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(); @@ -122,8 +116,6 @@ 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(); @@ -135,6 +127,14 @@ 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(152, 22); + this.ViewLargeIconsMenu.Size = new System.Drawing.Size(134, 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(152, 22); + this.ViewSmallIconsMenu.Size = new System.Drawing.Size(134, 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(152, 22); + this.ViewListMenu.Size = new System.Drawing.Size(134, 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(152, 22); + this.ViewDetailsMenu.Size = new System.Drawing.Size(134, 22); this.ViewDetailsMenu.Text = "Details"; this.ViewDetailsMenu.Click += new System.EventHandler(this.ViewDetailsMenu_Click); // @@ -754,72 +754,6 @@ 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[] { @@ -849,7 +783,7 @@ this.ListContextDefragmentSeparator, this.ListContextSelectAllMenu}); this.ListContextMenu.Name = "MainContextMenu"; - this.ListContextMenu.Size = new System.Drawing.Size(208, 442); + this.ListContextMenu.Size = new System.Drawing.Size(208, 464); // // ListContextViewMenu // @@ -1033,18 +967,6 @@ 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"; @@ -1111,6 +1033,84 @@ // 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.resx b/ExploreForm.resx index 22688de..3cb5ae8 100644 --- a/ExploreForm.resx +++ b/ExploreForm.resx @@ -271,6 +271,16 @@ e2d2SZBn3BDEyPiVG5X23Ap3LtwYqxPDuBkxUEmGNWnPzTCEn1GZjBBcYawROqpiopbZ8v/CtN9mmB+9 1vZY1yV7KT9+37JAwB1LBeyfTv8N11OX0LGtniroCF2hd2L+f3A9qqp2iWbL30hjPP3/CJi+jvVtWwLw A4Rmgl76+inbAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ + MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM + TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo + 6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD + NQar60zqQI0AAAAASUVORK5CYII= @@ -290,16 +300,6 @@ lVY67e7NJiI/2QxXrEetVVZsAY5938U5NzUbthbgknMW7735iOnYsB0AqBXXlJL5jOnYsDUBqA1uMcbh mYyuz6aAU/M9hKDP3GR0ffYegNrwXEpRADdZr5+aAlB7UAB3j1V/Anh1j1UD4Fub4YrN8HPL9gAVE1vf J6IiRgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ - MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM - TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo - 6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD - NQar60zqQI0AAAAASUVORK5CYII= @@ -313,7 +313,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo - HwAAAk1TRnQBSQFMAgEBGAEAAeABAAHgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + HwAAAk1TRnQBSQFMAgEBGAEAAdgBAAHYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAXADAAEBAQABCAYAARwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -450,24 +450,6 @@ AQABAQHAAQEBAAEDAcABAQEAAQEBwAEBAQABAwHAAQEBAAEBAQABAQEAAQcBwAEDAQABAQEAAQEBAAEP AcABAwEAAQEBAAEBAQABDwHAAQMBAAEBAQABAQEAAQ8BwAEDAQABAQHAAQcBAAEPAcABAwEAAQMB4AEP AQABDwHAAQMBAAEHCw== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAAJtJREFUOE+Vj8ENgCAMRdnE1ZzLCwt5cQJvjkDiRfyfUIJQEJo8U2rof5hWOedW - 4CNrHI8XLp3PsXjCPo7Hion3tXm/mwD7KQtJlwVTFmW6MGyRp+MYYD9kUaZjlBaQX4s8XVvQtSjTtQWk - aVGmE4yrBaqFlt6jstDSCX5VBuRj0UtvLSDJopX+R7LAx868X4gGVp5hAQcz4LIxLycs8rg+vnkMAAAA - AElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAALVJREFUOE/dk70NQjEMhLMHDZuRBZiAadgD6YmGNjNAhaB4okkb/IEtvfgZIaDj - pCvi853y4ySPWmsWDsLmSC1r2xwiLoVlON7aandui+2pIzU0euhV2xNqHtf7y8zouTlcCRm7EFkUBN9s - 8HUNKWbObM03QUOk6XEyAUN05nfEg5eAsAEaIg3i/ZOAl5doiLTpJf72jDoLJZpCg693gwRk8RjlaBo9 - w1EGGvLdZ5pCxA++c0p3WGOjVX9N2kUAAAAASUVORK5CYII= @@ -592,6 +574,24 @@ 152, 56 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAACbSURBVDhPlY/BDYAgDEXZxNWcywsLeXECb45A4kX8n1CC + UBCaPFNq6H+YVjnnVuAjaxyPFy6dz7F4wj6Ox4qJ97V5v5sA+ykLSZcFUxZlujBskafjGGA/ZFGmY5QW + kF+LPF1b0LUo07UFpGlRphOMqwWqhZbeo7LQ0gl+VQbkY9FLby0gyaKV/keywMfOvF+IBlaeYQEHM+Cy + MS8nLPK4Pr55DAAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAC1SURBVDhP3ZO9DUIxDISzBw2bkQWYgGnYA+mJhjYzQIWg + eKJJG/yBLb34GSGg46Qr4vOd8uMkj1prFg7C5kgta9scIi6FZTje2mp3bovtqSM1NHroVdsTah7X+8vM + 6Lk5XAkZuxBZFATfbPB1DSlmzmzNN0FDpOlxMgFDdOZ3xIOXgLABGiIN4v2TgJeXaIi06SX+9ow6CyWa + QoOvd4MEZPEY5WgaPcNRBhry3WeaQsQPvnNKd1hjo1V/TdpFAAAAAElFTkSuQmCC + + 126 From 3c8c3464e3a900f7d5f9ae396e34cd56e707b312 Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Tue, 20 Feb 2018 23:31:19 -0800 Subject: [PATCH 4/9] Restored new GTAFolder class to project and changed filename to match class name --- CodeWalker.csproj | 1 + Utils/{GTAFolderCheck.cs => GTAFolder.cs} | 0 2 files changed, 1 insertion(+) rename Utils/{GTAFolderCheck.cs => GTAFolder.cs} (100%) diff --git a/CodeWalker.csproj b/CodeWalker.csproj index 6183c66..f7c0985 100644 --- a/CodeWalker.csproj +++ b/CodeWalker.csproj @@ -395,6 +395,7 @@ + diff --git a/Utils/GTAFolderCheck.cs b/Utils/GTAFolder.cs similarity index 100% rename from Utils/GTAFolderCheck.cs rename to Utils/GTAFolder.cs From 9f91e34b5adcd81d3eff2c540112c9039784a1b3 Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Tue, 20 Feb 2018 23:56:06 -0800 Subject: [PATCH 5/9] Renamed .bat to .cmd to match modern naming guidelines, added batch file to initiate Menu mode --- CodeWalker Explorer.bat => CodeWalker Explorer.cmd | 0 CodeWalker Menu.cmd | 1 + 2 files changed, 1 insertion(+) rename CodeWalker Explorer.bat => CodeWalker Explorer.cmd (100%) create mode 100644 CodeWalker Menu.cmd diff --git a/CodeWalker Explorer.bat b/CodeWalker Explorer.cmd similarity index 100% rename from CodeWalker Explorer.bat rename to CodeWalker Explorer.cmd diff --git a/CodeWalker Menu.cmd b/CodeWalker Menu.cmd new file mode 100644 index 0000000..bfd5f75 --- /dev/null +++ b/CodeWalker Menu.cmd @@ -0,0 +1 @@ +start codewalker menu \ No newline at end of file From d7938dd1d837ecb2bed6314d804345cb4b9a4973 Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Wed, 21 Feb 2018 00:27:01 -0800 Subject: [PATCH 6/9] Added GTA V folder check to main entry point in Program.cs, improved folder selection dialog - Added bool app setting for remember GTA folder (vs. prompt every start) - Added checkbox to folder selection dialog for remember GTA folder - Changed folder selection dialog to fixed dialog window border - Set default Enter/Esc buttons on folder selection dialog --- App.config | 3 +++ ExploreForm.cs | 4 +++- Program.cs | 6 ++++++ Properties/Settings.Designer.cs | 14 +++++++++++++- Properties/Settings.settings | 3 +++ SelectFolderForm.Designer.cs | 19 +++++++++++++++++++ SelectFolderForm.cs | 6 ++++++ Utils/GTAFolder.cs | 2 +- WorldForm.cs | 31 ++----------------------------- 9 files changed, 56 insertions(+), 32 deletions(-) diff --git a/App.config b/App.config index e08b7b2..408ceae 100644 --- a/App.config +++ b/App.config @@ -193,6 +193,9 @@ False + + True + \ No newline at end of file diff --git a/ExploreForm.cs b/ExploreForm.cs index 3ac2c2f..c05dd11 100644 --- a/ExploreForm.cs +++ b/ExploreForm.cs @@ -59,7 +59,9 @@ namespace CodeWalker InitFileTypes(); - /*if (!EnsureGTAFolder())*/ + // This is probably not necessary now that the GTA folder is checked + // in the Program.cs when the game is initiated, but we will leave it + // here for now to make sure if(!GTAFolder.UpdateGTAFolder(true)) { Close(); diff --git a/Program.cs b/Program.cs index 6de659b..1d1b43e 100644 --- a/Program.cs +++ b/Program.cs @@ -14,6 +14,12 @@ namespace CodeWalker [STAThread] static void Main(string[] args) { + // Always check the GTA folder first thing + if(!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder)) + { + MessageBox.Show("Could not load CodeWalker because no GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop); + return; + } bool menumode = false; bool explorermode = false; diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index a9e64f2..76621d0 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -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; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 903cc47..f2aa187 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -183,5 +183,8 @@ False + + True + \ No newline at end of file diff --git a/SelectFolderForm.Designer.cs b/SelectFolderForm.Designer.cs index a23879e..af38e99 100644 --- a/SelectFolderForm.Designer.cs +++ b/SelectFolderForm.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/SelectFolderForm.cs b/SelectFolderForm.cs index 45c69c2..fe8c0a6 100644 --- a/SelectFolderForm.cs +++ b/SelectFolderForm.cs @@ -26,6 +26,7 @@ namespace CodeWalker private void SelectFolderForm_Load(object sender, EventArgs e) { FolderTextBox.Text = Settings.Default.GTAFolder; + RememberFolderCheckbox.Checked = Settings.Default.RememberGTAFolder; } private void FolderBrowseButton_Click(object sender, EventArgs e) @@ -63,5 +64,10 @@ namespace CodeWalker Result = DialogResult.OK; Close(); } + + private void RememberFolderCheckbox_CheckedChanged(object sender, EventArgs e) + { + Settings.Default.RememberGTAFolder = RememberFolderCheckbox.Checked; + } } } diff --git a/Utils/GTAFolder.cs b/Utils/GTAFolder.cs index abcd3d9..e649310 100644 --- a/Utils/GTAFolder.cs +++ b/Utils/GTAFolder.cs @@ -65,7 +65,7 @@ namespace CodeWalker return true; } else { - var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\n{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); + var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\n\n{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if(tryAgain == DialogResult.Retry) { return UpdateGTAFolder(false); diff --git a/WorldForm.cs b/WorldForm.cs index d2e00b0..fad46d9 100644 --- a/WorldForm.cs +++ b/WorldForm.cs @@ -226,38 +226,11 @@ namespace CodeWalker MouseWheel += WorldForm_MouseWheel; - string fldr = Settings.Default.GTAFolder; - if (string.IsNullOrEmpty(fldr) || !Directory.Exists(fldr)) + if (!GTAFolder.UpdateGTAFolder(true)) { - SelectFolderForm f = new SelectFolderForm(); - f.ShowDialog(); - if (f.Result == DialogResult.OK) - { - fldr = f.SelectedFolder; - } - else - { - //MessageBox.Show("No GTAV folder was chosen. CodeWalker will now exit."); - Close(); - return; - } - } - - if (!Directory.Exists(fldr)) - { - MessageBox.Show("The specified folder does not exist:\n" + fldr); Close(); return; } - if (!File.Exists(fldr + "\\gta5.exe")) - { - MessageBox.Show("GTA5.exe not found in folder:\n" + fldr); - Close(); - return; - } - - Settings.Default.GTAFolder = fldr; //seems ok, save it for later - Widget.Position = new Vector3(1.0f, 10.0f, 100.0f); Widget.Rotation = Quaternion.Identity; @@ -3889,7 +3862,7 @@ namespace CodeWalker try { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); //now loads from magic + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); //now loads from magic } catch { From d82c34c542077d451de794534d0cf1ea0efda6fd Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Wed, 21 Feb 2018 00:34:49 -0800 Subject: [PATCH 7/9] Fixed order of code in Program.cs causing exception from creating windows form before SetCompatibleTextRenderingDefault, changed dialog boxes a bit and cleaned up validation code in SelectFolderForm --- Program.cs | 15 ++++++++------- SelectFolderForm.cs | 10 +++------- Utils/GTAFolder.cs | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Program.cs b/Program.cs index 1d1b43e..18497a7 100644 --- a/Program.cs +++ b/Program.cs @@ -14,12 +14,6 @@ namespace CodeWalker [STAThread] static void Main(string[] args) { - // Always check the GTA folder first thing - if(!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder)) - { - MessageBox.Show("Could not load CodeWalker because no GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop); - return; - } bool menumode = false; bool explorermode = false; @@ -42,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 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()); } diff --git a/SelectFolderForm.cs b/SelectFolderForm.cs index fe8c0a6..e013bfa 100644 --- a/SelectFolderForm.cs +++ b/SelectFolderForm.cs @@ -51,16 +51,12 @@ 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(); } diff --git a/Utils/GTAFolder.cs b/Utils/GTAFolder.cs index e649310..2f30515 100644 --- a/Utils/GTAFolder.cs +++ b/Utils/GTAFolder.cs @@ -65,7 +65,7 @@ namespace CodeWalker 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.Warning, MessageBoxDefaultButton.Button1); + var tryAgain = MessageBox.Show($"Folder \"{folder}\" is not a valid GTA folder:\n\n{failReason}\n\nDo you want to try choosing a different folder?", "Unable to set GTA Folder", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if(tryAgain == DialogResult.Retry) { return UpdateGTAFolder(false); From 6ae3b470f63a6df81ea43f9421901aed1b18454c Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Wed, 21 Feb 2018 01:12:17 -0800 Subject: [PATCH 8/9] Switched everything to new GTAFolder class and removed all direct references to Settings.Default.GTAFolder --- BinarySearchForm.cs | 4 ++-- BrowseForm.Designer.cs | 2 +- BrowseForm.cs | 17 ++++------------- ExtractKeysForm.Designer.cs | 2 +- ExtractKeysForm.cs | 19 +++++-------------- ExtractRawForm.Designer.cs | 2 +- ExtractRawForm.cs | 17 ++++------------- ExtractScriptsForm.Designer.cs | 2 +- ExtractScriptsForm.cs | 17 ++++------------- ExtractShadersForm.Designer.cs | 1 + ExtractShadersForm.cs | 17 +++++------------ ExtractTexForm.Designer.cs | 2 +- ExtractTexForm.cs | 17 ++++------------- ExtractTexForm.resx | 3 --- Forms/MetaForm.cs | 2 +- Forms/ModelForm.cs | 29 +---------------------------- Forms/TextForm.cs | 2 +- Forms/XmlForm.cs | 2 +- GameFiles/GameFileCache.cs | 2 +- JenkIndForm.cs | 2 +- Program.cs | 2 +- SelectFolderForm.cs | 2 +- SettingsForm.Designer.cs | 28 +++++++++++++--------------- SettingsForm.cs | 17 +++-------------- SettingsForm.resx | 3 --- Utils/GTAFolder.cs | 6 +++++- 26 files changed, 63 insertions(+), 156 deletions(-) diff --git a/BinarySearchForm.cs b/BinarySearchForm.cs index fe82c9c..c5443ce 100644 --- a/BinarySearchForm.cs +++ b/BinarySearchForm.cs @@ -41,9 +41,9 @@ namespace CodeWalker { Task.Run(() => { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); RpfMan = new RpfManager(); - RpfMan.Init(Settings.Default.GTAFolder, UpdateStatus, UpdateStatus, false, false); + RpfMan.Init(GTAFolder.CurrentGTAFolder, UpdateStatus, UpdateStatus, false, false); RPFScanComplete(); }); } diff --git a/BrowseForm.Designer.cs b/BrowseForm.Designer.cs index 6d53b64..9c9c3f7 100644 --- a/BrowseForm.Designer.cs +++ b/BrowseForm.Designer.cs @@ -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 // diff --git a/BrowseForm.cs b/BrowseForm.cs index 56bc283..b92f1f2 100644 --- a/BrowseForm.cs +++ b/BrowseForm.cs @@ -55,7 +55,7 @@ namespace CodeWalker } } - FolderTextBox.Text = Settings.Default.GTAFolder; + FolderTextBox.Text = GTAFolder.CurrentGTAFolder; DataHexLineCombo.Text = "16"; DataTextBox.SetTabStopWidth(3); @@ -64,7 +64,7 @@ namespace CodeWalker try { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; 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) { - 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) diff --git a/ExtractKeysForm.Designer.cs b/ExtractKeysForm.Designer.cs index df85296..6daed46 100644 --- a/ExtractKeysForm.Designer.cs +++ b/ExtractKeysForm.Designer.cs @@ -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 // diff --git a/ExtractKeysForm.cs b/ExtractKeysForm.cs index ee97408..a814e66 100644 --- a/ExtractKeysForm.cs +++ b/ExtractKeysForm.cs @@ -26,11 +26,11 @@ namespace CodeWalker private void ExtractKeysForm_Load(object sender, EventArgs e) { - FolderTextBox.Text = Settings.Default.GTAFolder; + FolderTextBox.Text = GTAFolder.CurrentGTAFolder; try { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; 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) { - 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) diff --git a/ExtractRawForm.Designer.cs b/ExtractRawForm.Designer.cs index 2c14b15..cffa243 100644 --- a/ExtractRawForm.Designer.cs +++ b/ExtractRawForm.Designer.cs @@ -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 // diff --git a/ExtractRawForm.cs b/ExtractRawForm.cs index b199371..6299cf3 100644 --- a/ExtractRawForm.cs +++ b/ExtractRawForm.cs @@ -26,12 +26,12 @@ 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 { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; UpdateExtractStatus("Ready to extract."); } @@ -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) diff --git a/ExtractScriptsForm.Designer.cs b/ExtractScriptsForm.Designer.cs index 9d8accd..62ce428 100644 --- a/ExtractScriptsForm.Designer.cs +++ b/ExtractScriptsForm.Designer.cs @@ -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 // diff --git a/ExtractScriptsForm.cs b/ExtractScriptsForm.cs index 69abc39..d5209dc 100644 --- a/ExtractScriptsForm.cs +++ b/ExtractScriptsForm.cs @@ -28,12 +28,12 @@ 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 { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; UpdateDumpStatus("Ready."); UpdateExtractStatus("Ready to extract."); @@ -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) diff --git a/ExtractShadersForm.Designer.cs b/ExtractShadersForm.Designer.cs index 02e997f..0cd2d4a 100644 --- a/ExtractShadersForm.Designer.cs +++ b/ExtractShadersForm.Designer.cs @@ -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); diff --git a/ExtractShadersForm.cs b/ExtractShadersForm.cs index 3669a17..eb58711 100644 --- a/ExtractShadersForm.cs +++ b/ExtractShadersForm.cs @@ -26,12 +26,12 @@ 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 { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; UpdateExtractStatus("Ready to extract."); } @@ -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) diff --git a/ExtractTexForm.Designer.cs b/ExtractTexForm.Designer.cs index 1599947..b79ae82 100644 --- a/ExtractTexForm.Designer.cs +++ b/ExtractTexForm.Designer.cs @@ -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 // diff --git a/ExtractTexForm.cs b/ExtractTexForm.cs index 42df42c..a7ea7df 100644 --- a/ExtractTexForm.cs +++ b/ExtractTexForm.cs @@ -27,12 +27,12 @@ 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 { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); KeysLoaded = true; 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) { 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) diff --git a/ExtractTexForm.resx b/ExtractTexForm.resx index bd12579..1431f6b 100644 --- a/ExtractTexForm.resx +++ b/ExtractTexForm.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - diff --git a/Forms/MetaForm.cs b/Forms/MetaForm.cs index 9118e7c..17e8fe2 100644 --- a/Forms/MetaForm.cs +++ b/Forms/MetaForm.cs @@ -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; diff --git a/Forms/ModelForm.cs b/Forms/ModelForm.cs index e5f2e1b..7d75d3c 100644 --- a/Forms/ModelForm.cs +++ b/Forms/ModelForm.cs @@ -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) diff --git a/Forms/TextForm.cs b/Forms/TextForm.cs index 90ffb49..484dbcd 100644 --- a/Forms/TextForm.cs +++ b/Forms/TextForm.cs @@ -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; diff --git a/Forms/XmlForm.cs b/Forms/XmlForm.cs index 529d1ef..d814453 100644 --- a/Forms/XmlForm.cs +++ b/Forms/XmlForm.cs @@ -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; diff --git a/GameFiles/GameFileCache.cs b/GameFiles/GameFileCache.cs index 53e5483..e42d12e 100644 --- a/GameFiles/GameFileCache.cs +++ b/GameFiles/GameFileCache.cs @@ -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(); diff --git a/JenkIndForm.cs b/JenkIndForm.cs index 11782b9..91f2ff7 100644 --- a/JenkIndForm.cs +++ b/JenkIndForm.cs @@ -36,7 +36,7 @@ namespace CodeWalker { Task.Run(() => { - GTA5Keys.LoadFromPath(Settings.Default.GTAFolder); + GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder); GameFileCache gfc = new GameFileCache(); gfc.DoFullStringIndex = true; gfc.Init(UpdateStatus, UpdateStatus); diff --git a/Program.cs b/Program.cs index 18497a7..141a1dd 100644 --- a/Program.cs +++ b/Program.cs @@ -40,7 +40,7 @@ namespace CodeWalker // Always check the GTA folder first thing if (!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder)) { - MessageBox.Show("Could not load CodeWalker because no GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop); + 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 diff --git a/SelectFolderForm.cs b/SelectFolderForm.cs index e013bfa..4a243fb 100644 --- a/SelectFolderForm.cs +++ b/SelectFolderForm.cs @@ -25,7 +25,7 @@ namespace CodeWalker private void SelectFolderForm_Load(object sender, EventArgs e) { - FolderTextBox.Text = Settings.Default.GTAFolder; + FolderTextBox.Text = GTAFolder.CurrentGTAFolder; RememberFolderCheckbox.Checked = Settings.Default.RememberGTAFolder; } diff --git a/SettingsForm.Designer.cs b/SettingsForm.Designer.cs index a5abb2e..e8526bc 100644 --- a/SettingsForm.Designer.cs +++ b/SettingsForm.Designer.cs @@ -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; diff --git a/SettingsForm.cs b/SettingsForm.cs index 65f52d1..d9cc47c 100644 --- a/SettingsForm.cs +++ b/SettingsForm.cs @@ -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) diff --git a/SettingsForm.resx b/SettingsForm.resx index bd12579..1431f6b 100644 --- a/SettingsForm.resx +++ b/SettingsForm.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - diff --git a/Utils/GTAFolder.cs b/Utils/GTAFolder.cs index 2f30515..38c489a 100644 --- a/Utils/GTAFolder.cs +++ b/Utils/GTAFolder.cs @@ -49,6 +49,7 @@ namespace CodeWalker return true; } + string origFolder = CurrentGTAFolder; string folder = CurrentGTAFolder; SelectFolderForm f = new SelectFolderForm(); f.ShowDialog(); @@ -61,7 +62,10 @@ namespace CodeWalker if(ValidateGTAFolder(folder, out failReason)) { SetGTAFolder(folder); - MessageBox.Show($"Successfully set GTA Folder to \"{folder}\"", "Set GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Information); + if(folder != origFolder) + { + MessageBox.Show($"Successfully changed GTA Folder to \"{folder}\"", "Set GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Information); + } return true; } else { From 8fea0683e3ab5d683de36f58ba1424f51867f9ef Mon Sep 17 00:00:00 2001 From: PNWParksFan Date: Wed, 21 Feb 2018 01:24:01 -0800 Subject: [PATCH 9/9] Added self to credits :) --- AboutForm.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AboutForm.resx b/AboutForm.resx index 38771a4..5b28ab9 100644 --- a/AboutForm.resx +++ b/AboutForm.resx @@ -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 -- +-- The .White team -- CP -- Kilian -- PNWParksFan --