Click here to Skip to main content
15,884,298 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sample Code for SetWinEventHook in C# Pin
Art Taradeiko25-Sep-13 5:17
Art Taradeiko25-Sep-13 5:17 
QuestionHow to detect if a service is running or not Pin
bouli15-Jan-07 20:57
bouli15-Jan-07 20:57 
AnswerRe: How to detect if a service is running or not Pin
Kodanda Pani15-Jan-07 23:19
Kodanda Pani15-Jan-07 23:19 
AnswerRe: How to detect if a service is running or not Pin
justintimberlake16-Jan-07 1:00
justintimberlake16-Jan-07 1:00 
GeneralRe: How to detect if a service is running or not Pin
bouli16-Jan-07 2:11
bouli16-Jan-07 2:11 
QuestionTemplate Programming Pin
satsumatable15-Jan-07 20:20
satsumatable15-Jan-07 20:20 
AnswerRe: Template Programming Pin
Christian Graus15-Jan-07 21:43
protectorChristian Graus15-Jan-07 21:43 
QuestionRecursive directory search Pin
electriac15-Jan-07 20:06
electriac15-Jan-07 20:06 
I have tested this significantly and it gets curious-er. I installed a drive that has nothing but MP3 files on it. I went in a command com and issued a “Dir *.mp3 /b /s > test.txt” to create a list of all the files on the drive. I read the file with a text editor and there are 17,247 files listed. Okay I run the program I have been testing and it finds only 16800 files. Here is the code I used to which I introduced a counter with which I report to a message box in order to confirm the exact number in the array. The number in the array agrees with countFiles.

void DirSearch(string sDir)
        {
            try
            {
                foreach (string d in Directory.GetDirectories(sDir))
                {
                    foreach (string f in Directory.GetFiles(d, "*.mp3"))
                    {
                        //listBox1.Items.Add(f);
                        arrText.Add(f);
                        countFiles++;
                    }
                    DirSearch(d);
                }
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }


Upon examintion of the array in the list box there is also 16,800 files in the list box but I notice that I have a directory for “World” music which is not present in the list. Out of curiosity I change the name of the directory from “World” to “aWorld” and run the program without any other changes. The program reports 17,005 files which reflects the approximate number of files in the “World” directory.

It seems that there is something strange happening in DirSearch that is beyond my feeble mind. Since it will not read anything alphabeticaly beyond “Rock and Roll” could there be some kind of musical prejudice at work? That’s a joke.
AnswerRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 21:04
sitebuilderLuc Pattyn15-Jan-07 21:04 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:19
electriac15-Jan-07 21:19 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:52
electriac15-Jan-07 21:52 
GeneralRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 22:22
sitebuilderLuc Pattyn15-Jan-07 22:22 
AnswerRe: Recursive directory search Pin
Christian Graus15-Jan-07 21:48
protectorChristian Graus15-Jan-07 21:48 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:54
electriac15-Jan-07 21:54 
GeneralRe: Recursive directory search Pin
Christian Graus15-Jan-07 22:00
protectorChristian Graus15-Jan-07 22:00 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 22:09
electriac15-Jan-07 22:09 
AnswerRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 22:27
sitebuilderLuc Pattyn15-Jan-07 22:27 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 0:21
electriac16-Jan-07 0:21 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 1:14
sitebuilderLuc Pattyn16-Jan-07 1:14 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 1:31
electriac16-Jan-07 1:31 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 1:31
sitebuilderLuc Pattyn16-Jan-07 1:31 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 1:36
electriac16-Jan-07 1:36 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 2:20
sitebuilderLuc Pattyn16-Jan-07 2:20 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 2:46
sitebuilderLuc Pattyn16-Jan-07 2:46 
AnswerRe: Recursive directory search Pin
davidc2p16-Jan-07 6:03
davidc2p16-Jan-07 6:03 

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.