Skip to content

Commit

Permalink
Finished doing the backend stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperHackio committed Nov 16, 2020
1 parent 353542e commit ec0ef07
Show file tree
Hide file tree
Showing 7 changed files with 279 additions and 155 deletions.
21 changes: 18 additions & 3 deletions WiiExplorer/FilePropertyForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();


Expand All @@ -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)
{
Expand Down Expand Up @@ -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<RadioButton>().FirstOrDefault(r => r.Checked).Tag | (IsYAZ0CheckBox.Checked ? RARC.FileAttribute.YAZ0_COMPRESSED : 0);
Expand Down
26 changes: 14 additions & 12 deletions WiiExplorer/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ec0ef07

Please sign in to comment.