WinForm----资源管理器小工具
using System; using System.Collections.Generic; using System.Collections; using System.Text; namespace SourceManagement { class TheDirectory { public TheDirectory(string path,string name,int level,TheDirectory parentDir) { this.Path = path; this.Name = name; this.level = level; this.ParentDirectory = parentDir; directorys = new List<TheDirectory>(); files = new List<TheFile>(); } private TheDirectory parentDirectory; public TheDirectory ParentDirectory { get { return parentDirectory; } set { parentDirectory = value; } } private List<TheDirectory> directorys; public List<TheDirectory> Directorys { get { return directorys; } set { directorys = value; } } private List<TheFile> files; public List<TheFile> Files { get { return files; } set { files = value; } } //private ArrayList files; //public ArrayList Files //{ // get { return files; } // set { files = value; } //} private string name; public string Name { get { return name; } set { name = value; } } private string path; public string Path { get { return path; } set { path = value; } } //属于第几级文件夹 private int level; public int Level { get { return level; } set { level = value; } } } }
using System;
using System.Collections.Generic;
using System.Text;
namespace SourceManagement
{
class TheFile
{
public TheFile(string pash,string fileName,TheDirectory parentDirectory)
{
this.FileName = fileName;
this.Path = pash;
this.ParentDirectory = parentDirectory;
}
private string fileName;
public string FileName
{
get { return fileName; }
set { fileName = value; }
}
private string path;
public string Path
{
get { return path; }
set { path = value; }
}
private TheDirectory parentDirectory;
public TheDirectory ParentDirectory
{
get { return parentDirectory; }
set { parentDirectory = value; }
}
}
}
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace SourceManagement { public class Win32 { public const uint SHGFI_ICON = 0x100; public const uint SHGFI_LARGEICON = 0x0; // 'Large icon public const uint SHGFI_SMALLICON = 0x1; // 'Small icon [DllImport("shell32.dll")] public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); [DllImport("shell32.dll")] public static extern uint ExtractIconEx(string lpszFile, int nIconIndex, int[] phiconLarge, int[] phiconSmall, uint nIcons); } [StructLayout(LayoutKind.Sequential)] public struct SHFILEINFO { public IntPtr hIcon; public IntPtr iIcon; public uint dwAttributes; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] public string szTypeName; }; }
广积粮,筑高墙,缓称王