Advertisement
Guest User

getDirectories_re

a guest
Apr 9th, 2011
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1.         private void RetrieveAllFiles(DirectoryInfo parentDirectoryInfo)
  2.         {
  3.             foreach (DirectoryInfo directoryInfo in parentDirectoryInfo.GetDirectories())
  4.             {
  5.                 try
  6.                 {
  7.                     if (directoryInfo.GetDirectories().Length > 0)
  8.                         RetrieveAllFiles(directoryInfo);
  9.                 }
  10.                 catch (Exception e)
  11.                 {
  12.                     MessageBox.Show("Kann gewählten Ordner nicht lesen.");
  13.                 }
  14.  
  15.                 try
  16.                 {
  17.                     foreach (var fileInfo in directoryInfo.GetFiles())
  18.                         LB_FULL.Items.Add(fileInfo.FullName);
  19.                 }
  20.                 catch (Exception e)
  21.                 {
  22.                     MessageBox.Show("Kann gewählte Datein nicht lesen.");
  23.                 }
  24.             }
  25.         }
  26.  
  27.         private void Step2_Load(object sender, EventArgs e)
  28.         {
  29.             RetrieveAllFiles(new DirectoryInfo(@PathClient));
  30.             if (!CheckFreeSpace())
  31.             {
  32.                 MessageBox.Show("Nicht genügend Speicherplatz zum erstellen der Updates.");
  33.             }
  34.         }
  35.  
  36.         private void Step2_FormClosed(object sender, FormClosedEventArgs e)
  37.         {
  38.             Application.Exit();
  39.         }
  40.  
  41.         private void ToRight_Click(object sender, EventArgs e)
  42.         {
  43.             ArrayList sel = new ArrayList(LB_FULL.SelectedItems);
  44.             foreach (Object SelectedItem in sel)
  45.             {
  46.                 if (!LB_CRITICAL.Items.Contains(SelectedItem))
  47.                     LB_CRITICAL.Items.Add(SelectedItem);                                
  48.             }
  49.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement