/// <summary>
        /// Gets <see cref="FileData"/> for all the files in a directory that match a
        /// specific filter.
        /// </summary>
        /// <param name="path">The path to search.</param>
        /// <param name="searchPattern">The search string to match against files in the path.</param>
        /// <returns>An object that implements <see cref="IEnumerable{FileData}"/> and
        /// allows you to enumerate the files in the given directory.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="path"/> is a null reference (Nothing in VB)
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="filter"/> is a null reference (Nothing in VB)
        /// </exception>
        public static FileData[] GetFiles(string path, string searchPattern, SearchOption searchOption)
        {
            IEnumerable <FileData> e    = FastDirectoryEnumerator.EnumerateFiles(path, searchPattern, searchOption);
            List <FileData>        list = new List <FileData>(e);

            FileData[] retval = new FileData[list.Count];
            list.CopyTo(retval);

            return(retval);
        }
        public DataTable getFileList()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("LogRecordID", typeof(int)));
            dt.Columns.Add(new DataColumn("LogRecordName", typeof(string)));
            DataRow dr;

            FileData[] fData = FastDirectoryEnumerator.GetFiles(this.getDirPath(), "*", SearchOption.TopDirectoryOnly);

            for (int i = 0; i < fData.Length; i++)
            {
                dr = dt.NewRow();
                dr["LogRecordID"]   = i;
                dr["LogRecordName"] = fData[i].Name;
                dt.Rows.InsertAt(dr, i);
            }
            return(dt);
        }
        public void clearLog()
        {
            FileData[] fData      = FastDirectoryEnumerator.GetFiles(this.getDirPath(), "*", SearchOption.TopDirectoryOnly);
            string     logContent = "";

            if (fData.Length > maxLogFileCount)//换参
            {
                ArrayList fileArr = new ArrayList();
                foreach (FileData file in fData)
                {
                    fileArr.Add(file.Name);
                }
                fileArr.Sort();

                for (int i = 0; i < fileArr.Count - maxLogFileCount; i++)//换参
                {
                    File.Delete(this.getDirPath() + "\\" + fileArr[i].ToString());
                    logContent = String.Format("events:clear log file {0}\r\ndatetime:{1}", fileArr[i].ToString(), DateTime.Now.ToString());
                    this.writefile(logContent);
                }
            }
        }
 /// <summary>
 /// Gets <see cref="FileData"/> for all the files in a directory that match a
 /// specific filter.
 /// </summary>
 /// <param name="path">The path to search.</param>
 /// <param name="searchPattern">The search string to match against files in the path.</param>
 /// <returns>An object that implements <see cref="IEnumerable{FileData}"/> and
 /// allows you to enumerate the files in the given directory.</returns>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="path"/> is a null reference (Nothing in VB)
 /// </exception>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="filter"/> is a null reference (Nothing in VB)
 /// </exception>
 public static IEnumerable <FileData> EnumerateFiles(string path, string searchPattern)
 {
     return(FastDirectoryEnumerator.EnumerateFiles(path, searchPattern, SearchOption.TopDirectoryOnly));
 }
 /// <summary>
 /// Gets <see cref="FileData"/> for all the files in a directory.
 /// </summary>
 /// <param name="path">The path to search.</param>
 /// <returns>An object that implements <see cref="IEnumerable{FileData}"/> and
 /// allows you to enumerate the files in the given directory.</returns>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="path"/> is a null reference (Nothing in VB)
 /// </exception>
 public static IEnumerable <FileData> EnumerateFiles(string path)
 {
     return(FastDirectoryEnumerator.EnumerateFiles(path, "*"));
 }