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

📄 fstypeutility.cs

📁 CSharpDevelop:这是一个包含源代码的C#、VB.NET的编辑器。
💻 CS
字号:
// FSTypeUtility.cs
// Copyright (C) 2001 Mike Krueger
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System.IO;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;

namespace SharpDevelop.Tool.Function {
	
	public enum FileType {
		Unknown,
		Resource,
		Text,
		Help,
		Icon,
		Xml,
		Html,
		Batch,
		SharpDevelopProject,
		Exe,
		Dll,
	};
	
	public enum DriveType 
	{
		Unknown     = 0,
		NoRoot      = 1,
		Removeable  = 2,
		Fixed       = 3,
		Remote      = 4,
		Cdrom       = 5,
		Ramdisk     = 6
	}
	
	
	public class FSTypeUtility
	{
		public static bool IsDirectory(string filename)
		{
			FileAttributes attr = File.GetAttributes(filename);
			return (attr & FileAttributes.Directory) != 0;
		}
		
		public static FileType GetFileType(string filename)
		{
			Debug.Assert(filename != null, "SharpDevelop.Tool.Function.FSTypeUtility : string filename == null");

			switch (Path.GetExtension(filename).ToUpper()) {
				case ".DLL":
					return FileType.Dll;
				case ".EXE":
					return FileType.Exe;
				case ".RESX":
				case ".RESOURCES":
					return FileType.Resource;
				case ".TXT":
					return FileType.Text;
				case ".CHM":
					return FileType.Help;
				case ".ICO":
					return FileType.Icon;
				case ".XML":
					return FileType.Xml;
				case ".HTM":
				case ".HTML":
					return FileType.Html;
				case ".BAT":
					return FileType.Batch;
				case ".PRJX":
					return FileType.SharpDevelopProject;
				default:
					return FileType.Unknown;
			}
		}
		
		[DllImport("kernel32.dll")]
		public static extern DriveType GetDriveType(string drivename);
			
		public static bool TestFileExists(string filename)
		{
			if (!File.Exists(filename)) {
				MessageBox.Show("can't load " + filename, "File not found",
								MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return false;
			}
			return true;
		}
	}
}

⌨️ 快捷键说明

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