Click here to Skip to main content
15,887,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: treeview nodes disable Pin
Manas Bhardwaj4-Jun-09 3:57
professionalManas Bhardwaj4-Jun-09 3:57 
GeneralRe: treeview nodes disable Pin
Pete O'Hanlon4-Jun-09 4:00
mvePete O'Hanlon4-Jun-09 4:00 
AnswerRe: treeview nodes disable Pin
Manas Bhardwaj4-Jun-09 4:03
professionalManas Bhardwaj4-Jun-09 4:03 
Questionpage design problems Pin
ravishankarreddy274-Jun-09 3:40
ravishankarreddy274-Jun-09 3:40 
AnswerRe: page design problems Pin
Abhijit Jana4-Jun-09 4:06
professionalAbhijit Jana4-Jun-09 4:06 
QuestionHow to know the file version of setup developed through vs2005? Pin
svt gdwl4-Jun-09 3:14
svt gdwl4-Jun-09 3:14 
AnswerRe: How to know the file version of setup developed through vs2005? Pin
Manas Bhardwaj4-Jun-09 3:41
professionalManas Bhardwaj4-Jun-09 3:41 
QuestionIndex all files on disk Pin
Matthijs Koopman4-Jun-09 1:02
Matthijs Koopman4-Jun-09 1:02 
Hey all,

I have the following problem:

I want to add some functonallity to my application that searches your entire harddisk and lists all the files that have been found.

Now i have the following code, but when i want to look in certain folders i get an access denied error. Is there a way to get some tep. read rights for that folder?

private void bgwInit_DoWork(object sender, DoWorkEventArgs e)
       {
           //set vars
           Files = 0;
           Size = 0;
           //
           string dir = (string)e.Argument;
           List<ListViewItem> results = new List<ListViewItem>();
           string[] DirectoryArray = System.IO.Directory.GetDirectories("C:\\Windows");
           DateTime lastReport = DateTime.Now;
           if (DirectoryArray.Length != 0)
           {
               foreach (string D in DirectoryArray)
               {
                   System.IO.DirectoryInfo WDDirInfo = new System.IO.DirectoryInfo(D);
                   try
                   {
                       //for the sub dirs
                       System.IO.FileInfo[] WDFileInfo = WDDirInfo.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
                       foreach (System.IO.FileInfo FI in WDFileInfo)
                       {
                           ListViewItem itmLog = new ListViewItem();
                           itmLog.Text = FI.FullName.ToString();
                           itmLog.UseItemStyleForSubItems = true;
                           itmLog.SubItems.Add("Veilig");
                           itmLog.ForeColor = Color.Green;
                           itmLog.EnsureVisible();
                           results.Add(itmLog);
                           string path = FI.FullName.Remove(0, 3);
                           Files = (Files + 1);
                           Size = (Size + FI.Length);
                       }

                   }
                   catch (Exception ex)
                   {

                   }
                   //end of root
                   // Report back when at least 25 milliseconds have expired since last time
                   if ((DateTime.Now - lastReport).TotalMilliseconds >= 25 || results.Count > 30)
                   {
                       this.bgwInit.ReportProgress(0, results);
                       results = new List<ListViewItem>();
                       lastReport = DateTime.Now;
                   }
               }
           }
           //for the root
           try
           {
               System.IO.DirectoryInfo WDRootDir = new System.IO.DirectoryInfo("C:\\Windows");
               System.IO.FileInfo[] WDRootFileInfo = WDRootDir.GetFiles("*.*", System.IO.SearchOption.TopDirectoryOnly);
               foreach (System.IO.FileInfo FI in WDRootFileInfo)
               {
                   ListViewItem itmLog = new ListViewItem();
                   itmLog.Text = FI.FullName.ToString();
                   itmLog.UseItemStyleForSubItems = true;
                   itmLog.SubItems.Add("Veilig");
                   itmLog.ForeColor = Color.Green;
                   itmLog.EnsureVisible();
                   results.Add(itmLog);
                   string path = FI.FullName.Remove(0, 3);
                   Files = (Files + 1);
                   Size = (Size + FI.Length);
               }
           }
           catch (Exception ex)
           {

           }
           // Report back when at least 25 milliseconds have expired since last time
           if ((DateTime.Now - lastReport).TotalMilliseconds >= 25 || results.Count > 30)
           {
               this.bgwInit.ReportProgress(0, results);
               results = new List<ListViewItem>();
               lastReport = DateTime.Now;
           }
           //report progress
           this.bgwInit.ReportProgress(50, results);
           //end of void
       }

       private void bgwInit_ProgressChanged(object sender, ProgressChangedEventArgs e)
       {
           //declare listviewitem
           //file count (may be need to redesigned)
           List<ListViewItem> items = e.UserState as List<ListViewItem>;
           //start log update
           this.lstFiles.BeginUpdate();
           //for eacht log item
           foreach (ListViewItem item in items)
           {
               //add log item to log
               this.lstFiles.Items.Add(item);
               //increase progressbar value +1
           }
           //end log update
           this.lblFilesScanned.Text = this.lstFiles.Items.Count.ToString();
           this.lstFiles.EndUpdate();
           //end of void
       }

AnswerRe: Index all files on disk Pin
Mycroft Holmes4-Jun-09 1:10
professionalMycroft Holmes4-Jun-09 1:10 
GeneralRe: Index all files on disk Pin
Matthijs Koopman4-Jun-09 1:13
Matthijs Koopman4-Jun-09 1:13 
GeneralRe: Index all files on disk Pin
Nagy Vilmos4-Jun-09 1:28
professionalNagy Vilmos4-Jun-09 1:28 
GeneralRe: Index all files on disk Pin
Matthijs Koopman4-Jun-09 1:32
Matthijs Koopman4-Jun-09 1:32 
AnswerRe: Index all files on disk Pin
Dave Kreskowiak4-Jun-09 1:36
mveDave Kreskowiak4-Jun-09 1:36 
GeneralRe: Index all files on disk Pin
Matthijs Koopman4-Jun-09 1:40
Matthijs Koopman4-Jun-09 1:40 
GeneralRe: Index all files on disk Pin
harold aptroot4-Jun-09 2:10
harold aptroot4-Jun-09 2:10 
GeneralRe: Index all files on disk Pin
Matthijs Koopman4-Jun-09 2:11
Matthijs Koopman4-Jun-09 2:11 
GeneralRe: Index all files on disk Pin
harold aptroot4-Jun-09 2:24
harold aptroot4-Jun-09 2:24 
GeneralRe: Index all files on disk Pin
Dave Kreskowiak4-Jun-09 3:33
mveDave Kreskowiak4-Jun-09 3:33 
AnswerRe: Index all files on disk Pin
DaveyM694-Jun-09 5:06
professionalDaveyM694-Jun-09 5:06 
QuestionPlotting point in circle button Pin
gwithey4-Jun-09 0:54
gwithey4-Jun-09 0:54 
AnswerRe: Plotting point in circle button Pin
Mycroft Holmes4-Jun-09 1:08
professionalMycroft Holmes4-Jun-09 1:08 
QuestionListview item persisting problem Pin
Narsimha094-Jun-09 0:53
Narsimha094-Jun-09 0:53 
AnswerRe: Listview item persisting problem Pin
Henry Minute4-Jun-09 2:39
Henry Minute4-Jun-09 2:39 
GeneralQuad Tree Pin
gabeold4-Jun-09 0:46
gabeold4-Jun-09 0:46 
GeneralRe: Quad Tree Pin
Pete O'Hanlon4-Jun-09 0:50
mvePete O'Hanlon4-Jun-09 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.