Ejemplo n.º 1
0
        void ScanDir(DirectoryInfo dI)
        {
            List <FileSystemInfo> fSI = new List <FileSystemInfo>();

            try
            {
                fSI.AddRange(dI.GetFiles("*.exe", SearchOption.TopDirectoryOnly));

                if (fSI.Count > 0)
                {
                    foreach (FileSystemInfo fsi2 in fSI)
                    {
                        exeFiles.Add(new ExeFileInfo(fsi2));

                        if (addFileEvent != null)
                        {
                            EventArgsForList eAfL = new EventArgsForList(exeFiles[exeFiles.Count - 1]);
                            addFileEvent(this, eAfL);
                        }
                    }
                }

                List <DirectoryInfo> di = new List <DirectoryInfo>();
                di.AddRange(dI.GetDirectories());

                foreach (DirectoryInfo DI in di)
                {
                    ScanDir(DI);
                }
            }
            catch (SystemException exp)
            {
                //Console.WriteLine(exp.Message);
            }
        }
Ejemplo n.º 2
0
 public void ExeList_addFileEvent(object sender, EventArgsForList e)//?static?
 {
     Console.WriteLine(e.exeFileInfo.ShortName);
     listBox.Items.Add(e.exeFileInfo);
 }
Ejemplo n.º 3
0
 //?static?
 public void ExeList_addFileEvent(object sender, EventArgsForList e)
 {
     Console.WriteLine(e.exeFileInfo.ShortName);
     listBox.Items.Add(e.exeFileInfo);
 }
        void ScanDir(DirectoryInfo dI)
        {
            List<FileSystemInfo> fSI = new List<FileSystemInfo>();

            try
            {
                fSI.AddRange(dI.GetFiles("*.exe", SearchOption.TopDirectoryOnly));

                if (fSI.Count > 0)
                {
                    foreach (FileSystemInfo fsi2 in fSI)
                    {
                        exeFiles.Add(new ExeFileInfo(fsi2));

                        if (addFileEvent != null)
                        {
                            EventArgsForList eAfL = new EventArgsForList(exeFiles[exeFiles.Count -1]);
                            addFileEvent(this, eAfL);
                        }
                    }
                }

                List<DirectoryInfo> di = new List<DirectoryInfo>();
                di.AddRange(dI.GetDirectories());

                foreach (DirectoryInfo DI in di)
                {
                    ScanDir(DI);
                }
            }
            catch (SystemException exp)
            {
                //Console.WriteLine(exp.Message);
            }
        }