This commit is contained in:
chudov
2009-06-24 19:40:23 +00:00
parent 7f27f99406
commit b6c12bda14
28 changed files with 6280 additions and 5910 deletions

View File

@@ -43,10 +43,26 @@
<Compile Include="FileSystemTreeView.Designer.cs">
<DependentUpon>FileSystemTreeView.cs</DependentUpon>
</Compile>
<Compile Include="IIconManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ShellIconMgr.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\folder.ico" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -42,7 +42,7 @@ namespace CUEControls
public partial class FileSystemTreeView : TreeView
{
private const string DummyNodeText = "DUMMY";
private ShellIconMgr m_icon_mgr;
private IIconManager m_icon_mgr;
private ExtraSpecialFolder[] m_extra_folders;
#region Public event declarations
@@ -65,7 +65,7 @@ namespace CUEControls
/// This property is the ICON manager for the icons
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ShellIconMgr IconManager
public IIconManager IconManager
{
get
{
@@ -188,7 +188,11 @@ namespace CUEControls
string specialPath = m_icon_mgr.GetFolderPath(ExtraSpecialFolder.Desktop);
if (specialPath != null && path.StartsWith(specialPath.ToUpper()))
{
if (path == specialPath.ToUpper())
return desktop;
top = desktop;
}
foreach (TreeNode node in desktop.Nodes)
if (node.Tag is ExtraSpecialFolder)
@@ -332,6 +336,8 @@ namespace CUEControls
catch { }
break;
case ExtraSpecialFolder.MyComputer:
if (m_icon_mgr.GetFolderPath(path) == "/")
break;
foreach (DriveInfo di in DriveInfo.GetDrives())
try { node.Nodes.Add(NewNode(new DirectoryInfo(di.Name), true)); }
catch { }

View File

@@ -35,7 +35,7 @@ namespace CUEControls
/// represent the file. This class calls into the shell function SHGetFileInfo to get
/// the ICON assocaited with the file name given (or device name).
/// </summary>
public unsafe class ShellIconMgr
public unsafe class ShellIconMgr : IIconManager
{
#region external functions
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
@@ -262,187 +262,6 @@ namespace CUEControls
#endregion
}
// see ShlObj.h
public enum ExtraSpecialFolder
{
// Summary:
// The logical Desktop rather than the physical file system location.
Desktop = 0,
//
// Summary:
// The directory that contains the user's program groups.
Programs = 2,
//
// Summary:
// The "My Documents" folder.
//
// Version 6.0. The virtual folder representing the My Documents
// desktop item. This is equivalent to CSIDL_MYDOCUMENTS.
// Previous to Version 6.0. The file system directory used to
// physically store a user's common repository of documents.
// A typical path is C:\Documents and Settings\username\My Documents.
// This should be distinguished from the virtual My Documents folder
// in the namespace. To access that virtual folder,
// use SHGetFolderLocation, which returns the ITEMIDLIST for the
// virtual location, or refer to the technique described in
// Managing the File System.
MyDocuments = 5,
//
// Summary:
// The directory that serves as a common repository for the user's favorite
// items.
Favorites = 6,
//
// Summary:
// The directory that corresponds to the user's Startup program group.
Startup = 7,
//
// Summary:
// The directory that contains the user's most recently used documents.
Recent = 8,
//
// Summary:
// The directory that contains the Send To menu items.
SendTo = 9,
//
// Summary:
// The directory that contains the Start menu items.
StartMenu = 11,
//
// Summary:
// The "My Music" folder.
MyMusic = 13,
//
// Summary:
// The directory used to physically store file objects on the desktop.
DesktopDirectory = 16,
//
// Summary:
// The "My Computer" folder.
MyComputer = 17,
//
// Summary:
// The directory that serves as a common repository for document templates.
Templates = 21,
//
// Summary:
// The directory that serves as a common repository for application-specific
// data for the current roaming user.
//
// Version 4.71. The file system directory that serves as
// a common repository for application-specific data.
// A typical path is C:\Documents and Settings\username\Application Data.
// This CSIDL is supported by the redistributable Shfolder.dll
// for systems that do not have the Microsoft Internet Explorer 4.0
// integrated Shell installed
ApplicationData = 26,
//
// Summary:
// The directory that serves as a common repository for application-specific
// data that is used by the current, non-roaming user.
//
// Version 5.0. The file system directory that serves as a data
// repository for local (nonroaming) applications. A typical path
// is C:\Documents and Settings\username\Local Settings\Application Data.
LocalApplicationData = 28,
//
// Summary:
// The directory that serves as a common repository for temporary Internet files.
//
// Version 4.72. The file system directory that serves as
// a common repository for temporary Internet files. A typical
// path is C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
InternetCache = 32,
//
// Summary:
// The directory that serves as a common repository for Internet cookies.
//
// The file system directory that serves as a common repository
// for Internet cookies. A typical path is
// C:\Documents and Settings\username\Cookies.
Cookies = 33,
//
// Summary:
// The directory that serves as a common repository for Internet history items.
History = 34,
//
// Summary:
// The directory that serves as a common repository for application-specific
// data that is used by all users.
//
// Version 5.0. The file system directory containing
// application data for all users. A typical path is
// C:\Documents and Settings\All Users\Application Data.
CommonApplicationData = 35,
// Summary:
// The Windows directory.
//
// Version 5.0. The Windows directory or SYSROOT.
// This corresponds to the %windir% or %SYSTEMROOT% environment
// variables. A typical path is C:\Windows.
Windows = 0x0024,
//
// Summary:
// The System directory.
//
// Version 5.0. The Windows System folder. A typical
// path is C:\Windows\System32.
System = 37,
//
// Summary:
// The program files directory.
//
// Version 5.0. The Program Files folder. A typical
// path is C:\Program Files.
ProgramFiles = 38,
//
// Summary:
// The "My Pictures" folder.
//
// Version 5.0. The file system directory that serves as
// a common repository for image files. A typical path is
// C:\Documents and Settings\username\My Documents\My Pictures.
MyPictures = 39,
// User Profile
Profile = 0x0028,
//
// Summary:
// The directory for components that are shared across applications.
//
// Version 5.0. A folder for components that are shared across
// applications. A typical path is C:\Program Files\Common.
// Valid only for Windows NT, Windows 2000, and Windows XP systems.
// Not valid for Windows Millennium Edition (Windows Me).
CommonProgramFiles = 43,
// The file system directory that contains documents
// that are common to all users. A typical paths is
// C:\Documents and Settings\All Users\Documents.
// Valid for Windows NT systems and Microsoft Windows 95 and
// Windows 98 systems with Shfolder.dll installed.
CommonDocuments = 0x002e,
// Version 5.0. The file system directory containing
// administrative tools for all users of the computer.
CommonAdministrativeTools = 0x002f,
// Version 5.0. The file system directory that is used
// to store administrative tools for an individual user.
// The Microsoft Management Console (MMC) will save customized
// consoles to this directory, and it will roam with the user.
AdministrativeTools = 0x0030,
// Music common to all users
CommonMusic = 0x0035
// Version 5.0. Combine this CSIDL with any of the following CSIDLs
// to force the creation of the associated folder.
// CreateFlag = 0x8000
}
public enum SIGDN : uint
{
NORMALDISPLAY = 0,