public Clone(CLKsFATXLib.Drive Drive1, CLKsFATXLib.Drive Drive2) { InitializeComponent(); this.Original = Drive1; this.Destination = Drive2; this.Load += new EventHandler(Clone_Load); }
public Drive_Properties(CLKsFATXLib.Drive FATXDrive) { InitializeComponent(); xDrive = FATXDrive; this.Load += new EventHandler(Drive_Properties_Load); this.FormClosing += new FormClosingEventHandler(Drive_Properties_FormClosing); }
void Go() { System.Threading.ThreadStart ts = delegate { try { if (driveList != null) { for (int i = 0; i < driveList.Count; i++) { driveList[i].Close(); } } listView1.Invoke((MethodInvoker)delegate { listView1.Items.Clear(); }); label1.Invoke((MethodInvoker)delegate { label1.Text = "Getting drives..."; }); b_Refresh.Invoke((MethodInvoker)delegate { b_Refresh.Enabled = false; }); driveList = CLKsFATXLib.StartHere.GetFATXDrives().ToList(); if (Properties.Settings.Default.recentFiles != null) { foreach (string s in Properties.Settings.Default.recentFiles) { if (System.IO.File.Exists(s)) { try { CLKsFATXLib.Drive d = new CLKsFATXLib.Drive(s); if (d.IsFATXDrive()) { driveList.Add(d); } } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } else { continue; } } } } } List<ListViewItem> liList = new List<ListViewItem>(); for (int i = 0; i < driveList.Count; i++) { try { ListViewItem li = new ListViewItem(driveList[i].Name); if (driveList[i].DriveType == CLKsFATXLib.DriveType.HardDisk) { li.ImageIndex = 0; li.SubItems.Add(driveList[i].DeviceIndex.ToString()); } else if (driveList[i].DriveType == CLKsFATXLib.DriveType.USB) { li.ImageIndex = 1; li.SubItems.Add(System.IO.Path.GetPathRoot(driveList[i].USBPaths[0])); } else { li.ImageIndex = 2; li.SubItems.Add(System.IO.Path.GetFileName(driveList[i].FilePath)); } li.SubItems.Add(driveList[i].LengthFriendly); li.Tag = driveList[i]; liList.Add(li); } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } else { continue; } } } listView1.Invoke((MethodInvoker)delegate { listView1.Items.AddRange(liList.ToArray()); }); label1.Invoke((MethodInvoker)delegate { if (liList.Count == 0) { label1.Text = "No drives found..."; } else { label1.Text = liList.Count.ToString() + ((liList.Count > 1) ? " drives found" : " drive found"); } }); b_Refresh.Invoke((MethodInvoker)delegate { b_Refresh.Enabled = true; }); } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } } }; t = new System.Threading.Thread(ts); t.Start(); }
void Go() { System.Threading.ThreadStart ts = delegate { try { if (driveList != null) { for (int i = 0; i < driveList.Count; i++) { driveList[i].Close(); } } listView1.Invoke((MethodInvoker) delegate { listView1.Items.Clear(); }); label1.Invoke((MethodInvoker) delegate { label1.Text = "Getting drives..."; }); b_Refresh.Invoke((MethodInvoker) delegate { b_Refresh.Enabled = false; }); driveList = CLKsFATXLib.StartHere.GetFATXDrives().ToList(); if (Properties.Settings.Default.recentFiles != null) { foreach (string s in Properties.Settings.Default.recentFiles) { if (System.IO.File.Exists(s)) { try { CLKsFATXLib.Drive d = new CLKsFATXLib.Drive(s); if (d.IsFATXDrive()) { driveList.Add(d); } } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } else { continue; } } } } } List <ListViewItem> liList = new List <ListViewItem>(); for (int i = 0; i < driveList.Count; i++) { try { ListViewItem li = new ListViewItem(driveList[i].Name); if (driveList[i].DriveType == CLKsFATXLib.DriveType.HardDisk) { li.ImageIndex = 0; li.SubItems.Add(driveList[i].DeviceIndex.ToString()); } else if (driveList[i].DriveType == CLKsFATXLib.DriveType.USB) { li.ImageIndex = 1; li.SubItems.Add(System.IO.Path.GetPathRoot(driveList[i].USBPaths[0])); } else { li.ImageIndex = 2; li.SubItems.Add(System.IO.Path.GetFileName(driveList[i].FilePath)); } li.SubItems.Add(driveList[i].LengthFriendly); li.Tag = driveList[i]; liList.Add(li); } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } else { continue; } } } listView1.Invoke((MethodInvoker) delegate { listView1.Items.AddRange(liList.ToArray()); }); label1.Invoke((MethodInvoker) delegate { if (liList.Count == 0) { label1.Text = "No drives found..."; } else { label1.Text = liList.Count.ToString() + ((liList.Count > 1) ? " drives found" : " drive found"); } }); b_Refresh.Invoke((MethodInvoker) delegate { b_Refresh.Enabled = true; }); } catch (Exception e) { if (!e.Message.Contains("being used")) { MessageBox.Show("An exception was thrown: " + e.Message + "\r\n\r\nStack Trace:\r\n" + e.StackTrace); } } }; t = new System.Threading.Thread(ts); t.Start(); }