递归查看日志

 private void GetAllLog(string file)

        {

            DirectoryInfo di = new DirectoryInfo(file);



            FileSystemInfo[] fsinfo = di.GetFileSystemInfos();



            foreach (FileSystemInfo fs in fsinfo)

            {

                if (fs is FileInfo)

                {

                    if (fs.Extension == ".log")

                    {

                        MainLog +="#"+fs.FullName+"\r\n\r\n"+ ReadLog(File.ReadAllText(fs.FullName));

                    }

                }

                if (fs is DirectoryInfo)

                    GetAllLog(fs.FullName);

            }

        }

  

你可能感兴趣的:(递归)