mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
685 lines
31 KiB
C#
685 lines
31 KiB
C#
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
#nullable disable
|
|
|
|
namespace Wabbajack.Common.IO
|
|
{
|
|
/// <summary>
|
|
/// A collection of properties to retrieve specific file system paths for the current user.
|
|
/// </summary>
|
|
public static class KnownFolders
|
|
{
|
|
// ---- MEMBERS ------------------------------------------------------------------------------------------------
|
|
|
|
private static ConcurrentDictionary<KnownFolderType, KnownFolder> _knownFolderInstances;
|
|
|
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
|
|
|
/// <summary>
|
|
/// The per-user Account Pictures folder. Introduced in Windows 8.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\AccountPictures".
|
|
/// </summary>
|
|
public static KnownFolder AccountPictures => GetInstance(KnownFolderType.AccountPictures);
|
|
|
|
/// <summary>
|
|
/// The per-user Administrative Tools folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Administrative Tools".
|
|
/// </summary>
|
|
public static KnownFolder AdminTools => GetInstance(KnownFolderType.AdminTools);
|
|
|
|
/// <summary>
|
|
/// The per-user app desktop folder, used internally by .NET applications to perform cross-platform app
|
|
/// functionality. Introduced in Windows 10.
|
|
/// Defaults to "%LOCALAPPDATA%\Desktop".
|
|
/// </summary>
|
|
public static KnownFolder AppDataDesktop => GetInstance(KnownFolderType.AppDataDesktop);
|
|
|
|
/// <summary>
|
|
/// The per-user app documents folder, used internally by .NET applications to perform cross-platform app
|
|
/// functionality. Introduced in Windows 10.
|
|
/// Defaults to "%LOCALAPPDATA%\Documents".
|
|
/// </summary>
|
|
public static KnownFolder AppDataDocuments => GetInstance(KnownFolderType.AppDataDocuments);
|
|
|
|
/// <summary>
|
|
/// The per-user app favorites folder, used internally by .NET applications to perform cross-platform app
|
|
/// functionality. Introduced in Windows 10.
|
|
/// Defaults to "%LOCALAPPDATA%\Favorites".
|
|
/// </summary>
|
|
public static KnownFolder AppDataFavorites => GetInstance(KnownFolderType.AppDataFavorites);
|
|
|
|
/// <summary>
|
|
/// The per-user app program data folder, used internally by .NET applications to perform cross-platform app
|
|
/// functionality. Introduced in Windows 10.
|
|
/// Defaults to "%LOCALAPPDATA%\ProgramData".
|
|
/// </summary>
|
|
public static KnownFolder AppDataProgramData => GetInstance(KnownFolderType.AppDataProgramData);
|
|
|
|
/// <summary>
|
|
/// The per-user Application Shortcuts folder. Introduced in Windows 8.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\Application Shortcuts".
|
|
/// </summary>
|
|
public static KnownFolder ApplicationShortcuts => GetInstance(KnownFolderType.ApplicationShortcuts);
|
|
|
|
/// <summary>
|
|
/// The per-user Camera Roll folder. Introduced in Windows 8.1.
|
|
/// Defaults to ".%USERPROFILE%\Pictures\Camera Roll".
|
|
/// </summary>
|
|
public static KnownFolder CameraRoll => GetInstance(KnownFolderType.CameraRoll);
|
|
|
|
/// <summary>
|
|
/// The per-user Temporary Burn Folder.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\Burn\Burn".
|
|
/// </summary>
|
|
public static KnownFolder CDBurning => GetInstance(KnownFolderType.CDBurning);
|
|
|
|
/// <summary>
|
|
/// The common Administrative Tools folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Administrative Tools".
|
|
/// </summary>
|
|
public static KnownFolder CommonAdminTools => GetInstance(KnownFolderType.CommonAdminTools);
|
|
|
|
/// <summary>
|
|
/// The common OEM Links folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\OEM Links".
|
|
/// </summary>
|
|
public static KnownFolder CommonOemLinks => GetInstance(KnownFolderType.CommonOemLinks);
|
|
|
|
/// <summary>
|
|
/// The common Programs folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs".
|
|
/// </summary>
|
|
public static KnownFolder CommonPrograms => GetInstance(KnownFolderType.CommonPrograms);
|
|
|
|
/// <summary>
|
|
/// The common Start Menu folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu".
|
|
/// </summary>
|
|
public static KnownFolder CommonStartMenu => GetInstance(KnownFolderType.CommonStartMenu);
|
|
|
|
/// <summary>
|
|
/// The common Startup folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\StartUp".
|
|
/// </summary>
|
|
public static KnownFolder CommonStartup => GetInstance(KnownFolderType.CommonStartup);
|
|
|
|
/// <summary>
|
|
/// The common Templates folder.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Templates".
|
|
/// </summary>
|
|
public static KnownFolder CommonTemplates => GetInstance(KnownFolderType.CommonTemplates);
|
|
|
|
/// <summary>
|
|
/// The per-user Contacts folder. Introduced in Windows Vista.
|
|
/// Defaults to "%USERPROFILE%\Contacts".
|
|
/// </summary>
|
|
public static KnownFolder Contacts => GetInstance(KnownFolderType.Contacts);
|
|
|
|
/// <summary>
|
|
/// The per-user Cookies folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Cookies".
|
|
/// </summary>
|
|
public static KnownFolder Cookies => GetInstance(KnownFolderType.Cookies);
|
|
|
|
/// <summary>
|
|
/// The per-user Desktop folder.
|
|
/// Defaults to "%USERPROFILE%\Desktop".
|
|
/// </summary>
|
|
public static KnownFolder Desktop => GetInstance(KnownFolderType.Desktop);
|
|
|
|
/// <summary>
|
|
/// The common DeviceMetadataStore folder. Introduced in Windows 7.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\DeviceMetadataStore".
|
|
/// </summary>
|
|
public static KnownFolder DeviceMetadataStore => GetInstance(KnownFolderType.DeviceMetadataStore);
|
|
|
|
/// <summary>
|
|
/// The per-user Documents folder.
|
|
/// Defaults to "%USERPROFILE%\Documents".
|
|
/// </summary>
|
|
public static KnownFolder Documents => GetInstance(KnownFolderType.Documents);
|
|
|
|
/// <summary>
|
|
/// The per-user Documents library. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Libraries\Documents.library-ms".
|
|
/// </summary>
|
|
public static KnownFolder DocumentsLibrary => GetInstance(KnownFolderType.DocumentsLibrary);
|
|
|
|
/// <summary>
|
|
/// The per-user localized Documents folder.
|
|
/// Defaults to "%USERPROFILE%\Documents".
|
|
/// </summary>
|
|
public static KnownFolder DocumentsLocalized => GetInstance(KnownFolderType.DocumentsLocalized);
|
|
|
|
/// <summary>
|
|
/// The per-user Downloads folder.
|
|
/// Defaults to "%USERPROFILE%\Downloads".
|
|
/// </summary>
|
|
public static KnownFolder Downloads => GetInstance(KnownFolderType.Downloads);
|
|
|
|
/// <summary>
|
|
/// The per-user localized Downloads folder.
|
|
/// Defaults to "%USERPROFILE%\Downloads".
|
|
/// </summary>
|
|
public static KnownFolder DownloadsLocalized => GetInstance(KnownFolderType.DownloadsLocalized);
|
|
|
|
/// <summary>
|
|
/// The per-user Favorites folder.
|
|
/// Defaults to "%USERPROFILE%\Favorites".
|
|
/// </summary>
|
|
public static KnownFolder Favorites => GetInstance(KnownFolderType.Favorites);
|
|
|
|
/// <summary>
|
|
/// The fixed Fonts folder.
|
|
/// Points to "%WINDIR%\Fonts".
|
|
/// </summary>
|
|
public static KnownFolder Fonts => GetInstance(KnownFolderType.Fonts);
|
|
|
|
/// <summary>
|
|
/// The per-user GameExplorer folder. Introduced in Windows Vista.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\GameExplorer".
|
|
/// </summary>
|
|
public static KnownFolder GameTasks => GetInstance(KnownFolderType.GameTasks);
|
|
|
|
/// <summary>
|
|
/// The per-user History folder.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\History".
|
|
/// </summary>
|
|
public static KnownFolder History => GetInstance(KnownFolderType.History);
|
|
|
|
/// <summary>
|
|
/// The per-user ImplicitAppShortcuts folder. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts".
|
|
/// </summary>
|
|
public static KnownFolder ImplicitAppShortcuts => GetInstance(KnownFolderType.ImplicitAppShortcuts);
|
|
|
|
/// <summary>
|
|
/// The per-user Temporary Internet Files folder.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\Temporary Internet Files".
|
|
/// </summary>
|
|
public static KnownFolder InternetCache => GetInstance(KnownFolderType.InternetCache);
|
|
|
|
/// <summary>
|
|
/// The per-user Libraries folder. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Libraries".
|
|
/// </summary>
|
|
public static KnownFolder Libraries => GetInstance(KnownFolderType.Libraries);
|
|
|
|
/// <summary>
|
|
/// The per-user Links folder.
|
|
/// Defaults to "%USERPROFILE%\Links".
|
|
/// </summary>
|
|
public static KnownFolder Links => GetInstance(KnownFolderType.Links);
|
|
|
|
/// <summary>
|
|
/// The per-user Local folder.
|
|
/// Defaults to "%LOCALAPPDATA%" ("%USERPROFILE%\AppData\Local")".
|
|
/// </summary>
|
|
public static KnownFolder LocalAppData => GetInstance(KnownFolderType.LocalAppData);
|
|
|
|
/// <summary>
|
|
/// The per-user LocalLow folder.
|
|
/// Defaults to "%USERPROFILE%\AppData\LocalLow".
|
|
/// </summary>
|
|
public static KnownFolder LocalAppDataLow => GetInstance(KnownFolderType.LocalAppDataLow);
|
|
|
|
/// <summary>
|
|
/// The fixed LocalizedResourcesDir folder.
|
|
/// Points to "%WINDIR%\resources\0409" (code page).
|
|
/// </summary>
|
|
public static KnownFolder LocalizedResourcesDir => GetInstance(KnownFolderType.LocalizedResourcesDir);
|
|
|
|
/// <summary>
|
|
/// The per-user Music folder.
|
|
/// Defaults to "%USERPROFILE%\Music".
|
|
/// </summary>
|
|
public static KnownFolder Music => GetInstance(KnownFolderType.Music);
|
|
|
|
/// <summary>
|
|
/// The per-user Music library. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Libraries\Music.library-ms".
|
|
/// </summary>
|
|
public static KnownFolder MusicLibrary => GetInstance(KnownFolderType.MusicLibrary);
|
|
|
|
/// <summary>
|
|
/// The per-user localized Music folder.
|
|
/// Defaults to "%USERPROFILE%\Music".
|
|
/// </summary>
|
|
public static KnownFolder MusicLocalized => GetInstance(KnownFolderType.MusicLocalized);
|
|
|
|
/// <summary>
|
|
/// The per-user Network Shortcuts folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Network Shortcuts".
|
|
/// </summary>
|
|
public static KnownFolder NetHood => GetInstance(KnownFolderType.NetHood);
|
|
|
|
/// <summary>
|
|
/// The per-user 3D Objects folder. Introduced in Windows 10.
|
|
/// Defaults to "%USERPROFILE%\3D Objects".
|
|
/// </summary>
|
|
public static KnownFolder Objects3D => GetInstance(KnownFolderType.Objects3D);
|
|
|
|
/// <summary>
|
|
/// The per-user Original Images folder. Introduced in Windows Vista.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows Photo Gallery\Original Images".
|
|
/// </summary>
|
|
public static KnownFolder OriginalImages => GetInstance(KnownFolderType.OriginalImages);
|
|
|
|
/// <summary>
|
|
/// The per-user Slide Shows folder. Introduced in Windows Vista.
|
|
/// Defaults to "%USERPROFILE%\Pictures\Slide Shows".
|
|
/// </summary>
|
|
public static KnownFolder PhotoAlbums => GetInstance(KnownFolderType.PhotoAlbums);
|
|
|
|
/// <summary>
|
|
/// The per-user Pictures folder.
|
|
/// Defaults to "%USERPROFILE%\Pictures".
|
|
/// </summary>
|
|
public static KnownFolder Pictures => GetInstance(KnownFolderType.Pictures);
|
|
|
|
/// <summary>
|
|
/// The per-user Pictures library. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Libraries\Pictures.library-ms".
|
|
/// </summary>
|
|
public static KnownFolder PicturesLibrary => GetInstance(KnownFolderType.PicturesLibrary);
|
|
|
|
/// <summary>
|
|
/// The per-user localized Pictures folder.
|
|
/// Defaults to "%USERPROFILE%\Pictures".
|
|
/// </summary>
|
|
public static KnownFolder PicturesLocalized => GetInstance(KnownFolderType.PicturesLocalized);
|
|
|
|
/// <summary>
|
|
/// The per-user Playlists folder.
|
|
/// Defaults to "%USERPROFILE%\Music\Playlists".
|
|
/// </summary>
|
|
public static KnownFolder Playlists => GetInstance(KnownFolderType.Playlists);
|
|
|
|
/// <summary>
|
|
/// The per-user Printer Shortcuts folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Printer Shortcuts".
|
|
/// </summary>
|
|
public static KnownFolder PrintHood => GetInstance(KnownFolderType.PrintHood);
|
|
|
|
/// <summary>
|
|
/// The fixed user profile folder.
|
|
/// Defaults to "%USERPROFILE%" ("%SYSTEMDRIVE%\USERS\%USERNAME%")".
|
|
/// </summary>
|
|
public static KnownFolder Profile => GetInstance(KnownFolderType.Profile);
|
|
|
|
/// <summary>
|
|
/// The fixed ProgramData folder.
|
|
/// Points to "%ALLUSERSPROFILE%" ("%PROGRAMDATA%", "%SYSTEMDRIVE%\ProgramData").
|
|
/// </summary>
|
|
public static KnownFolder ProgramData => GetInstance(KnownFolderType.ProgramData);
|
|
|
|
/// <summary>
|
|
/// The fixed Program Files folder.
|
|
/// This is the same as the <see cref="ProgramFilesX86"/> known folder in 32-bit applications or the
|
|
/// <see cref="ProgramFilesX64"/> known folder in 64-bit applications.
|
|
/// Points to %SYSTEMDRIVE%\Program Files on a 32-bit operating system or in 64-bit applications on a 64-bit
|
|
/// operating system and to %SYSTEMDRIVE%\Program Files (x86) in 32-bit applications on a 64-bit operating
|
|
/// system.
|
|
/// </summary>
|
|
public static KnownFolder ProgramFiles => GetInstance(KnownFolderType.ProgramFiles);
|
|
|
|
/// <summary>
|
|
/// The fixed Program Files folder (64-bit forced).
|
|
/// This known folder is unsupported in 32-bit applications.
|
|
/// Points to %SYSTEMDRIVE%\Program Files.
|
|
/// </summary>
|
|
public static KnownFolder ProgramFilesX64 => GetInstance(KnownFolderType.ProgramFilesX64);
|
|
|
|
/// <summary>
|
|
/// The fixed Program Files folder (32-bit forced).
|
|
/// This is the same as the <see cref="ProgramFiles"/> known folder in 32-bit applications.
|
|
/// Points to "%SYSTEMDRIVE%\Program Files" on a 32-bit operating system and to
|
|
/// "%SYSTEMDRIVE%\Program Files (x86)" on a 64-bit operating system.
|
|
/// </summary>
|
|
public static KnownFolder ProgramFilesX86 => GetInstance(KnownFolderType.ProgramFilesX86);
|
|
|
|
/// <summary>
|
|
/// The fixed Common Files folder.
|
|
/// This is the same as the <see cref="ProgramFilesCommonX86"/> known folder in 32-bit applications or the
|
|
/// <see cref="ProgramFilesCommonX64"/> known folder in 64-bit applications.
|
|
/// Points to" %PROGRAMFILES%\Common Files" on a 32-bit operating system or in 64-bit applications on
|
|
/// a 64-bit operating system and to "%PROGRAMFILES(X86)%\Common Files" in 32-bit applications on a
|
|
/// 64-bit operating system.
|
|
/// </summary>
|
|
public static KnownFolder ProgramFilesCommon => GetInstance(KnownFolderType.ProgramFilesCommon);
|
|
|
|
/// <summary>
|
|
/// The fixed Common Files folder (64-bit forced).
|
|
/// This known folder is unsupported in 32-bit applications.
|
|
/// Points to "%PROGRAMFILES%\Common Files".
|
|
/// </summary>
|
|
public static KnownFolder ProgramFilesCommonX64 => GetInstance(KnownFolderType.ProgramFilesCommonX64);
|
|
|
|
/// <summary>
|
|
/// The fixed Common Files folder (32-bit forced).
|
|
/// This is the same as the <see cref="ProgramFilesCommon"/> known folder in 32-bit applications.
|
|
/// Points to "%PROGRAMFILES%\Common Files" on a 32-bit operating system and to
|
|
/// "%PROGRAMFILES(X86)%\Common Files" on a 64-bit operating system.
|
|
/// </summary>
|
|
public static KnownFolder ProgramFilesCommonX86 => GetInstance(KnownFolderType.ProgramFilesCommonX86);
|
|
|
|
/// <summary>
|
|
/// The per-user Programs folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Start Menu\Programs".
|
|
/// </summary>
|
|
public static KnownFolder Programs => GetInstance(KnownFolderType.Programs);
|
|
|
|
/// <summary>
|
|
/// The fixed Public folder. Introduced in Windows Vista.
|
|
/// Defaults to "%PUBLIC%" ("%SYSTEMDRIVE%\Users\Public)".
|
|
/// </summary>
|
|
public static KnownFolder Public => GetInstance(KnownFolderType.Public);
|
|
|
|
/// <summary>
|
|
/// The common Public Desktop folder.
|
|
/// Defaults to "%PUBLIC%\Desktop".
|
|
/// </summary>
|
|
public static KnownFolder PublicDesktop => GetInstance(KnownFolderType.PublicDesktop);
|
|
|
|
/// <summary>
|
|
/// The common Public Documents folder.
|
|
/// Defaults to "%PUBLIC%\Documents".
|
|
/// </summary>
|
|
public static KnownFolder PublicDocuments => GetInstance(KnownFolderType.PublicDocuments);
|
|
|
|
/// <summary>
|
|
/// The common Public Downloads folder. Introduced in Windows Vista.
|
|
/// Defaults to "%PUBLIC%\Downloads".
|
|
/// </summary>
|
|
public static KnownFolder PublicDownloads => GetInstance(KnownFolderType.PublicDownloads);
|
|
|
|
/// <summary>
|
|
/// The common GameExplorer folder. Introduced in Windows Vista.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\GameExplorer".
|
|
/// </summary>
|
|
public static KnownFolder PublicGameTasks => GetInstance(KnownFolderType.PublicGameTasks);
|
|
|
|
/// <summary>
|
|
/// The common Libraries folder. Introduced in Windows 7.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Libraries".
|
|
/// </summary>
|
|
public static KnownFolder PublicLibraries => GetInstance(KnownFolderType.PublicLibraries);
|
|
|
|
/// <summary>
|
|
/// The common Public Music folder.
|
|
/// Defaults to "%PUBLIC%\Music".
|
|
/// </summary>
|
|
public static KnownFolder PublicMusic => GetInstance(KnownFolderType.PublicMusic);
|
|
|
|
/// <summary>
|
|
/// The common Public Pictures folder.
|
|
/// Defaults to "%PUBLIC%\Pictures".
|
|
/// </summary>
|
|
public static KnownFolder PublicPictures => GetInstance(KnownFolderType.PublicPictures);
|
|
|
|
/// <summary>
|
|
/// The common Ringtones folder. Introduced in Windows 7.
|
|
/// Defaults to "%ALLUSERSPROFILE%\Microsoft\Windows\Ringtones".
|
|
/// </summary>
|
|
public static KnownFolder PublicRingtones => GetInstance(KnownFolderType.PublicRingtones);
|
|
|
|
/// <summary>
|
|
/// The common Public Account Pictures folder. Introduced in Windows 8.
|
|
/// Defaults to "%PUBLIC%\AccountPictures".
|
|
/// </summary>
|
|
public static KnownFolder PublicUserTiles => GetInstance(KnownFolderType.PublicUserTiles);
|
|
|
|
/// <summary>
|
|
/// The common Public Videos folder.
|
|
/// Defaults to "%PUBLIC%\Videos".
|
|
/// </summary>
|
|
public static KnownFolder PublicVideos => GetInstance(KnownFolderType.PublicVideos);
|
|
|
|
/// <summary>
|
|
/// The per-user Quick Launch folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Internet Explorer\Quick Launch".
|
|
/// </summary>
|
|
public static KnownFolder QuickLaunch => GetInstance(KnownFolderType.QuickLaunch);
|
|
|
|
/// <summary>
|
|
/// The per-user Recent Items folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Recent".
|
|
/// </summary>
|
|
public static KnownFolder Recent => GetInstance(KnownFolderType.Recent);
|
|
|
|
/// <summary>
|
|
/// The common Recorded TV library. Introduced in Windows 7.
|
|
/// Defaults to "%PUBLIC%\RecordedTV.library-ms".
|
|
/// </summary>
|
|
public static KnownFolder RecordedTVLibrary => GetInstance(KnownFolderType.RecordedTVLibrary);
|
|
|
|
/// <summary>
|
|
/// The fixed Resources folder.
|
|
/// Points to "%WINDIR%\Resources".
|
|
/// </summary>
|
|
public static KnownFolder ResourceDir => GetInstance(KnownFolderType.ResourceDir);
|
|
|
|
/// <summary>
|
|
/// The per-user Ringtones folder. Introduced in Windows 7.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\Ringtones".
|
|
/// </summary>
|
|
public static KnownFolder Ringtones => GetInstance(KnownFolderType.Ringtones);
|
|
|
|
/// <summary>
|
|
/// The per-user Roaming folder.
|
|
/// Defaults to "%APPDATA%" ("%USERPROFILE%\AppData\Roaming").
|
|
/// </summary>
|
|
public static KnownFolder RoamingAppData => GetInstance(KnownFolderType.RoamingAppData);
|
|
|
|
/// <summary>
|
|
/// The per-user RoamedTileImages folder. Introduced in Windows 8.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\RoamedTileImages".
|
|
/// </summary>
|
|
public static KnownFolder RoamedTileImages => GetInstance(KnownFolderType.RoamedTileImages);
|
|
|
|
/// <summary>
|
|
/// The per-user RoamingTiles folder. Introduced in Windows 8.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\RoamingTiles".
|
|
/// </summary>
|
|
public static KnownFolder RoamingTiles => GetInstance(KnownFolderType.RoamingTiles);
|
|
|
|
/// <summary>
|
|
/// The common Sample Music folder.
|
|
/// Defaults to "%PUBLIC%\Music\Sample Music".
|
|
/// </summary>
|
|
public static KnownFolder SampleMusic => GetInstance(KnownFolderType.SampleMusic);
|
|
|
|
/// <summary>
|
|
/// The common Sample Pictures folder.
|
|
/// Defaults to "%PUBLIC%\Pictures\Sample Pictures".
|
|
/// </summary>
|
|
public static KnownFolder SamplePictures => GetInstance(KnownFolderType.SamplePictures);
|
|
|
|
/// <summary>
|
|
/// The common Sample Playlists folder. Introduced in Windows Vista.
|
|
/// Defaults to "%PUBLIC%\Music\Sample Playlists".
|
|
/// </summary>
|
|
public static KnownFolder SamplePlaylists => GetInstance(KnownFolderType.SamplePlaylists);
|
|
|
|
/// <summary>
|
|
/// The common Sample Videos folder.
|
|
/// Defaults to "%PUBLIC%\Videos\Sample Videos".
|
|
/// </summary>
|
|
public static KnownFolder SampleVideos => GetInstance(KnownFolderType.SampleVideos);
|
|
|
|
/// <summary>
|
|
/// The per-user Saved Games folder. Introduced in Windows Vista.
|
|
/// Defaults to "%USERPROFILE%\Saved Games".
|
|
/// </summary>
|
|
public static KnownFolder SavedGames => GetInstance(KnownFolderType.SavedGames);
|
|
|
|
/// <summary>
|
|
/// The per-user Searches folder.
|
|
/// Defaults to "%USERPROFILE%\Searches".
|
|
/// </summary>
|
|
public static KnownFolder SavedSearches => GetInstance(KnownFolderType.SavedSearches);
|
|
|
|
/// <summary>
|
|
/// The per-user Screenshots folder. Introduced in Windows 8.
|
|
/// Defaults to "%USERPROFILE%\Pictures\Screenshots".
|
|
/// </summary>
|
|
public static KnownFolder Screenshots => GetInstance(KnownFolderType.Screenshots);
|
|
|
|
/// <summary>
|
|
/// The per-user History folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\ConnectedSearch\History".
|
|
/// </summary>
|
|
public static KnownFolder SearchHistory => GetInstance(KnownFolderType.SearchHistory);
|
|
|
|
/// <summary>
|
|
/// The per-user Templates folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows\ConnectedSearch\Templates".
|
|
/// </summary>
|
|
public static KnownFolder SearchTemplates => GetInstance(KnownFolderType.SearchTemplates);
|
|
|
|
/// <summary>
|
|
/// The per-user SendTo folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\SendTo".
|
|
/// </summary>
|
|
public static KnownFolder SendTo => GetInstance(KnownFolderType.SendTo);
|
|
|
|
/// <summary>
|
|
/// The common Gadgets folder. Introduced in Windows 7.
|
|
/// Defaults to "%ProgramFiles%\Windows Sidebar\Gadgets".
|
|
/// </summary>
|
|
public static KnownFolder SidebarDefaultParts => GetInstance(KnownFolderType.SidebarDefaultParts);
|
|
|
|
/// <summary>
|
|
/// The per-user Gadgets folder. Introduced in Windows 7.
|
|
/// Defaults to "%LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets".
|
|
/// </summary>
|
|
public static KnownFolder SidebarParts => GetInstance(KnownFolderType.SidebarParts);
|
|
|
|
/// <summary>
|
|
/// The per-user OneDrive folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%USERPROFILE%\OneDrive".
|
|
/// </summary>
|
|
public static KnownFolder SkyDrive => GetInstance(KnownFolderType.SkyDrive);
|
|
|
|
/// <summary>
|
|
/// The per-user OneDrive Camera Roll folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%USERPROFILE%\OneDrive\Pictures\Camera Roll".
|
|
/// </summary>
|
|
public static KnownFolder SkyDriveCameraRoll => GetInstance(KnownFolderType.SkyDriveCameraRoll);
|
|
|
|
/// <summary>
|
|
/// The per-user OneDrive Documents folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%USERPROFILE%\OneDrive\Documents".
|
|
/// </summary>
|
|
public static KnownFolder SkyDriveDocuments => GetInstance(KnownFolderType.SkyDriveDocuments);
|
|
|
|
/// <summary>
|
|
/// The per-user OneDrive Pictures folder. Introduced in Windows 8.1.
|
|
/// Defaults to "%USERPROFILE%\OneDrive\Pictures".
|
|
/// </summary>
|
|
public static KnownFolder SkyDrivePictures => GetInstance(KnownFolderType.SkyDrivePictures);
|
|
|
|
/// <summary>
|
|
/// The per-user Start Menu folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Start Menu".
|
|
/// </summary>
|
|
public static KnownFolder StartMenu => GetInstance(KnownFolderType.StartMenu);
|
|
|
|
/// <summary>
|
|
/// The per-user Startup folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Start Menu\Programs\StartUp".
|
|
/// </summary>
|
|
public static KnownFolder Startup => GetInstance(KnownFolderType.Startup);
|
|
|
|
/// <summary>
|
|
/// The fixed System32 folder.
|
|
/// This is the same as the <see cref="SystemX86"/> known folder in 32-bit applications.
|
|
/// Points to "%WINDIR%\system32" on 32-bit operating systems or in 64-bit applications on a 64-bit
|
|
/// operating system and to "%WINDIR%\syswow64" in 32-bit applications on a 64-bit operating system.
|
|
/// </summary>
|
|
public static KnownFolder System => GetInstance(KnownFolderType.System);
|
|
|
|
/// <summary>
|
|
/// The fixed System32 folder (32-bit forced).
|
|
/// This is the same as the <see cref="System"/> known folder in 32-bit applications.
|
|
/// Points to "%WINDIR%\syswow64" in 64-bit applications or in 32-bit applications on a 64-bit
|
|
/// operating system and to "%WINDIR%\system32" on 32-bit operating systems.
|
|
/// </summary>
|
|
public static KnownFolder SystemX86 => GetInstance(KnownFolderType.SystemX86);
|
|
|
|
/// <summary>
|
|
/// The per-user Templates folder.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Templates".
|
|
/// </summary>
|
|
public static KnownFolder Templates => GetInstance(KnownFolderType.Templates);
|
|
|
|
/// <summary>
|
|
/// The per-user User Pinned folder. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned".
|
|
/// </summary>
|
|
public static KnownFolder UserPinned => GetInstance(KnownFolderType.UserPinned);
|
|
|
|
/// <summary>
|
|
/// The fixed Users folder. Introduced in Windows Vista.
|
|
/// Points to "%SYSTEMDRIVE%\Users".
|
|
/// </summary>
|
|
public static KnownFolder UserProfiles => GetInstance(KnownFolderType.UserProfiles);
|
|
|
|
/// <summary>
|
|
/// The per-user Programs folder. Introduced in Windows 7.
|
|
/// Defaults to "%LOCALAPPDATA%\Programs.".
|
|
/// </summary>
|
|
public static KnownFolder UserProgramFiles => GetInstance(KnownFolderType.UserProgramFiles);
|
|
|
|
/// <summary>
|
|
/// The per-user common Programs folder. INtroduced in Windows 7.
|
|
/// Defaults to "%LOCALAPPDATA%\Programs\Common".
|
|
/// </summary>
|
|
public static KnownFolder UserProgramFilesCommon => GetInstance(KnownFolderType.UserProgramFilesCommon);
|
|
|
|
/// <summary>
|
|
/// The per-user Videos folder.
|
|
/// Defaults to "%USERPROFILE%\Videos".
|
|
/// </summary>
|
|
public static KnownFolder Videos => GetInstance(KnownFolderType.Videos);
|
|
|
|
/// <summary>
|
|
/// The per-user Videos library. Introduced in Windows 7.
|
|
/// Defaults to "%APPDATA%\Microsoft\Windows\Libraries\Videos.library-ms".
|
|
/// </summary>
|
|
public static KnownFolder VideosLibrary => GetInstance(KnownFolderType.VideosLibrary);
|
|
|
|
/// <summary>
|
|
/// The per-user localized Videos folder.
|
|
/// Defaults to "%USERPROFILE%\Videos".
|
|
/// </summary>
|
|
public static KnownFolder VideosLocalized => GetInstance(KnownFolderType.VideosLocalized);
|
|
|
|
/// <summary>
|
|
/// The fixed Windows folder.
|
|
/// Points to "%WINDIR%".
|
|
/// </summary>
|
|
public static KnownFolder Windows => GetInstance(KnownFolderType.Windows);
|
|
|
|
// ---- METHODS (PRIVATE) --------------------------------------------------------------------------------------
|
|
|
|
private static KnownFolder GetInstance(KnownFolderType type)
|
|
{
|
|
|
|
// Check if the caching directory exists yet.
|
|
if (_knownFolderInstances == null)
|
|
_knownFolderInstances = new ConcurrentDictionary<KnownFolderType, KnownFolder>();
|
|
|
|
// Get a KnownFolder instance out of the cache dictionary or create it when not cached yet.
|
|
if (!_knownFolderInstances.TryGetValue(type, out KnownFolder knownFolder))
|
|
{
|
|
knownFolder = new KnownFolder(type);
|
|
if (_knownFolderInstances.TryAdd(type, knownFolder))
|
|
return knownFolder;
|
|
return _knownFolderInstances[type];
|
|
}
|
|
return knownFolder;
|
|
}
|
|
}
|
|
}
|