Meziantou.Framework.Win32.PerceivedType 2.0.15

Prefix Reserved
dotnet add package Meziantou.Framework.Win32.PerceivedType --version 2.0.15
                    
NuGet\Install-Package Meziantou.Framework.Win32.PerceivedType -Version 2.0.15
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.Win32.PerceivedType" Version="2.0.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.Win32.PerceivedType" Version="2.0.15" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.Win32.PerceivedType" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.Win32.PerceivedType --version 2.0.15
                    
#r "nuget: Meziantou.Framework.Win32.PerceivedType, 2.0.15"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.Win32.PerceivedType@2.0.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.Win32.PerceivedType&version=2.0.15
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.Win32.PerceivedType&version=2.0.15
                    
Install as a Cake Tool

Meziantou.Framework.Win32.PerceivedType

A .NET library for determining a file's perceived type based on its extension using Windows APIs.

Usage

This library provides functionality to get a file's perceived type (text, image, audio, video, etc.) based on its extension by querying the Windows registry and using the AssocGetPerceivedType Win32 API.

Get Perceived Type

using Meziantou.Framework.Win32;

// Get perceived type for a file extension
var perceived = Perceived.GetPerceivedType(".txt");
Console.WriteLine(perceived.PerceivedType); // Text
Console.WriteLine(perceived.PerceivedTypeSource); // SoftCoded or HardCoded

// Works with various file types
var image = Perceived.GetPerceivedType(".jpg");
Console.WriteLine(image.PerceivedType); // Image

var video = Perceived.GetPerceivedType(".mp4");
Console.WriteLine(video.PerceivedType); // Video

var audio = Perceived.GetPerceivedType(".mp3");
Console.WriteLine(audio.PerceivedType); // Audio

Add Custom Perceived Types

You can add custom perceived types or override system-defined types:

// Add a custom perceived type
Perceived.AddPerceived(".myext", PerceivedType.Text);

// Add default perceived types for common extensions
Perceived.AddDefaultPerceivedTypes();

Perceived Types

The library supports the following perceived types:

  • Text - Text files (.txt, .cs, .html, .xml, etc.)
  • Image - Image files (.jpg, .png, .gif, etc.)
  • Audio - Audio files (.mp3, .wav, etc.)
  • Video - Video files (.mp4, .avi, .mpeg, etc.)
  • Compressed - Compressed files (.zip, .rar, etc.)
  • Document - Document files (.doc, .pdf, etc.)
  • Application - Application files (.exe, .dll, etc.)
  • System - System files
  • GameMedia - Game media files
  • Contacts - Contact files
  • Custom - Custom type defined in registry
  • Unspecified - No perceived type
  • Unknown - Unknown type

Perceived Type Source

The PerceivedTypeSource enum indicates where the perceived type information comes from:

  • Undefined - No perceived type was found
  • SoftCoded - Determined through registry association
  • HardCoded - Inherently known to the OS
  • NativeSupport - Determined through OS codec
  • GdiPlus - Supported by GDI+
  • WmSdk - Supported by Windows Media SDK
  • ZipFolder - Supported by Windows compressed folders
  • Mime - Determined through MIME content types

Platform Support

This library is Windows-only and requires Windows XP or later (Windows 5.1.2600+).

Additional Resources

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.15 0 11/30/2025
2.0.14 128 11/23/2025
2.0.13 120 11/16/2025
2.0.12 132 11/9/2025
2.0.11 126 11/2/2025
2.0.10 175 10/27/2025
2.0.9 130 10/26/2025
2.0.8 107 10/19/2025
2.0.7 309 9/16/2025
2.0.6 201 9/3/2025
2.0.5 161 3/1/2025
2.0.4 144 11/17/2024
2.0.3 320 11/15/2023
2.0.2 551 7/14/2021
2.0.1 491 4/22/2021
2.0.0 580 9/24/2020
1.1.4 631 6/25/2020
1.1.3 680 10/23/2019
1.1.2 855 12/12/2018
1.1.1 942 10/21/2018
1.1.0 1,126 8/7/2018
1.0.0 1,194 9/10/2017