熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

使用C#返回系統特殊路徑

2022-06-13   來源: .NET編程 
 using System;
using MicrosoftWin;
namespace SystemPathsApp
{
/// <summary>
/// Summary description for SystemPaths
/// </summary>
public class SystemPaths
{
public SystemPaths()
{
//
// TODO: Add constructor logic here
//
folders = OpenRegistryPath(RegistryCurrentUser@\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders);
}
private RegistryKey folders;
private RegistryKey OpenRegistryPath(RegistryKey rootstring s)
{
s = sRemove() + @\;
while (sIndexOf(@\) != )
{
root = rootOpenSubKey(sSubstring(sIndexOf(@\)));
s = sRemove(sIndexOf(@\) + );
}
return root;
}
/// <summary>
/// </summary>
/// <param name=path>
/// Desktop 桌面目錄
/// Fonts 字體目錄
/// NetHood 網上鄰居
/// Personal 我的文檔目錄
/// Programs 開始菜單程序目錄
/// Recent 存放用戶最近訪問文件快捷方式的目錄
/// SendTo 發送到目錄
/// StartMenu 開始菜單目錄
/// Startup 開始菜單啟動項目錄
/// Favorites 收藏夾目錄
/// History 網頁歷史目錄
/// Cookies cookies目錄
/// Cache 緩存目錄
/// AppData 應用程序數據目錄
/// PrintHood 打印目錄
/// </param>
/// <returns></returns>
public string Customize(string path)
{
return foldersGetValue(path)ToString();
}
public string Desktop()
{
return Customize(Desktop);
}
public string Cookies()
{
return Customize(Cookies);
}
public string MyDocuments()
{
return Customize(Personal);
}
public string History()
{
return Customize(History);
}
public string Favorites()
{
return Customize(Favorites);
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12147.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.