MumbleSharp icon indicating copy to clipboard operation
MumbleSharp copied to clipboard

`internal set` properties on Channel model cannot be set by custom IMumbleProtocol implementations

Open haydenmc opened this issue 5 years ago • 1 comments

Some properties in the Channel model here have setters that are scoped as internal, so a developer writing code that lives outside of the MumbleSharp's assembly cannot manipulate them.

This makes it particularly difficult if you're trying to implement a custom IMumbleProtocol, since some of the methods implemented by the protocol necessitate changes to those fields (see here).

haydenmc avatar Mar 18 '20 08:03 haydenmc

That's a good point. The purpose of making those internal was so that people using the models can't fiddle with the values, but of course you're right that makes implementing a protocol impossible.

Perhaps the best way to handle this would be for there to be an immutable model interface with a mutable class, the protocol gets a reference to the class but it's publicly exposed through the interface.

e.g.

public interface IChannel {
    public uint parent { get; }
}

public class Channel : IChannel {
    public uint parent { get; set; }
}

Would you be interested in submitting a PR for something like this?

martindevans avatar Mar 18 '20 14:03 martindevans