⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.cs

📁 内容管理 内容管理 内容管理 内容管理 内容管理
💻 CS
字号:
using System;
using System.IO;
namespace eInfo.file
{
	/// <summary>
	/// File 的摘要说明。
	/// </summary>
	public class MFile
	{
		public MFile()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		//-----------判断目录是否存在------------
		public bool CheckDir(string FolderPath)
		{
			DirectoryInfo dirInfo=new DirectoryInfo( FolderPath);
			if(dirInfo.Exists)return true;
			else return false;
		}
		//-------------根据给定的文件名新建一个可读写的文件---------
		public void CreateFile(string FileName)
		{
		
			string path = @FileName;
			if (!File.Exists(path)) 
			{
				// Create a file to write to.
				FileStream  FS = File.Create(path);
			}
		
		}

	
	
		//-------------删除指定文件---------
		public bool  DelFile(string FileName)
		{
		
			FileInfo file=new FileInfo(FileName);
			//文件不存在
			if(!file.Exists) 
			{
				return false;
			}

			file.Delete();
			return true;
		}

		//-------------获取指定目录下的所有文件---------
		public FileInfo[] GetFile(string SourceDir)
		{
			
			DirectoryInfo SourceDirInfo=new DirectoryInfo( SourceDir);
        	if(!SourceDirInfo.Exists) 
			{
				return null;
			}
			FileInfo[] f= SourceDirInfo.GetFiles();  
			return f;
			
		}

	
	
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -