Environment.SpecialFolder.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System
  5. {
  6. public static partial class Environment
  7. {
  8. public enum SpecialFolder
  9. {
  10. ApplicationData = SpecialFolderValues.CSIDL_APPDATA,
  11. CommonApplicationData = SpecialFolderValues.CSIDL_COMMON_APPDATA,
  12. LocalApplicationData = SpecialFolderValues.CSIDL_LOCAL_APPDATA,
  13. Cookies = SpecialFolderValues.CSIDL_COOKIES,
  14. Desktop = SpecialFolderValues.CSIDL_DESKTOP,
  15. Favorites = SpecialFolderValues.CSIDL_FAVORITES,
  16. History = SpecialFolderValues.CSIDL_HISTORY,
  17. InternetCache = SpecialFolderValues.CSIDL_INTERNET_CACHE,
  18. Programs = SpecialFolderValues.CSIDL_PROGRAMS,
  19. MyComputer = SpecialFolderValues.CSIDL_DRIVES,
  20. MyMusic = SpecialFolderValues.CSIDL_MYMUSIC,
  21. MyPictures = SpecialFolderValues.CSIDL_MYPICTURES,
  22. MyVideos = SpecialFolderValues.CSIDL_MYVIDEO,
  23. Recent = SpecialFolderValues.CSIDL_RECENT,
  24. SendTo = SpecialFolderValues.CSIDL_SENDTO,
  25. StartMenu = SpecialFolderValues.CSIDL_STARTMENU,
  26. Startup = SpecialFolderValues.CSIDL_STARTUP,
  27. System = SpecialFolderValues.CSIDL_SYSTEM,
  28. Templates = SpecialFolderValues.CSIDL_TEMPLATES,
  29. DesktopDirectory = SpecialFolderValues.CSIDL_DESKTOPDIRECTORY,
  30. Personal = SpecialFolderValues.CSIDL_PERSONAL,
  31. MyDocuments = SpecialFolderValues.CSIDL_PERSONAL,
  32. ProgramFiles = SpecialFolderValues.CSIDL_PROGRAM_FILES,
  33. CommonProgramFiles = SpecialFolderValues.CSIDL_PROGRAM_FILES_COMMON,
  34. AdminTools = SpecialFolderValues.CSIDL_ADMINTOOLS,
  35. CDBurning = SpecialFolderValues.CSIDL_CDBURN_AREA,
  36. CommonAdminTools = SpecialFolderValues.CSIDL_COMMON_ADMINTOOLS,
  37. CommonDocuments = SpecialFolderValues.CSIDL_COMMON_DOCUMENTS,
  38. CommonMusic = SpecialFolderValues.CSIDL_COMMON_MUSIC,
  39. CommonOemLinks = SpecialFolderValues.CSIDL_COMMON_OEM_LINKS,
  40. CommonPictures = SpecialFolderValues.CSIDL_COMMON_PICTURES,
  41. CommonStartMenu = SpecialFolderValues.CSIDL_COMMON_STARTMENU,
  42. CommonPrograms = SpecialFolderValues.CSIDL_COMMON_PROGRAMS,
  43. CommonStartup = SpecialFolderValues.CSIDL_COMMON_STARTUP,
  44. CommonDesktopDirectory = SpecialFolderValues.CSIDL_COMMON_DESKTOPDIRECTORY,
  45. CommonTemplates = SpecialFolderValues.CSIDL_COMMON_TEMPLATES,
  46. CommonVideos = SpecialFolderValues.CSIDL_COMMON_VIDEO,
  47. Fonts = SpecialFolderValues.CSIDL_FONTS,
  48. NetworkShortcuts = SpecialFolderValues.CSIDL_NETHOOD,
  49. PrinterShortcuts = SpecialFolderValues.CSIDL_PRINTHOOD,
  50. UserProfile = SpecialFolderValues.CSIDL_PROFILE,
  51. CommonProgramFilesX86 = SpecialFolderValues.CSIDL_PROGRAM_FILES_COMMONX86,
  52. ProgramFilesX86 = SpecialFolderValues.CSIDL_PROGRAM_FILESX86,
  53. Resources = SpecialFolderValues.CSIDL_RESOURCES,
  54. LocalizedResources = SpecialFolderValues.CSIDL_RESOURCES_LOCALIZED,
  55. SystemX86 = SpecialFolderValues.CSIDL_SYSTEMX86,
  56. Windows = SpecialFolderValues.CSIDL_WINDOWS,
  57. }
  58. // These values are specific to Windows and are known to SHGetFolderPath, however they are
  59. // also the values used in the SpecialFolder enum. As such, we keep them as constants
  60. // with their Win32 names, but keep them here rather than in Interop.Kernel32 as they're
  61. // used on all platforms.
  62. private static class SpecialFolderValues
  63. {
  64. internal const int CSIDL_APPDATA = 0x001a;
  65. internal const int CSIDL_COMMON_APPDATA = 0x0023;
  66. internal const int CSIDL_LOCAL_APPDATA = 0x001c;
  67. internal const int CSIDL_COOKIES = 0x0021;
  68. internal const int CSIDL_FAVORITES = 0x0006;
  69. internal const int CSIDL_HISTORY = 0x0022;
  70. internal const int CSIDL_INTERNET_CACHE = 0x0020;
  71. internal const int CSIDL_PROGRAMS = 0x0002;
  72. internal const int CSIDL_RECENT = 0x0008;
  73. internal const int CSIDL_SENDTO = 0x0009;
  74. internal const int CSIDL_STARTMENU = 0x000b;
  75. internal const int CSIDL_STARTUP = 0x0007;
  76. internal const int CSIDL_SYSTEM = 0x0025;
  77. internal const int CSIDL_TEMPLATES = 0x0015;
  78. internal const int CSIDL_DESKTOPDIRECTORY = 0x0010;
  79. internal const int CSIDL_PERSONAL = 0x0005;
  80. internal const int CSIDL_PROGRAM_FILES = 0x0026;
  81. internal const int CSIDL_PROGRAM_FILES_COMMON = 0x002b;
  82. internal const int CSIDL_DESKTOP = 0x0000;
  83. internal const int CSIDL_DRIVES = 0x0011;
  84. internal const int CSIDL_MYMUSIC = 0x000d;
  85. internal const int CSIDL_MYPICTURES = 0x0027;
  86. internal const int CSIDL_ADMINTOOLS = 0x0030; // <user name>\Start Menu\Programs\Administrative Tools
  87. internal const int CSIDL_CDBURN_AREA = 0x003b; // USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
  88. internal const int CSIDL_COMMON_ADMINTOOLS = 0x002f; // All Users\Start Menu\Programs\Administrative Tools
  89. internal const int CSIDL_COMMON_DOCUMENTS = 0x002e; // All Users\Documents
  90. internal const int CSIDL_COMMON_MUSIC = 0x0035; // All Users\My Music
  91. internal const int CSIDL_COMMON_OEM_LINKS = 0x003a; // Links to All Users OEM specific apps
  92. internal const int CSIDL_COMMON_PICTURES = 0x0036; // All Users\My Pictures
  93. internal const int CSIDL_COMMON_STARTMENU = 0x0016; // All Users\Start Menu
  94. internal const int CSIDL_COMMON_PROGRAMS = 0X0017; // All Users\Start Menu\Programs
  95. internal const int CSIDL_COMMON_STARTUP = 0x0018; // All Users\Startup
  96. internal const int CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019; // All Users\Desktop
  97. internal const int CSIDL_COMMON_TEMPLATES = 0x002d; // All Users\Templates
  98. internal const int CSIDL_COMMON_VIDEO = 0x0037; // All Users\My Video
  99. internal const int CSIDL_FONTS = 0x0014; // windows\fonts
  100. internal const int CSIDL_MYVIDEO = 0x000e; // "My Videos" folder
  101. internal const int CSIDL_NETHOOD = 0x0013; // %APPDATA%\Microsoft\Windows\Network Shortcuts
  102. internal const int CSIDL_PRINTHOOD = 0x001b; // %APPDATA%\Microsoft\Windows\Printer Shortcuts
  103. internal const int CSIDL_PROFILE = 0x0028; // %USERPROFILE% (%SystemDrive%\Users\%USERNAME%)
  104. internal const int CSIDL_PROGRAM_FILES_COMMONX86 = 0x002c; // x86 Program Files\Common on RISC
  105. internal const int CSIDL_PROGRAM_FILESX86 = 0x002a; // x86 C:\Program Files on RISC
  106. internal const int CSIDL_RESOURCES = 0x0038; // %windir%\Resources
  107. internal const int CSIDL_RESOURCES_LOCALIZED = 0x0039; // %windir%\resources\0409 (code page)
  108. internal const int CSIDL_SYSTEMX86 = 0x0029; // %windir%\system32
  109. internal const int CSIDL_WINDOWS = 0x0024; // GetWindowsDirectory()
  110. }
  111. }
  112. }