.NET (C#) Roon Api implementation

I just now published a C# implementation of the Roon API in my GitHub.

https://github.com/ChristianRiedl/RoonApi

Is there a need for C# based Roon services ?

Hi,
I load the C# API. Start debug the TestApi. Connection to the core seems o.k.
The comboZone will not fill with zones of selected core.
Do you have an idea?

Daniel

You must activate the extension in roon app (settings -> extensions)

Thanks :wink:
Perfect work!

I will use the api in a uwp Project to use the Surface dial

After

  private async void MainPage1_Loading(FrameworkElement sender, object args)
    {
        await DiscoverCore();

I got following exception

System.IO.FileNotFoundException: “Could not load file or assembly ‘System.Security.Permissions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. Das System kann die angegebene Datei nicht finden.”

Nuget deliver only v4.4.0

After Install

System.IO.FileLoadException: “Could not load file or assembly ‘System.Security.Permissions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”

Can you help ?

Daniel

Daniel, I made some changes to make it work in UWP (netstandard 1.3). As I did not find a function to get my own IP address in netstandard 1.3 I made a change in Discovery.cs : I removed GetMyIPAddress and provided the own IP address in the constructor.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard1.3</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.2" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="System.Net.WebSockets.Client" Version="4.3.2" />
  </ItemGroup>

</Project>

@meldano : I checked in a new version with netstandard 1.3, a lot of renaming, added setting api.
I recommend to switch to this version.

O.k. Thanks a lot!
I will download your new lib and check it.

Daniel

Hi Christian,

I add the new RoonApi Lib to my UWP Project and Change some Code in the main page.
I got the same error

private async void MainPage1_Loading(FrameworkElement sender, object args)
{
await DiscoverCore();

        if (_core == null)
            return;

        _api.StartReceiver(_core.CoreIPAddress, _core.HttpPort, _roonRegister);
    }

System.IO.FileNotFoundException: “Could not load file or assembly ‘System.Security.Permissions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. Das System kann die angegebene Datei nicht finden.”

Do you have any idea ?

@meldano : I checked in a working UWP project. Important : enable “Private Network” capability.
Small change in RoonApi constructor.
My version does not use System.Security.Permissions DLL !!

Is there anybody who use the lib without problems ?

@meldano : I am afraid we are the only .NET guys in this kind of universe. I have currently no time to implement a fullscale UWP sample. But I im interested to support you to bring you app up and running. I use my library in an ASP Net Core site and in a Xamarin app without any problems. Are you able to run latest version samples from my github ? You can contact me at ric@rts.co.at.

Hey @Christian_Riedl,
This has been really useful for exploring the Roon API via C#.
It all works fine for me, I am using the WinForms example with 4.6.1
Looks like there are 3 c# people here after all :wink:

Thanks for make this API. After spending some time using the http api in javascript i saw this thread.

I have one thing that really puzzle me and its driving me nuts

The following code works and populate the list over avaliable zones when i manually click the switch and do return the three zones.

private void getzone_Toggled(object sender, RoutedEventArgs e)
{ if (toggleswitch.IsOn is true)
{ foreach (var zone in _apiTransport.Zones.Values)
{ log.Show(zone.DisplayName + " " + zone.ZoneId);} }

Since i want the list to populate by itself i made a routine that does the same, but it doesnt.
It always returns 0.

private void getZones()
{ foreach (var zone in _apiTransport.Zones.Values)
{ log.Show(zone.DisplayName + " " + zone.ZoneId);} }

i do wonder - is there a bulletproof way to fetch the list over the zones without have to actually click something?

kind regards
haavard