Example code to reproduce the bug:
using System; using System.Collections.Generic; using NDesk.DBus;
namespace testNMDbus { public class NetworkManagerSettings { private INetworkManagerSettings nms; private Connection DBusConnection; public NetworkManagerSettings() { DBusConnection = Bus.System; nms = DBusConnection.GetObject<INetworkManagerSettings>("org.freedesktop.NetworkManagerUserSettings", new ObjectPath("/org/freedesktop/NetworkManagerSettings")); }
public ObjectPath[] ListConnections() { return nms.ListConnections(); } }
[Interface("org.freedesktop.NetworkManagerSettings")] public interface INetworkManagerSettings { ObjectPath[] ListConnections(); }
public delegate void UpdatedSettingsHandler(Dictionary<string, Dictionary<string, object>> properties);
public class NetworkManagerSettingsConnection { private Connection DBusConnection; public INetworkManagerSettingsConnection nmsc; public NetworkManagerSettingsConnection(ObjectPath connectionPath) { DBusConnection = Bus.System; nmsc = DBusConnection.GetObject<INetworkManagerSettingsConnection>("org.freedesktop.NetworkManagerUserSettings", connectionPath); } }
[Interface("org.freedesktop.NetworkManagerSettings.Connection")] public interface INetworkManagerSettingsConnection { Dictionary<string, Dictionary<string, object>> GetSettings(); void Delete(); void Update(Dictionary<string, Dictionary<string, object>> properties); event EventHandler Removed; event UpdatedSettingsHandler Updated;
}
class MainClass { public static void Main(string[] args) { NetworkManagerSettingsConnection connection = new NetworkManagerSettingsConnection(new ObjectPath("/org/freedesktop/NetworkManagerSettings/10"));
Dictionary<string,Dictionary<string,object>> settings = connection.nmsc.GetSettings();
foreach(string key in settings.Keys) { Console.WriteLine(key+":"); foreach(string setting in settings[key].Keys) { object value = settings[key][setting]; Console.WriteLine("\t"+setting+" = "+value.ToString()); } } } } }
Example code to reproduce the bug:
using System; Collections. Generic;
using System.
using NDesk.DBus;
namespace testNMDbus ettings Settings nms; ettings( ) GetObject< INetworkManager Settings> ("org.freedeskt op.NetworkManag erUserSettings" , new ObjectPath( "/org/freedeskt op/NetworkManag erSettings" ));
{
public class NetworkManagerS
{
private INetworkManager
private Connection DBusConnection;
public NetworkManagerS
{
DBusConnection = Bus.System;
nms = DBusConnection.
}
public ObjectPath[] ListConnections() ions();
{
return nms.ListConnect
}
}
[Interface( "org.freedeskto p.NetworkManage rSettings" )] Settings
public interface INetworkManager
{
ObjectPath[] ListConnections();
}
public delegate void UpdatedSettings Handler( Dictionary< string, Dictionary<string, object>> properties);
public class NetworkManagerS ettingsConnecti on SettingsConnect ion nmsc; ettingsConnecti on(ObjectPath connectionPath) GetObject< INetworkManager SettingsConnect ion>("org. freedesktop. NetworkManagerU serSettings" , connectionPath);
{
private Connection DBusConnection;
public INetworkManager
public NetworkManagerS
{
DBusConnection = Bus.System;
nmsc = DBusConnection.
}
}
[Interface( "org.freedeskto p.NetworkManage rSettings. Connection" )] SettingsConnect ion <string, Dictionary<string, object>> GetSettings(); Dictionary< string, Dictionary<string, object>> properties); Handler Updated;
public interface INetworkManager
{
Dictionary
void Delete();
void Update(
event EventHandler Removed;
event UpdatedSettings
}
class MainClass erSettingsConne ction connection = new NetworkManagerS ettingsConnecti on(new ObjectPath( "/org/freedeskt op/NetworkManag erSettings/ 10"));
{
public static void Main(string[] args)
{
NetworkManag
Dictionary< string, Dictionary< string, object> > settings = connection. nmsc.GetSetting s();
foreach(string key in settings.Keys) WriteLine( key+":" ); key][setting] ; WriteLine( "\t"+setting+ " = "+value. ToString( ));
{
Console.
foreach(string setting in settings[key].Keys)
{
object value = settings[
Console.
}
}
}
}
}