Environment.SpecialFolder.cs 7.3 KB

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