OscQueryLibrary 1.1.2

dotnet add package OscQueryLibrary --version 1.1.2                
NuGet\Install-Package OscQueryLibrary -Version 1.1.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="OscQueryLibrary" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OscQueryLibrary --version 1.1.2                
#r "nuget: OscQueryLibrary, 1.1.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.
// Install OscQueryLibrary as a Cake Addin
#addin nuget:?package=OscQueryLibrary&version=1.1.2

// Install OscQueryLibrary as a Cake Tool
#tool nuget:?package=OscQueryLibrary&version=1.1.2                

OscQuery Example Library

NuGet OscQueryLibrary NuGet OscQueryLibrary Downloads

Info

A more human readable OscQuery library for VRChat.

Functionality

Auto negotiate with VRC to connect to your OSC server without the need of a OSC router. <br> Receive available parameter list immediately without needing to read avatar JSON file or switch avatar. <br> Quest support, it can auto discover VRC running on the same local network.

Setup

// listen on localhost
var localHostServer = new OscQueryServer(
    "HelloWorld", // service name
    IPAddress.Loopback // ip address for udp and http server
);
localHostServer.FoundVrcClient += FoundVrcClient; // event on vrc discovery
localHostServer.ParameterUpdate += UpdateAvailableParameters; // event on parameter list update
localHostServer.Start(); // this is required to start the service, no events will fire without this.

// listen for VRC on every network interface (Quest only)
var host = await Dns.GetHostEntryAsync(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
    if (ip.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
        continue;

    var server = new OscQueryServer(
        "HelloWorld", // service name
        ip
    );

    server.FoundVrcClient += FoundVrcClient; // event on vrc discovery
    server.ParameterUpdate += UpdateAvailableParameters; // event on parameter list update
    server.Start(); // this is required to start the service, no events will fire without this.
}

private static Task FoundVrcClient(OscQueryServer oscQueryServer, IPEndPoint ipEndPoint)
{
    // stop tasks
    Task.Delay(1000).Wait(); // wait for tasks to stop
    _gameConnection?.Dispose();
    _gameConnection = null;

    _gameConnection = new OscDuplex(
        new IPEndPoint(IPAddress.Parse(OscQueryServer.OscIpAddress), OscQueryServer.OscReceivePort),
        ipEndPoint)
    );
    Task.Run(ReceiverLoopAsync);
    return Task.CompletedTask;
}

private static Task UpdateAvailableParameters(Dictionary<string, object?> parameterList, string s)
{
    // ran when client connects or optionally when user changes avatar
    // the parameter values are in their initial state so they are mostly useless
    foreach (var parameter in parameterList)
    {
        Console.WriteLine(parameter.Key);
    }
    return Task.CompletedTask;
}

// depending on your OSC library you may want to run this method on avatar change to update your list of available parameters
if (received.Address == "/avatar/change")
    OscQueryServer.GetParameters();

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 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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

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.1.2 95 11/18/2024
1.1.1 206 9/30/2024
1.1.0 134 9/16/2024
1.0.0 118 7/11/2024