Brows.Sys 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Brows.Sys --version 1.0.0
                    
NuGet\Install-Package Brows.Sys -Version 1.0.0
                    
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="Brows.Sys" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Brows.Sys" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Brows.Sys" />
                    
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 Brows.Sys --version 1.0.0
                    
#r "nuget: Brows.Sys, 1.0.0"
                    
#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 Brows.Sys@1.0.0
                    
#: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=Brows.Sys&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Brows.Sys&version=1.0.0
                    
Install as a Cake Tool

Brows.Sys

Message contracts and immutable device-change models for the Brows system notification libraries. This package targets net10.0 and contains no native window-hook implementation.

Installation

dotnet add package Brows.Sys

Use this package when consuming typed messages or implementing a messenger. For the supplied Windows implementation, use Brows.Sys.Win32.Windows, which references these contracts transitively.

Contracts

Type Purpose
ISystemMessage / SystemMessage Identify a message's SystemMessageKind; SystemMessage is the base record.
ISystemMessenger Raises SystemMessaged and implements IDisposable.
SystemMessageEventArgs Carries an ISystemMessage in its Message property.
DeviceMessage / DeviceChange Carry a device and identify its change kind.
VolumeDevice Identifies a logical drive and its media/network flags.
PortDevice Copies the friendly port or connected-device name.
InterfaceDevice Copies the interface class GUID and native interface name.
DeviceTreeChange Signals that consumers should refresh their device inventory.

Contracts are in Brows.Sys. Device models are under Brows.Sys.Messages and Brows.Sys.Messages.DeviceMessages. Concrete change records are in Brows.Sys.Messages.DeviceMessages.DeviceChanges; the volume model is in Brows.Sys.Messages.DeviceMessages.Devices.

The current SystemMessageKind is Device. DeviceMessageKind.TreeChange identifies DeviceTreeChange, whose inherited Device is null because no individual device is identified. Consumers should enumerate devices initially and refresh their inventory when this notification arrives; notifications do not provide an initial snapshot.

DeviceKind preserves None=0 and Volume=1, and adds Port=2 and Interface=3. DeviceMessageKind.Change=0 is preserved and TreeChange=1 is appended.

Device changes are represented by DeviceArrival, DeviceRemovalRequest, DeviceRemovalFailed, DeviceRemovalPending, and DeviceRemovalComplete records.

Example

using Brows.Sys.Messages.DeviceMessages.DeviceChanges;
using Brows.Sys.Messages.DeviceMessages.Devices;
using System;

var message = new DeviceArrival {
    Device = new VolumeDevice {
        VolumeName = "E",
        VolumeFlag = VolumeFlag.Media,
    },
};

Console.WriteLine($"{message.DeviceChangeKind}: {message.Device.DeviceKind}");

The Windows decoder supplies VolumeName as a drive letter, such as E, without a colon or trailing backslash. VolumeFlag is a flags enum: None = 0, Media = 1, and Network = 2. Test individual bits when a combination is possible.

Consumers should inspect the payload before assuming it is a volume:

using Brows.Sys;
using Brows.Sys.Messages.DeviceMessages;
using Brows.Sys.Messages.DeviceMessages.Devices;
using System;

static void PrintMessage(ISystemMessage message) {
    if (message is DeviceChange { Device: VolumeDevice volume } change) {
        Console.WriteLine($"{change.DeviceChangeKind}: {volume.VolumeName} ({volume.VolumeFlag})");
    }
}

The supplied decoder can emit a recognized device-change event with a null Device when its native device type has no corresponding model; payloads whose native device type is outside the platform's enumeration produce no message. The device kind is available through Device.DeviceKind; there is no separate kind property on DeviceChange.

Named devices and topology

using Brows.Sys;
using Brows.Sys.Messages.DeviceMessages;
using Brows.Sys.Messages.DeviceMessages.Devices;
using System;

static void PrintDeviceNotification(ISystemMessage message) {
    switch (message) {
        case DeviceTreeChange:
            Console.WriteLine("Device inventory changed; re-enumerate devices.");
            break;
        case DeviceChange { Device: PortDevice port } change:
            Console.WriteLine($"{change.DeviceChangeKind}: {port.PortName}");
            break;
        case DeviceChange { Device: InterfaceDevice deviceInterface } change:
            Console.WriteLine($"{change.DeviceChangeKind}: {deviceInterface.InterfaceClassGuid}");
            Console.WriteLine(deviceInterface.InterfaceName);
            break;
    }
}

Interface names are copied native symbolic identifiers. Resolving friendly names, device properties, and mounted paths belongs to the application. Port names are the names supplied by the broadcast and are not restricted to COM-number syntax.

Lifetime

Dispose an ISystemMessenger when subscribing directly. When reading through ISystemMessengerSet from Brows.Sys.Composition, the enumerator owns the messengers it creates and cleans them up when reading ends.

License and source

MIT license. Source repository.

Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Brows.Sys:

Package Downloads
Brows.Sys.Composition

Package Description

Brows.Sys.Win32

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 104 10/8/2026
1.0.0 118 10/8/2026