Example #1
0
 private void c_Move_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         string s = "Are you sure you want to move the selected " + ((listView1.SelectedItems.Count > 1) ? "items?" : "item?");
         DialogResult dr = DialogResult.No;
         if (Aero)
         {
             TaskDialog td = new TaskDialog();
             td.Caption = "Confirm Move";
             td.InstructionText = s;
             td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
             if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
             {
                 dr = DialogResult.Yes;
             }
         }
         else
         {
             dr = MessageBox.Show("Confirm Move", s, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
         }
         if (dr == DialogResult.Yes)
         {
             Forms.FolderSelector fs = new Party_Buffalo.Forms.FolderSelector(treeView1, treeView1.Nodes[0].Nodes.Find(treeView1.SelectedNode.RealPath().Split('\\')[0], false)[0]);
             if (fs.ShowDialog() == DialogResult.OK)
             {
                 string SelectedPath = fs.SelectedPath;
                 List<CLKsFATXLib.Structs.WriteResult> List = new List<CLKsFATXLib.Structs.WriteResult>();
                 foreach (ListViewItem li in listView1.SelectedItems)
                 {
                     Entry Entry = (Entry)li.Tag;
                     CLKsFATXLib.Structs.WriteResult wr = Entry.Move(SelectedPath);
                     if (wr.CouldNotWrite)
                     {
                         List.Add(wr);
                     }
                 }
                 if (List.Count != 0)
                 {
                     string UnableToWrite = "Some of the entries could not be written";
                     string BadEntries = "";
                     for (int i = 0; i < List.Count; i++)
                     {
                         BadEntries += List[i].AttemptedEntryToMove.FullPath;
                         if (i != List.Count - 1)
                         {
                             BadEntries += "\r\n";
                         }
                     }
                     if (Aero)
                     {
                         TaskDialog td = new TaskDialog();
                         td.Caption = "Moving Error";
                         td.InstructionText = UnableToWrite;
                         td.Text = "Press the details button for a list of entries that could not be moved";
                         td.DetailsExpandedText = BadEntries;
                         td.StandardButtons = TaskDialogStandardButtons.Ok;
                         td.ShowDialog(this.Handle);
                     }
                     else
                     {
                         MessageBox.Show("Moving Error", UnableToWrite + "\r\n\r\n" + BadEntries, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     }
                 }
             }
         }
     }
 }
