You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace QMAPP.WinForm.Common
|
|
{
|
|
public class FileHelper
|
|
{
|
|
public System.IO.FileInfo GetFileInfo(string path)
|
|
{
|
|
if (System.IO.File.Exists(path))
|
|
{
|
|
return new System.IO.FileInfo(path);
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<System.IO.FileInfo> GetFileInfos(string path)
|
|
{
|
|
var dir = new System.IO.DirectoryInfo(path);
|
|
return dir.EnumerateFiles();
|
|
}
|
|
|
|
public static IEnumerable<System.IO.FileInfo> GetFileInfos(string path,string searchPattern)
|
|
{
|
|
var dir = new System.IO.DirectoryInfo(path);
|
|
return dir.EnumerateFiles(searchPattern);
|
|
}
|
|
|
|
public static IEnumerable<System.IO.DirectoryInfo> GetDirectoryInfos(string path)
|
|
{
|
|
var dir = new System.IO.DirectoryInfo(path);
|
|
return dir.EnumerateDirectories("*", System.IO.SearchOption.AllDirectories);
|
|
}
|
|
}
|
|
}
|
|
|