Use C # return to the system special path .txt

xiaoxiao2021-03-06  17

Using system;

USING Microsoft.win32;

Namespace SystemPathApp

{

///

/// Summary Description for SystemPaths.

///

Public Class SystemPaths

{

Public systempaths ()

{

//

// Todo: add constructor logic here

//

Folders = OpenRegistryPath (Registry.currentuser, @ "/ soft / microsoft / windows / currentversion / explorer / shell folders);

}

Private registryKey folders;

Private RegistryKey OpenRegistryPath (RegistryKey root, String s)

{

S = S.Remove (0, 1) @ "/";

While (sindexof (@ "/")! = -1)

{

Root = root.opensubkey (s.substring (0, s.indexof (@ "/"))));

s = S.Remove (0, S.indexof (@ "/") 1);

}

Return root;

}

///

///

///

/// Desktop Desktop Directory

/// fonts font directory

/// NetHood online neighbor

/// Personal My Document Directory

/// programs Start menu program directory

/// rextrain storage directory recently accessed file shortcut

/// sendto sends to the directory

/// StartMenu Start Menu Directory

/// STARTUP Start Menu Startup Project Record

/// Favorites Favorites Directory

/// history webpage history catalog

/// cookies cookies directory

/// cache cache directory

/// appdata application data directory

///Printhood print catalog

///

///

Public String Customize (String Path)

{

Return folders.getValue (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");

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-44158.html

New Post(0)