DescriptIon.Core 1.0.2

dotnet add package DescriptIon.Core --version 1.0.2
                    
NuGet\Install-Package DescriptIon.Core -Version 1.0.2
                    
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="DescriptIon.Core" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DescriptIon.Core" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="DescriptIon.Core" />
                    
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 DescriptIon.Core --version 1.0.2
                    
#r "nuget: DescriptIon.Core, 1.0.2"
                    
#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 DescriptIon.Core@1.0.2
                    
#: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=DescriptIon.Core&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=DescriptIon.Core&version=1.0.2
                    
Install as a Cake Tool

DescriptIon โ€” Cross-platform descript.ion File Reader/Writer for .NET

.NET Standard 2.0 License

DescriptIon is a lightweight, cross-platform C# library for reading, writing, and managing descript.ion files used by Total Commander and Double Commander. It supports multi-line comments, filenames with spaces/quotes, automatic format detection, and advanced maintenance features (e.g., cleaning orphaned entries, natural sorting).

Mapaler: I'm new to C#, so this library was developed with AI assistance. ๐Ÿ‡จ๐Ÿ‡ณ Chinese users: See README_zh.md for the Chinese version.


โœจ Features

  • โœ… Compatible with Total Commander & Double Commander
    • Automatically detects and handles two different multi-line comment formats
  • โœ… Unified newline handling
    • Internally uses \n for line breaks
    • Automatically converts to target format on save
  • โœ… Preserves original encoding and style
    • Auto-detects file encoding (UTF-8 with BOM, ANSI, etc.)
  • โœ… Advanced maintenance tools
    • Remove orphaned entries (comments without corresponding files/directories)
    • Sort entries using OS-aware rules (CurrentCulture by default, customizable)
  • โœ… Zero dependencies: Uses only .NET Standard libraries

๐Ÿ“ฆ Installation

Install the package via NuGet:

dotnet add package DescriptIon.Core

Or via Package Manager Console:

Install-Package DescriptIon.Core

Why DescriptIon.Core?
The package ID DescriptIon was used. So I uses the name DescriptIon.Core.


๐Ÿš€ Quick Start

1. Basic Read/Write

// Load descript.ion
var store = new DescriptionStore(@"C:\MyFolder");
store.Load();

// Get comment
string? comment = store.GetComment("report.pdf");

// Set multi-line comment (use \n)
store.SetComment("notes.txt", "Line 1\nLine 2");

// Save back to file
store.Save();

2. Advanced Maintenance

var store = new DescriptionStore(@"C:\MyFolder");
store.Load();

// Clean up comments for deleted files
store.RemoveOrphanedEntries();

// Sort by filename (default: CurrentCulture)
store.Sort();

// Or specify comparer
store.Sort(StringComparer.Ordinal);

store.Save(); // Writes a clean descript.ion

3. Helper Methods (for occasional use)

For heavy usage, prefer the full DescriptionStore approach to reduce disk I/O.

// Set comment via full path
DescriptionHelper.SetComment(@"C:\Data\image.jpg", "My photo");

// Get comment
string? cmt = DescriptionHelper.GetComment(@"C:\Data\Projects\");

// Supports FileInfo / DirectoryInfo
var file = new FileInfo("log.txt");
DescriptionHelper.SetComment(file, "Application log");

๐Ÿงฉ Core API

DescriptionStore Class

Method Description
Load() Loads comments from descript.ion (auto-detects format & encoding)
Save() Saves to descript.ion (preserves original encoding, outputs in detected format)
GetComment(string fileName) Gets comment (case-insensitive)
SetComment(string fileName, string comment) Sets comment (\n for line breaks)
RemoveComment(string fileName) Removes comment
RemoveOrphanedEntries() Deletes entries with no matching file/directory
Sort(IComparer<string>? comparer = null) Sorts entries (default: StringComparer.CurrentCulture)

DescriptionHelper Static Class

Method Description
GetComment(string fullPath) Gets comment by full path
SetComment(string fullPath, string? comment) Sets comment by full path
GetComment(FileSystemInfo item) Supports FileInfo / DirectoryInfo
SetComment(FileSystemInfo item, string? comment) Same as above

๐Ÿ” Format Details

Total Commander Format

  • Multi-line comments use \n (stored as literal "\\n")
  • Line ends with marker: EOT (U+0004) + ร‚ (U+00C2)
  • Example:
    "my file.txt" Line 1\\nLine 2\x04ร‚
    

Double Commander Format

  • Multi-line comments joined by NO-BREAK SPACE (U+00A0)
  • No extra markers
  • Example:
    folder My folder with two lines
    

๐Ÿ’ก The library internally uses \n and handles format conversion automatically.


๐Ÿงฉ Third-Party Compatibility

Beyond Total Commander and Double Commander, support varies:

  • ๐Ÿ“ฆ 7-Zip

    • โœ… Reads descript.ion to show file comments
    • โš ๏ธ Only supports UTF-8 encoding (BOM optional)
    • โŒ Does not support multi-line comments โ€” line breaks are ignored or truncated
    • ๐Ÿ’ก Recommendation: Use single-line comments and UTF-8 for 7-Zip compatibility
  • ๐Ÿ–ผ๏ธ XnView / XnViewMP

    • โœ… Fully supports Total Commander format
    • โœ… Correctly parses multi-line comments (including \\n and EOT+ร‚ markers)
    • โœ… Handles filenames with spaces and quotes
    • โœ… Auto-detects UTF-8 / ANSI encoding
    • ๐Ÿ’ก One of the best-compatible image viewers outside Total Commander

๐Ÿ“Œ Tip: For maximum compatibility across tools, use Total Commander format + UTF-8 with BOM + single-line comments.


๐Ÿงช Test Coverage

  • Filename parsing (spaces, quotes, escaping)
  • Multi-line comments (TC / DC formats)
  • Encoding detection (UTF-8 BOM / ANSI)
  • Orphaned entry cleanup
  • Sorting behavior
  • Trailing slash handling in paths

๐Ÿ“œ License

MIT License โ€” free for personal and commercial use.


๐Ÿ™Œ Acknowledgements

Inspired by Total Commander and Double Commander.
Bringing descript.ion to life in the .NET world!

Perfect for file manager plugins, backup tools, document organization scripts, and more.


Changelog

  • v1.0.1 (2025-12-13)
    • Fixed: UnauthorizedAccessException when updating an existing descript.ion file on Windows.
    • Removed the DescriptIonEntry class; now uses Dictionary<string, string> internally for simpler design and better performance.
  • v1.0.2 (2025-12-13)
    • Fixed: Newly created descript.ion files were not marked as hidden.
    • Ensured the file is always set to hidden after write operations, matching Total Commander's behavior.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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
1.0.2 127 12/12/2025
1.0.1 127 12/12/2025