Exemplo n.º 1
0
 private void RenameForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         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(Strings.ItemAlreadyExists, Strings.DuplicateName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             e.Cancel = true;
             return;
         }
         Archive.MoveItem(prevpath, ArchiveTreeView.SelectedNode.FullPath);
         CurrentItem.Name = finalname;
     }
 }
Exemplo n.º 2
0
 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(Strings.ItemAlreadyExists, Strings.DuplicateName, 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);
     }
 }