diff --git a/WiiExplorer/FilePropertyForm.cs b/WiiExplorer/FilePropertyForm.cs index 6cae8c2..a571bca 100644 --- a/WiiExplorer/FilePropertyForm.cs +++ b/WiiExplorer/FilePropertyForm.cs @@ -13,7 +13,7 @@ namespace WiiExplorer { public partial class FilePropertyForm : Form { - public FilePropertyForm(RARC.File currentfile, bool AllowCustomID) + public FilePropertyForm(TreeView treeview, RARC archive) { InitializeComponent(); CancelButton = DiscardButton; @@ -22,8 +22,10 @@ public FilePropertyForm(RARC.File currentfile, bool AllowCustomID) ARAMRadioButton.Tag = RARC.FileAttribute.PRELOAD_TO_ARAM; DVDRadioButton.Tag = RARC.FileAttribute.LOAD_FROM_DVD; - CurrentFile = currentfile; - IDNumericUpDown.Enabled = AllowCustomID; + ArchiveTreeView = treeview; + Archive = archive; + CurrentFile = Archive[ArchiveTreeView.SelectedNode.FullPath] as RARC.File; + IDNumericUpDown.Enabled = !Archive.KeepFileIDsSynced; CenterToParent(); @@ -49,6 +51,8 @@ private void FilePropertyForm_Load(object sender, EventArgs e) } RARC.File CurrentFile; + RARC Archive; + TreeView ArchiveTreeView; private void OKButton_Click(object sender, EventArgs e) { @@ -83,6 +87,17 @@ private void FilePropertyForm_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { + string prevname = ArchiveTreeView.SelectedNode.Text; + string prevpath = ArchiveTreeView.SelectedNode.FullPath; + ArchiveTreeView.SelectedNode.Text = NameTextBox.Text; + if (Archive.ItemExists(ArchiveTreeView.SelectedNode.FullPath) && (RARC.File)Archive[prevpath] != (RARC.File)Archive[ArchiveTreeView.SelectedNode.FullPath]) + { + ArchiveTreeView.SelectedNode.Text = prevname; + MessageBox.Show("There is already an item with this name in this directory", "Duplicate Name", MessageBoxButtons.OK, MessageBoxIcon.Error); + e.Cancel = true; + return; + } + Archive.MoveItem(prevpath, ArchiveTreeView.SelectedNode.FullPath); CurrentFile.Name = NameTextBox.Text; CurrentFile.ID = (short)IDNumericUpDown.Value; CurrentFile.FileSettings = RARC.FileAttribute.FILE | (IsCompressedCheckBox.Checked ? RARC.FileAttribute.COMPRESSED : 0) | (RARC.FileAttribute)FileSettingsGroupBox.Controls.OfType().FirstOrDefault(r => r.Checked).Tag | (IsYAZ0CheckBox.Checked ? RARC.FileAttribute.YAZ0_COMPRESSED : 0); diff --git a/WiiExplorer/MainForm.Designer.cs b/WiiExplorer/MainForm.Designer.cs index 9c62778..45cb73c 100644 --- a/WiiExplorer/MainForm.Designer.cs +++ b/WiiExplorer/MainForm.Designer.cs @@ -54,6 +54,7 @@ private void InitializeComponent() this.MainToolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar(); this.MainToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.RootPanel = new System.Windows.Forms.Panel(); + this.RootNameTextBox = new WiiExplorer.ColourTextBox(); this.KeepIDsSyncedCheckBox = new System.Windows.Forms.CheckBox(); this.RootNameLabel = new System.Windows.Forms.Label(); this.ArchiveTreeView = new System.Windows.Forms.TreeView(); @@ -67,7 +68,6 @@ private void InitializeComponent() this.ContextExportAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ContextReplaceSelectedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.Yaz0BackgroundWorker = new System.ComponentModel.BackgroundWorker(); - this.RootNameTextBox = new WiiExplorer.ColourTextBox(); this.MainFormMenuStrip.SuspendLayout(); this.MainFormStatusStrip.SuspendLayout(); this.RootPanel.SuspendLayout(); @@ -164,7 +164,7 @@ private void InitializeComponent() // this.AddFileToolStripMenuItem.Enabled = false; this.AddFileToolStripMenuItem.Name = "AddFileToolStripMenuItem"; - this.AddFileToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); + this.AddFileToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; this.AddFileToolStripMenuItem.Size = new System.Drawing.Size(243, 22); this.AddFileToolStripMenuItem.Text = "Add File(s)"; this.AddFileToolStripMenuItem.Click += new System.EventHandler(this.AddFileToolStripMenuItem_Click); @@ -309,6 +309,16 @@ private void InitializeComponent() this.RootPanel.Size = new System.Drawing.Size(464, 20); this.RootPanel.TabIndex = 3; // + // RootNameTextBox + // + this.RootNameTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.RootNameTextBox.Enabled = false; + this.RootNameTextBox.Location = new System.Drawing.Point(64, 0); + this.RootNameTextBox.Name = "RootNameTextBox"; + this.RootNameTextBox.Size = new System.Drawing.Size(267, 20); + this.RootNameTextBox.TabIndex = 0; + this.RootNameTextBox.TextChanged += new System.EventHandler(this.RootNameTextBox_TextChanged); + // // KeepIDsSyncedCheckBox // this.KeepIDsSyncedCheckBox.AutoSize = true; @@ -443,16 +453,6 @@ private void InitializeComponent() // this.Yaz0BackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.Yaz0BackgroundWorker_DoWork); // - // RootNameTextBox - // - this.RootNameTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.RootNameTextBox.Enabled = false; - this.RootNameTextBox.Location = new System.Drawing.Point(64, 0); - this.RootNameTextBox.Name = "RootNameTextBox"; - this.RootNameTextBox.Size = new System.Drawing.Size(267, 20); - this.RootNameTextBox.TabIndex = 0; - this.RootNameTextBox.TextChanged += new System.EventHandler(this.RootNameTextBox_TextChanged); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -463,12 +463,14 @@ private void InitializeComponent() this.Controls.Add(this.MainFormStatusStrip); this.Controls.Add(this.MainFormMenuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.KeyPreview = true; this.MainMenuStrip = this.MainFormMenuStrip; this.MinimumSize = new System.Drawing.Size(480, 390); this.Name = "MainForm"; this.Text = "WiiExplorer"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); this.Load += new System.EventHandler(this.MainForm_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown); this.MainFormMenuStrip.ResumeLayout(false); this.MainFormMenuStrip.PerformLayout(); this.MainFormStatusStrip.ResumeLayout(false); diff --git a/WiiExplorer/MainForm.cs b/WiiExplorer/MainForm.cs index c726c2a..8008c1f 100644 --- a/WiiExplorer/MainForm.cs +++ b/WiiExplorer/MainForm.cs @@ -27,12 +27,8 @@ public MainForm(string Openwith) string[] exts = File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory + "ExtensionList.txt"); KnownExtensions.AddRange(exts); for (int i = 0; i < exts.Length; i++) - { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\" + exts[i].Split('|')[0] + ".png")) - { ArchiveImageList.Images.Add(exts[i].Split('|')[1], new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\" + exts[i].Split('|')[0] + ".png")); - } - } } RootNameTextBox.ContextMenu = new ContextMenu(); @@ -598,21 +594,15 @@ private void SaveArchive(string Filename) private void AddFileToolStripMenuItem_Click(object sender, EventArgs e) { - if (RootNameTextBox.Focused) - { - RootNameTextBox.SelectAll(); - return; - } - TreeNode tmp = ArchiveTreeView.SelectedNode; - Fileofd.InitialDirectory = Properties.Settings.Default.PreviousAddFilePath; + Fileofd.InitialDirectory = Settings.Default.PreviousAddFilePath; if (Fileofd.ShowDialog() == DialogResult.OK && Fileofd.FileName != "") { ArchiveTreeView.SelectedNode = tmp; AddItemToRARC(Fileofd.FileNames); MainToolStripStatusLabel.Text = $"{Fileofd.FileNames.Length} File{(Fileofd.FileNames.Length > 1 ? "s":"")} added."; - Properties.Settings.Default.PreviousAddFilePath = new FileInfo(Fileofd.FileName).DirectoryName; - Properties.Settings.Default.Save(); + Settings.Default.PreviousAddFilePath = new FileInfo(Fileofd.FileName).DirectoryName; + Settings.Default.Save(); } ArchiveTreeView.SelectedNode = tmp; @@ -621,24 +611,28 @@ private void AddFileToolStripMenuItem_Click(object sender, EventArgs e) private void AddFolderToolStripMenuItem_Click(object sender, EventArgs e) { - TreeNode newnode = new TreeNode("New Folder") { ImageIndex = 0, SelectedImageIndex = 0 }; + TreeNode NewTreeNode = new TreeNode("New Folder") { ImageIndex = 0, SelectedImageIndex = 0 }; //SelectedNode is NULL, put the new file on the root if (ArchiveTreeView.SelectedNode == null) - ArchiveTreeView.Nodes.Add(newnode); + ArchiveTreeView.Nodes.Add(NewTreeNode); //Determine where to put it otherwise else { if (Archive[ArchiveTreeView.SelectedNode.FullPath] is RARC.Directory) - ArchiveTreeView.SelectedNode.Nodes.Add(newnode); + ArchiveTreeView.SelectedNode.Nodes.Add(NewTreeNode); else if (ArchiveTreeView.SelectedNode.Parent == null) - ArchiveTreeView.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, newnode); + ArchiveTreeView.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, NewTreeNode); else - ArchiveTreeView.SelectedNode.Parent.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, newnode); + ArchiveTreeView.SelectedNode.Parent.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, NewTreeNode); } - ArchiveTreeView.SelectedNode = newnode; - Archive[newnode.FullPath] = new RARC.Directory() { Name = "NewFolder" }; + ArchiveTreeView.SelectedNode = NewTreeNode; + int y = 2; + string folderstring = "New Folder"; + while (Archive.ItemExists(NewTreeNode.FullPath)) + NewTreeNode.Text = folderstring + $" ({y++})"; + Archive[NewTreeNode.FullPath] = new RARC.Directory() { Name = NewTreeNode.Text }; Edited = true; MainToolStripStatusLabel.Text = $"New Folder added."; @@ -669,6 +663,12 @@ private void AddItemToRARC(string[] FileNames) else ArchiveTreeView.SelectedNode.Parent.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, NewTreeNode); } + int y = 2; + string ogname = Path.GetFileNameWithoutExtension(FileNames[i]); + string ogextension = fi.Extension; + while (Archive.ItemExists(NewTreeNode.FullPath)) + NewTreeNode.Text = ogname+$" ({y++})"+ogextension; + CurrentFile.Name = NewTreeNode.Text; Archive[NewTreeNode.FullPath] = CurrentFile; } } @@ -689,13 +689,10 @@ private void RenameSelectedToolStripMenuItem_Click(object sender, EventArgs e) { if (ArchiveTreeView.SelectedNode == null) return; - RenameForm RN = new RenameForm(Archive[ArchiveTreeView.SelectedNode.FullPath]); string tmp = ArchiveTreeView.SelectedNode.Text; + RenameForm RN = new RenameForm(ArchiveTreeView, Archive); if (RN.ShowDialog() != DialogResult.OK) return; - string oldpath = ArchiveTreeView.SelectedNode.FullPath; - ArchiveTreeView.SelectedNode.Text = RN.NameTextBox.Text+RN.ExtensionTextBox.Text; - Archive.MoveItem(oldpath, ArchiveTreeView.SelectedNode.FullPath); Edited = true; MainToolStripStatusLabel.Text = $"\"{tmp}\" renamed to \"{RN.NameTextBox.Text+RN.ExtensionTextBox.Text}\""; @@ -728,30 +725,53 @@ private void ReplaceSelectedToolStripMenuItem_Click(object sender, EventArgs e) string OldPath = ArchiveTreeView.SelectedNode.FullPath; dynamic Item = Archive[OldPath]; - if (Item is RARC.Directory dir) + if (Item is RARC.Directory) { - CommonOpenFileDialog BFB = new CommonOpenFileDialog() { InitialDirectory = Properties.Settings.Default.PreviousAddFilePath, Multiselect = false, IsFolderPicker = true }; + CommonOpenFileDialog BFB = new CommonOpenFileDialog() { InitialDirectory = Settings.Default.PreviousAddFilePath, Multiselect = false, IsFolderPicker = true }; if (BFB.ShowDialog() == CommonFileDialogResult.Ok && !BFB.FileName.Equals("")) { string oldname = ArchiveTreeView.SelectedNode.Text; - - dir.Clear(); - ArchiveTreeView.SelectedNode.Nodes.Clear(); - ArchiveTreeView.SelectedNode.Text = new DirectoryInfo(BFB.FileName).Name; - Archive.MoveItem(dir.FullPath, ArchiveTreeView.SelectedNode.FullPath); - dir.CreateFromFolder(BFB.FileName); + DirectoryInfo fi = new DirectoryInfo(BFB.FileName); + ArchiveTreeView.SelectedNode.Text = fi.Name; + int y = 2; + string ogname = Path.GetFileNameWithoutExtension(fi.Name); + while (Archive.ItemExists(ArchiveTreeView.SelectedNode.FullPath) && Archive[ArchiveTreeView.SelectedNode.FullPath] != Archive[OldPath]) + { + ArchiveTreeView.SelectedNode.Text = ogname + $" ({y++})"; + } + ArchiveTreeView.SelectedNode.ImageIndex = ArchiveTreeView.SelectedNode.SelectedImageIndex = 0; + Archive[OldPath] = null; + RARC.Directory dir = new RARC.Directory() { Name = ArchiveTreeView.SelectedNode.Text }; + Archive[ArchiveTreeView.SelectedNode.FullPath] = dir; + dir.CreateFromFolder(BFB.FileName); + string currentpath = ArchiveTreeView.SelectedNode.FullPath; + int previndex = ArchiveTreeView.SelectedNode.Index; ArchiveTreeView.Nodes.Clear(); ArchiveTreeView.Nodes.AddRange(Archive.ToTreeNode(0, ArchiveImageList)); - ArchiveTreeView.SelectedNode = ArchiveTreeView.Nodes.FindTreeNodeByFullPath(OldPath); - Properties.Settings.Default.PreviousAddFilePath = new DirectoryInfo(BFB.FileName).Parent.FullName; - Properties.Settings.Default.Save(); + ArchiveTreeView.SelectedNode = ArchiveTreeView.Nodes.FindTreeNodeByFullPath(currentpath); + TreeNode tmp = ArchiveTreeView.SelectedNode; + if (tmp.Parent == null) + { + ArchiveTreeView.Nodes.Remove(tmp); + ArchiveTreeView.Nodes.Insert(previndex, tmp); + } + else + { + TreeNode Parent = tmp.Parent; + Parent.Nodes.Remove(tmp); + Parent.Nodes.Insert(previndex, tmp); + } + + Settings.Default.PreviousAddFilePath = new DirectoryInfo(BFB.FileName).Parent.FullName; + Settings.Default.Save(); + Edited = true; MainToolStripStatusLabel.Text = $"\"{new DirectoryInfo(BFB.FileName).Name}\" has replaced \"{oldname}\"!"; } } else if (Item is RARC.File file) { - Fileofd.InitialDirectory = Properties.Settings.Default.PreviousAddFilePath; + Fileofd.InitialDirectory = Settings.Default.PreviousAddFilePath; if (Fileofd.ShowDialog() == DialogResult.OK && Fileofd.FileName != "") { string oldname = ArchiveTreeView.SelectedNode.Text; @@ -761,15 +781,20 @@ private void ReplaceSelectedToolStripMenuItem_Click(object sender, EventArgs e) imageindex = ArchiveImageList.Images.IndexOfKey("*" + fi.Extension); ArchiveTreeView.SelectedNode.Text = fi.Name; + int y = 2; + string ogname = Path.GetFileNameWithoutExtension(fi.Name); + string ogextension = fi.Extension; + while (Archive.ItemExists(ArchiveTreeView.SelectedNode.FullPath)) + { + ArchiveTreeView.SelectedNode.Text = ogname + $" ({y++})" + ogextension; + } ArchiveTreeView.SelectedNode.ImageIndex = ArchiveTreeView.SelectedNode.SelectedImageIndex = imageindex; Archive[OldPath] = null; - Archive[ArchiveTreeView.SelectedNode.FullPath] = new RARC.File(Fileofd.FileName); - - ArchiveTreeView.SelectedNode = ArchiveTreeView.Nodes.FindTreeNodeByFullPath(OldPath); + Archive[ArchiveTreeView.SelectedNode.FullPath] = new RARC.File(Fileofd.FileName) { Name = ArchiveTreeView.SelectedNode.Text }; - - Properties.Settings.Default.PreviousAddFilePath = new FileInfo(Fileofd.FileName).DirectoryName; - Properties.Settings.Default.Save(); + Settings.Default.PreviousAddFilePath = new FileInfo(Fileofd.FileName).DirectoryName; + Settings.Default.Save(); + Edited = true; MainToolStripStatusLabel.Text = $"\"{new FileInfo(Fileofd.FileName).Name}\" has replaced \"{oldname}\"!"; } } @@ -844,35 +869,42 @@ private void ArchiveTreeView_AfterSelect(object sender, TreeViewEventArgs e) private void ImportFolderToolStripMenuItem_Click(object sender, EventArgs e) { - CommonOpenFileDialog BFB = new CommonOpenFileDialog() { InitialDirectory = Properties.Settings.Default.PreviousAddFilePath, Multiselect = false, IsFolderPicker = true }; + CommonOpenFileDialog BFB = new CommonOpenFileDialog() { InitialDirectory = Settings.Default.PreviousAddFilePath, Multiselect = false, IsFolderPicker = true }; if (BFB.ShowDialog() == CommonFileDialogResult.Ok && !BFB.FileName.Equals("")) { - TreeNode newnode = new TreeNode(new DirectoryInfo(BFB.FileName).Name) { ImageIndex = 0, SelectedImageIndex = 0 }; + string ogname = new DirectoryInfo(BFB.FileName).Name; + TreeNode NewTreeNode = new TreeNode(ogname) { ImageIndex = 0, SelectedImageIndex = 0 }; //SelectedNode is NULL, put the new file on the root if (ArchiveTreeView.SelectedNode == null) - ArchiveTreeView.Nodes.Add(newnode); + ArchiveTreeView.Nodes.Add(NewTreeNode); //Determine where to put it otherwise else { if (Archive[ArchiveTreeView.SelectedNode.FullPath] is RARC.Directory) - ArchiveTreeView.SelectedNode.Nodes.Add(newnode); + ArchiveTreeView.SelectedNode.Nodes.Add(NewTreeNode); else if (ArchiveTreeView.SelectedNode.Parent == null) - ArchiveTreeView.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, newnode); + ArchiveTreeView.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, NewTreeNode); else - ArchiveTreeView.SelectedNode.Parent.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, newnode); + ArchiveTreeView.SelectedNode.Parent.Nodes.Insert(ArchiveTreeView.SelectedNode.Index + 1, NewTreeNode); } - ArchiveTreeView.SelectedNode = newnode; + ArchiveTreeView.SelectedNode = NewTreeNode; RARC.Directory dir = new RARC.Directory(BFB.FileName); - Archive[newnode.FullPath] = dir; + int y = 2; + while (Archive.ItemExists(NewTreeNode.FullPath)) + { + NewTreeNode.Text = ogname + $" ({y++})"; + } + dir.Name = NewTreeNode.Text; + Archive[NewTreeNode.FullPath] = dir; ArchiveTreeView.Nodes.Clear(); ArchiveTreeView.Nodes.AddRange(Archive.ToTreeNode(0, ArchiveImageList)); - ArchiveTreeView.SelectedNode = newnode; - newnode.Expand(); - Properties.Settings.Default.PreviousAddFilePath = new DirectoryInfo(BFB.FileName).Parent.FullName; - Properties.Settings.Default.Save(); + ArchiveTreeView.SelectedNode = NewTreeNode; + + Settings.Default.PreviousAddFilePath = new DirectoryInfo(BFB.FileName).Parent.FullName; + Settings.Default.Save(); Edited = true; MainToolStripStatusLabel.Text = $"Folder \"{BFB.FileName}\" Imported."; } @@ -923,9 +955,12 @@ private void ItemPropertiesToolStripMenuItem_Click(object sender, EventArgs e) ItemPropertiesToolStripMenuItem.Enabled = false; return; } - FilePropertyForm FPF = new FilePropertyForm((RARC.File)Archive[ArchiveTreeView.SelectedNode.FullPath], !Archive.KeepFileIDsSynced); + FilePropertyForm FPF = new FilePropertyForm(ArchiveTreeView, Archive); if (FPF.ShowDialog() == DialogResult.OK) + { Edited = true; + MainToolStripStatusLabel.Text = $"Properties of \"{ArchiveTreeView.SelectedNode.Text}\" have been updated."; + } } private void RootNameTextBox_TextChanged(object sender, EventArgs e) @@ -949,11 +984,13 @@ private void SwitchThemeToolStripMenuItem_Click(object sender, EventArgs e) ReloadTheme(); Settings.Default.Save(); } + private void ReloadTheme() { ForeColor = Program.ProgramColours.TextColour; BackColor = Program.ProgramColours.ControlBackColor; MainFormMenuStrip.Renderer = Settings.Default.IsDarkMode ? new MyRenderer() : default; + ArchiveContextMenuStrip.Renderer = Settings.Default.IsDarkMode ? new MyRenderer() : default; for (int i = 0; i < FileToolStripMenuItem.DropDownItems.Count; i++) { FileToolStripMenuItem.DropDownItems[i].BackColor = Program.ProgramColours.WindowColour; @@ -964,6 +1001,11 @@ private void ReloadTheme() EditToolStripMenuItem.DropDownItems[i].BackColor = Program.ProgramColours.WindowColour; EditToolStripMenuItem.DropDownItems[i].ForeColor = Program.ProgramColours.TextColour; } + for (int i = 0; i < ArchiveContextMenuStrip.Items.Count; i++) + { + ArchiveContextMenuStrip.Items[i].BackColor = Program.ProgramColours.WindowColour; + ArchiveContextMenuStrip.Items[i].ForeColor = Program.ProgramColours.TextColour; + } Yaz0ToolStripComboBox.BackColor = Program.ProgramColours.WindowColour; Yaz0ToolStripComboBox.ForeColor = Program.ProgramColours.TextColour; RootNameTextBox.BackColor = RootNameTextBox.BorderColor = Program.ProgramColours.ControlBackColor; @@ -1122,5 +1164,16 @@ private void MainFormMenuStrip_Paint(object sender, PaintEventArgs e) } } } + + private void MainForm_KeyDown(object sender, KeyEventArgs e) + { + if (e.Control && e.KeyCode == Keys.A) + { + if (RootNameTextBox.Focused) + RootNameTextBox.SelectAll(); + else + AddFileToolStripMenuItem_Click(sender, EventArgs.Empty); + } + } } } \ No newline at end of file diff --git a/WiiExplorer/MainForm.resx b/WiiExplorer/MainForm.resx index 48c2b70..15e4932 100644 --- a/WiiExplorer/MainForm.resx +++ b/WiiExplorer/MainForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABS - DgAAAk1TRnQBSQFMAgEBAwEAATABAQEwAQEBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + DgAAAk1TRnQBSQFMAgEBAwEAATgBAQE4AQEBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABEAMAAQEBAAEgBgABEJoAAwwEEAEWAxABFgMQARYDEAEWAxABFgMQARYDEAEWAxABFgMQARYDEAEW AxABFgMEAQVLAAEBAwYBCAMKAQ0DCgENAwoBDQMKAQ0DCgENAwoBDQMKAQ0DCgENAwoBDQMKAQ0DBwEK AwMBBAsAAQEDBgEIAwoBDQMKAQ0DCgENAwoBDQMKAQ0DCgENAwoBDQMKAQ0DBwEKAwMBBBQAA18B8wKu @@ -136,57 +136,57 @@ Aa0B/wMQARZEAAMEAQUDJAE2A0QBeQNKAYsDSgGLA0oBiwNKAYsDSgGLA0oBiwNKAYsDSgGLA0oBiwNK AYsDRwGCAzMBUgMLAQ8DBAEFAyQBNgNEAXkDSgGLA0oBiwNKAYsDSgGLA0oBiwNKAYsDSgGLA0oBiwNF AX8DKQE/AwMBBBAAAq4BqwX/A/4B/wP+Af8D/gH/A/4B/wP+Af8D/gH/A/4B/wP+Af8D/gX/AxABFkQA - Ax0BKg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plorer/RenameForm.Designer.cs +++ b/WiiExplorer/RenameForm.Designer.cs @@ -29,11 +29,13 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RenameForm)); - this.NameTextBox = new ColourTextBox(); + this.NameTextBox = new WiiExplorer.ColourTextBox(); this.InfoLabel = new System.Windows.Forms.Label(); this.TextPanel = new System.Windows.Forms.Panel(); - this.ExtensionTextBox = new ColourTextBox(); + this.ExtensionTextBox = new WiiExplorer.ColourTextBox(); this.ExtensionLabel = new System.Windows.Forms.Label(); + this.OKButton = new System.Windows.Forms.Button(); + this.DiscardButton = new System.Windows.Forms.Button(); this.TextPanel.SuspendLayout(); this.SuspendLayout(); // @@ -43,53 +45,84 @@ private void InitializeComponent() this.NameTextBox.Dock = System.Windows.Forms.DockStyle.Fill; this.NameTextBox.Location = new System.Drawing.Point(0, 0); this.NameTextBox.Name = "NameTextBox"; - this.NameTextBox.Size = new System.Drawing.Size(265, 20); + this.NameTextBox.Size = new System.Drawing.Size(241, 20); this.NameTextBox.TabIndex = 0; // // InfoLabel // - this.InfoLabel.Dock = System.Windows.Forms.DockStyle.Fill; - this.InfoLabel.Location = new System.Drawing.Point(0, 0); + this.InfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.InfoLabel.Location = new System.Drawing.Point(12, 9); this.InfoLabel.Name = "InfoLabel"; - this.InfoLabel.Size = new System.Drawing.Size(265, 21); + this.InfoLabel.Size = new System.Drawing.Size(241, 22); this.InfoLabel.TabIndex = 1; this.InfoLabel.Text = "Type the new name, then press Enter"; this.InfoLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // TextPanel // + this.TextPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.TextPanel.Controls.Add(this.NameTextBox); this.TextPanel.Controls.Add(this.ExtensionTextBox); - this.TextPanel.Dock = System.Windows.Forms.DockStyle.Bottom; - this.TextPanel.Location = new System.Drawing.Point(0, 21); + this.TextPanel.Location = new System.Drawing.Point(12, 34); this.TextPanel.Name = "TextPanel"; - this.TextPanel.Size = new System.Drawing.Size(324, 20); + this.TextPanel.Size = new System.Drawing.Size(300, 20); this.TextPanel.TabIndex = 2; // // ExtensionTextBox // this.ExtensionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ExtensionTextBox.Dock = System.Windows.Forms.DockStyle.Right; - this.ExtensionTextBox.Location = new System.Drawing.Point(265, 0); + this.ExtensionTextBox.Location = new System.Drawing.Point(241, 0); this.ExtensionTextBox.Name = "ExtensionTextBox"; this.ExtensionTextBox.Size = new System.Drawing.Size(59, 20); this.ExtensionTextBox.TabIndex = 1; // // ExtensionLabel // - this.ExtensionLabel.Dock = System.Windows.Forms.DockStyle.Right; - this.ExtensionLabel.Location = new System.Drawing.Point(265, 0); + this.ExtensionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ExtensionLabel.Location = new System.Drawing.Point(253, 9); this.ExtensionLabel.Name = "ExtensionLabel"; this.ExtensionLabel.Size = new System.Drawing.Size(59, 21); this.ExtensionLabel.TabIndex = 3; this.ExtensionLabel.Text = "Extension"; this.ExtensionLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; // + // OKButton + // + this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OKButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.OKButton.Location = new System.Drawing.Point(237, 64); + this.OKButton.Name = "OKButton"; + this.OKButton.Size = new System.Drawing.Size(75, 23); + this.OKButton.TabIndex = 4; + this.OKButton.Text = "OK"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKButton_Click); + // + // DiscardButton + // + this.DiscardButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.DiscardButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.DiscardButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.DiscardButton.Location = new System.Drawing.Point(12, 64); + this.DiscardButton.Name = "DiscardButton"; + this.DiscardButton.Size = new System.Drawing.Size(75, 23); + this.DiscardButton.TabIndex = 5; + this.DiscardButton.Text = "Cancel"; + this.DiscardButton.UseVisualStyleBackColor = true; + this.DiscardButton.Click += new System.EventHandler(this.DiscardButton_Click); + // // RenameForm // + this.AcceptButton = this.OKButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(324, 41); + this.CancelButton = this.DiscardButton; + this.ClientSize = new System.Drawing.Size(324, 99); + this.Controls.Add(this.DiscardButton); + this.Controls.Add(this.OKButton); this.Controls.Add(this.InfoLabel); this.Controls.Add(this.ExtensionLabel); this.Controls.Add(this.TextPanel); @@ -97,11 +130,10 @@ private void InitializeComponent() this.KeyPreview = true; this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(340, 80); + this.MinimumSize = new System.Drawing.Size(340, 138); this.Name = "RenameForm"; this.Text = "WiiExplorer - Rename []"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RenameForm_FormClosing); - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ZoneForm_KeyDown); this.TextPanel.ResumeLayout(false); this.TextPanel.PerformLayout(); this.ResumeLayout(false); @@ -114,5 +146,7 @@ private void InitializeComponent() private System.Windows.Forms.Panel TextPanel; public ColourTextBox ExtensionTextBox; private System.Windows.Forms.Label ExtensionLabel; + private System.Windows.Forms.Button OKButton; + private System.Windows.Forms.Button DiscardButton; } } \ No newline at end of file diff --git a/WiiExplorer/RenameForm.cs b/WiiExplorer/RenameForm.cs index d3dbb7c..05cbcd6 100644 --- a/WiiExplorer/RenameForm.cs +++ b/WiiExplorer/RenameForm.cs @@ -14,18 +14,20 @@ namespace WiiExplorer { public partial class RenameForm : Form { - public RenameForm(object Item) + public RenameForm(TreeView treeview, RARC archive) { InitializeComponent(); CenterToParent(); MaximumSize = new Size(Screen.GetBounds(Location).Width, Height); - string OGName = ((dynamic)Item).Name; + Archive = archive; + ArchiveTreeView = treeview; + CurrentItem = Archive[treeview.SelectedNode.FullPath]; + string OGName = CurrentItem.Name; Text = Text.Replace("[]", $"\"{OGName}\""); - if (!(Item is RARC.Directory)) + if (!(CurrentItem is RARC.Directory)) { FileInfo fi = new FileInfo(OGName); - string[] splits = fi.Name.Split('.'); - NameTextBox.Text = fi.Name.Replace("."+splits[splits.Length - 1], ""); + NameTextBox.Text = Path.GetFileNameWithoutExtension(OGName); ExtensionTextBox.Text = fi.Extension; } else @@ -35,30 +37,47 @@ public RenameForm(object Item) NameTextBox.Text = OGName; } - ForeColor = Program.ProgramColours.TextColour; BackColor = Program.ProgramColours.ControlBackColor; - NameTextBox.BackColor = ExtensionTextBox.BackColor = Program.ProgramColours.ControlBackColor; - NameTextBox.ForeColor = ExtensionTextBox.ForeColor = Program.ProgramColours.TextColour; + NameTextBox.BackColor = OKButton.BackColor = DiscardButton.BackColor = ExtensionTextBox.BackColor = Program.ProgramColours.ControlBackColor; + NameTextBox.ForeColor = OKButton.ForeColor = DiscardButton.ForeColor = ExtensionTextBox.ForeColor = Program.ProgramColours.TextColour; NameTextBox.BorderColor = ExtensionTextBox.BorderColor = Program.ProgramColours.BorderColour; - } - bool complete = false; - private void ZoneForm_KeyDown(object sender, KeyEventArgs e) + dynamic CurrentItem; + RARC Archive; + TreeView ArchiveTreeView; + + private void RenameForm_FormClosing(object sender, FormClosingEventArgs e) { - if (e.KeyCode == Keys.Enter) - { - complete = true; - Close(); - } - else if (e.KeyCode == Keys.Escape) + if (DialogResult == DialogResult.OK) { - complete = false; - Close(); + string prevname = ArchiveTreeView.SelectedNode.Text; + string prevpath = ArchiveTreeView.SelectedNode.FullPath; + string finalname = NameTextBox.Text + (CurrentItem is RARC.File ? ExtensionTextBox.Text : ""); + ArchiveTreeView.SelectedNode.Text = finalname; + if (Archive.ItemExists(ArchiveTreeView.SelectedNode.FullPath) && Archive[prevpath] != Archive[ArchiveTreeView.SelectedNode.FullPath]) + { + ArchiveTreeView.SelectedNode.Text = prevname; + MessageBox.Show("There is already an item with this name in this directory", "Duplicate Name", MessageBoxButtons.OK, MessageBoxIcon.Error); + e.Cancel = true; + return; + } + Archive.MoveItem(prevpath, ArchiveTreeView.SelectedNode.FullPath); + CurrentItem.Name = finalname; } } - private void RenameForm_FormClosing(object sender, FormClosingEventArgs e) => DialogResult = complete ? DialogResult.OK : DialogResult.Cancel; + private void OKButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + Close(); + } + + private void DiscardButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } } } diff --git a/WiiExplorer/WiiExplorer.csproj b/WiiExplorer/WiiExplorer.csproj index 0550abd..55ca99c 100644 --- a/WiiExplorer/WiiExplorer.csproj +++ b/WiiExplorer/WiiExplorer.csproj @@ -33,6 +33,7 @@ TRACE prompt 4 + latest WiiExplorer.ico