示例#1
0
        private void FilesaveRenameBtn_Click(object sender, EventArgs e)
        {
            InputBox input = new InputBox
            {
                Text = "Rename to?"
            };

            input.ShowDialog();
            if (string.IsNullOrEmpty(input.textBox1.Text))
            {
                return;
            }
            var exc = Path.GetExtension(Application.StartupPath + @"\Saves\" + FilesaveList.GetItemText(FilesaveList.SelectedItem));

            File.Move(Application.StartupPath + @"\Saves\" + FilesaveList.GetItemText(FilesaveList.SelectedItem), Application.StartupPath + "\\Saves\\" + input.textBox1.Text + exc);
            FilesaveList.Items.Clear();
            DirectoryInfo di = new DirectoryInfo(Application.StartupPath + @"\Saves\");

            FileInfo[] diar1 = di.GetFiles();

            // list the names of all files in the specified directory
            foreach (var dra in diar1)
            {
                FilesaveList.Items.Add(dra);
            }
            input.Dispose();
        }
示例#2
0
        private void FilesaveDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Are you sure you want to delete the selected items?", "",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    foreach (var item in FilesaveList.SelectedItems)
                    {
                        File.Delete(Application.StartupPath + @"\Saves\" + FilesaveList.GetItemText(item.ToString()));
                    }
                    FilesaveList.Items.Clear();
                    DirectoryInfo di    = new DirectoryInfo(Application.StartupPath + @"\Saves\");
                    FileInfo[]    diar1 = di.GetFiles();

                    // list the names of all files in the specified directory
                    foreach (var dra in diar1)
                    {
                        FilesaveList.Items.Add(dra);
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("Access Denied or nothing was selected for deletion. Check if you can write or have authorization to that directory.", "Error - LunarROMCorruptor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void FilesaveCopysavetobtn_Click(object sender, EventArgs e)
 {
     try
     {
         File.Copy(Application.StartupPath + @"\Saves\" + FilesaveList.GetItemText(FilesaveList.SelectedItem), SaveasTxt.Text, true);
     }
     catch (ArgumentException)
     {
         MessageBox.Show("Argument Exception (FileSave). Did you select an item?", "Error - LunarROMCorruptor", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }