-
Notifications
You must be signed in to change notification settings - Fork 0
WindowsStorageInfo Struct
Represents detailed information about a file or directory on a Windows file system.
Namespace: Rheo.Storage.Information
Assembly: Rheo.Storage.dll
public struct WindowsStorageInfo : IStorageInfoStruct- IStorageInfoStruct
| Property | Type | Description |
|---|---|---|
| Attributes | FileAttributes | Gets or sets the file attributes. |
| Size | UInt64 | Gets or sets the size in bytes. |
| CreationTime | DateTime | Gets or sets the creation time. |
| LastWriteTime | DateTime | Gets or sets the last write time. |
| LastAccessTime | DateTime | Gets or sets the last access time. |
| DisplayName | String | Gets or sets the display name for the file as provided by Windows Shell. |
| TypeName | String | Gets or sets the type name (e.g., "Text Document") as provided by Windows Shell. |
| Icon | Icon | Gets or sets the handle to the icon representing this file. |
| OwnerSid | String | Gets or sets the security identifier (SID) of the file owner. |
| HardLinkCount | UInt32 | Gets or sets the number of hard links to the file. |
| VolumeSerialNumber | UInt32 | Gets or sets the volume serial number of the volume containing the file. |
| FileIndex | UInt64 | Gets or sets the file index (unique identifier on the volume). |
| ReparseTarget | String | Gets or sets the target path if the file is a reparse point. |
This structure provides comprehensive file metadata obtained directly from Windows APIs, including attributes, size, timestamps, security information, and Shell-provided display information. Icon handles returned in this structure must be destroyed using DestroyIcon when no longer needed.
This struct is typically used internally by the storage information system and is not directly instantiated by user code.
Gets or sets the file attributes.
public FileAttributes Attributes { get; set; }The file attributes flags.
Gets or sets the size in bytes.
public ulong Size { get; set; }The file size in bytes.
Gets or sets the creation time.
public DateTime CreationTime { get; set; }The creation timestamp.
Gets or sets the last write time.
public DateTime LastWriteTime { get; set; }The last write timestamp.
Gets or sets the last access time.
public DateTime LastAccessTime { get; set; }The last access timestamp.
Gets or sets the display name for the file as provided by Windows Shell.
public string DisplayName { get; set; }The user-friendly display name.
This name is provided by the Windows Shell and may differ from the actual file name for special system files or shortcuts.
Gets or sets the type name as provided by Windows Shell.
public string TypeName { get; set; }The file type description (e.g., "Text Document", "PNG Image").
This is the same type name displayed in Windows Explorer's "Type" column.
Gets or sets the handle to the icon representing this file.
public Icon Icon { get; set; }The icon handle.
The icon handle must be destroyed with DestroyIcon when no longer needed to prevent resource leaks.
Gets or sets the security identifier (SID) of the file owner.
public string? OwnerSid { get; set; }The owner's SID, or null if not available.
Gets or sets the number of hard links to the file.
public uint HardLinkCount { get; set; }The count of hard links.
A value greater than 1 indicates the file has multiple hard links pointing to it.
Gets or sets the volume serial number of the volume containing the file.
public uint VolumeSerialNumber { get; set; }The volume serial number.
Gets or sets the file index (unique identifier on the volume).
public ulong FileIndex { get; set; }The unique file identifier on the volume.
This value, combined with the volume serial number, uniquely identifies the file on the system.
Gets or sets the target path if the file is a reparse point.
public string? ReparseTarget { get; set; }The target path for symbolic links, junctions, or other reparse points, or null if not a reparse point.
The following example demonstrates accessing Windows-specific storage details:
using Rheo.Storage.Information;
var fileInfo = new FileInformation(@"C:\Documents\file.txt");
if (fileInfo.TryGetWindowsStorageInfo(out var winInfo))
{
Console.WriteLine($"Display Name: {winInfo.DisplayName}");
Console.WriteLine($"Type Name: {winInfo.TypeName}");
Console.WriteLine($"Owner SID: {winInfo.OwnerSid}");
Console.WriteLine($"Hard Links: {winInfo.HardLinkCount}");
Console.WriteLine($"Volume Serial: {winInfo.VolumeSerialNumber:X8}");
Console.WriteLine($"File Index: {winInfo.FileIndex:X16}");
if (winInfo.Icon != null)
{
Console.WriteLine($"Icon available: {winInfo.Icon.Width}x{winInfo.Icon.Height}");
}
}The following example shows how to check for symbolic links and junctions:
using Rheo.Storage.Information;
var fileInfo = new FileInformation(@"C:\Links\shortcut");
if (fileInfo.TryGetWindowsStorageInfo(out var winInfo) &&
winInfo.ReparseTarget != null)
{
Console.WriteLine($"This is a reparse point");
Console.WriteLine($"Target: {winInfo.ReparseTarget}");
}This struct is not thread-safe. Instances should not be modified from multiple threads simultaneously.
- StorageInformation Class
- UnixStorageInfo Struct
- FileInformation Class
- DirectoryInformation Class
-
Storage Objects
-
Storage Information
-
Platform-Specific
-
Content-Type Analysis
-
Results
-
Models
-
-
Events & Progress