Example #2
0
 private void c_Delete_Click(object sender, EventArgs e)
 {
     // String.format is a little redundant here...
     DialogResult dr = DialogResult.No;
     if (!Aero)
     {
         dr = MessageBox.Show(string.Format("Are you sure you want to delete the selected{0}?", (listView1.SelectedItems.Count > 1) ? " " + listView1.SelectedItems.Count.ToString() + " items" : " item"), "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
     }
     else
     {
         TaskDialog td = new TaskDialog();
         td.Caption = "Confirm Deletion";
         td.InstructionText = "Confirm Deletion";
         td.Text = string.Format("Are you sure you want to delete the selected{0}?", (listView1.SelectedItems.Count > 1) ? " " + listView1.SelectedItems.Count.ToString() + " items" : " item");
         td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
         if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
         {
             dr = DialogResult.Yes;
         }
     }
     if (dr == DialogResult.Yes)
     {
         List<Entry> items = new List<Entry>();
         foreach (ListViewItem li in listView1.SelectedItems)
         {
             items.Add((Entry)li.Tag);
         }
         Forms.EntryAction ea = new Party_Buffalo.Forms.EntryAction(items.ToArray(), Party_Buffalo.Forms.EntryAction.Method.Delete, "");
         ea.ShowDialog();
     }
 }
Example #3
0
        private void t_NewFolder_Click(object sender, EventArgs e)
        {
            try
            {
                ((Folder)rightClickedNode.Tag).CreateNewFolder(GetNewFolderName((Folder)rightClickedNode.Tag));
            }
            catch (Exception x)
            {
                if (!Aero)
                {
                    MessageBox.Show("An exception was thrown: " + x.Message + "\r\n\r\nIf this appears to be a bug, press CTRL + C to copy the stack trace, then please email it to me at [email protected]:\r\n" + x.StackTrace);
                }
                else
                {
                    TaskDialog td = new TaskDialog();
                    td.Caption = "Unhandled Exception";
                    td.InstructionText = "An Unhandled Exception was Thrown";
                    td.Text = string.Format("An exception was thrown: {0}\r\n\r\nIf this appears to be a bug, please email me at [email protected] with the details below", x.Message);
                    td.DetailsCollapsedLabel = "Details";
                    td.DetailsExpandedLabel = "Details";
                    td.DetailsExpandedText = x.StackTrace;

                    TaskDialogButton Copy = new TaskDialogButton("Copy", "Copy Details to Clipboard");
                    Copy.Click += (o, f) => { Clipboard.SetDataObject(x.Message + "\r\n\r\n" + x.StackTrace, true, 10, 200); };

                    TaskDialogButton Close = new TaskDialogButton("Close", "Close");
                    Close.Click += (o, f) => { td.Close(); };

                    td.Controls.Add(Copy);
                    td.Controls.Add(Close);
                    td.ShowDialog(this.Handle);
                }
            }
        }
Example #4
0
        private void t_Delete_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.No;
            if (!Aero)
            {
                dr = MessageBox.Show("Are you sure you want to delete the selected folder?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            }
            else
            {
                TaskDialog td = new TaskDialog();
                td.Caption = "Confirm Deletion";
                td.InstructionText = "Confirm Deletion";
                td.Text = string.Format("Are you sure you want to delete folder \"{0}\"?", rightClickedNode.Name);
                td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
                if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
                {
                    dr = DialogResult.Yes;
                }
            }

            if (dr == DialogResult.Yes)
            {
                List<Entry> items = new List<Entry>();
                items.Add((Entry)rightClickedNode.Tag);
                if (rightClickedNode == treeView1.SelectedNode)
                {
                    foreach (ListViewItem li in listView1.SelectedItems)
                    {
                        items.Add((Entry)li.Tag);
                    }
                }
                Forms.EntryAction ea = new Party_Buffalo.Forms.EntryAction(items.ToArray(), Party_Buffalo.Forms.EntryAction.Method.Delete, "");
                ea.ShowDialog();
                // Remove those treeview items
                foreach (Entry en in items)
                {
                    if (en.IsFolder)
                    {
                        try
                        {
                            treeView1.SelectedNode.Nodes.Find(en.Name, false)[0].Remove();
                        }
                        catch { }
                    }
                    if (rightClickedNode == treeView1.SelectedNode)
                    {
                        listView1.Items.Find(en.Name, false)[0].Remove();
                    }
                }
                ((Folder)rightClickedNode.Tag).Reload();
            }
        }
Example #5
0
 private void menuItem9_Click(object sender, EventArgs e)
 {
     DialogResult dr = DialogResult.No;
     string Path = "";
     if (Aero)
     {
         CommonOpenFileDialog ofd = new CommonOpenFileDialog();
         ofd.IsFolderPicker = true;
         ofd.Multiselect = false;
         if (ofd.ShowDialog() == CommonFileDialogResult.Ok)
         {
             dr = DialogResult.OK;
             Path = ofd.FileName;
         }
     }
     else
     {
         FolderBrowserDialog fbd = new FolderBrowserDialog();
         if (fbd.ShowDialog() == DialogResult.OK)
         {
             Path = fbd.SelectedPath;
         }
     }
     if (dr == DialogResult.OK)
     {
         List<string> filePaths = new List<string>();
         for (int i = 0; i < 10000; i++)
         {
             string extra = "";
             if (i < 10)
             {
                 extra = "000";
             }
             else if (i < 100)
             {
                 extra = "00";
             }
             else if (i < 1000)
             {
                 extra = "0";
             }
             if (System.IO.File.Exists(Path + "\\Data" + extra + i.ToString()))
             {
                 filePaths.Add(Path + "\\Data" + extra + i.ToString());
             }
             else { break; }
         }
         Drive d = new Drive(filePaths.ToArray());
         if (filePaths.Count < 3 || !d.IsFATXDrive())
         {
             if (Aero)
             {
                 Microsoft.WindowsAPICodePack.Dialogs.TaskDialog td = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialog();
                 td.Caption = "Files not valid";
                 td.Text = "The selected path doesn't contain a valid USB backup/dump.";
                 td.InstructionText = "Files Not Valid";
                 td.Icon = TaskDialogStandardIcon.Error;
                 td.ShowDialog(this.Handle);
             }
             else
             {
                 MessageBox.Show("The selected path doesn't contain a valid USB backup/dump.", "Files Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             if (Drive != null)
             {
                 Drive.Close();
             }
             Drive = d;
             LoadDrive();
         }
     }
 }
Example #6
0
        void ExceptionHandler(Exception x)
        {
            if (!Aero)
            {
                MessageBox.Show("An exception was thrown: " + x.Message + "\r\n\r\nPress CTRL + C to copy the stack trace:\r\n" + x.StackTrace);
            }
            else
            {
                tm.SetProgressState(TaskbarProgressBarState.Error);
                this.Invoke((MethodInvoker)delegate
                {
                    TaskDialog td = new TaskDialog();
                    td.Caption = "Unhandled Exception";
                    td.InstructionText = "An Unhandled Exception was Thrown";
                    td.Text = string.Format("An exception was thrown: {0}\r\n\r\nIf this appears to be a bug, please email me at [email protected] with the details below", x.Message);
                    td.DetailsCollapsedLabel = "Details";
                    td.DetailsExpandedLabel = "Details";
                    td.DetailsExpandedText = x.StackTrace;

                    TaskDialogButton Copy = new TaskDialogButton("Copy", "Copy Details to Clipboard");
                    Copy.Click += (o, f) => { this.Invoke((MethodInvoker)delegate { Clipboard.SetDataObject(x.Message + "\r\n\r\n" + x.StackTrace, true, 10, 200); }); };

                    TaskDialogButton Close = new TaskDialogButton("Close", "Close");
                    Close.Click += (o, f) => { td.Close(); };

                    td.Controls.Add(Copy);
                    td.Controls.Add(Close);
                    td.ShowDialog(this.Handle);
                });
            }
        }