From e7a2c7c39942b0593b0142530a53d12fc0bdd3f8 Mon Sep 17 00:00:00 2001
From: Meetsch <37514759+Meetsch@users.noreply.github.com>
Date: Tue, 25 Feb 2020 08:55:12 +0100
Subject: [PATCH] (fix) Channels and Users didn't have all their info upon
creation and needed an update.
---
MumbleSharp/BasicMumbleProtocol.cs | 77 ++++++++++++--------------
MumbleSharp/MumbleSharp.nuspec | 4 +-
MumbleSharp/Properties/AssemblyInfo.cs | 2 +-
3 files changed, 38 insertions(+), 45 deletions(-)
diff --git a/MumbleSharp/BasicMumbleProtocol.cs b/MumbleSharp/BasicMumbleProtocol.cs
index 4131976..cb9772d 100644
--- a/MumbleSharp/BasicMumbleProtocol.cs
+++ b/MumbleSharp/BasicMumbleProtocol.cs
@@ -195,23 +195,19 @@ public virtual void ChannelState(ChannelState channelState)
Position = channelState.Position
};
},
- (i, c) =>
- {
- //Update existing channel in the dictionary
- if (channelState.ShouldSerializeName())
- c.Name = channelState.Name;
- if (channelState.ShouldSerializeParent())
- c.Parent = channelState.Parent;
- if (channelState.ShouldSerializeTemporary())
- c.Temporary = channelState.Temporary;
- if (channelState.ShouldSerializeDescription())
- c.Description = channelState.Description;
- if (channelState.ShouldSerializePosition())
- c.Position = channelState.Position;
-
- return c;
- }
- );
+ (i, c) => c);
+
+ //Update channel in the dictionary
+ if (channelState.ShouldSerializeName())
+ channel.Name = channelState.Name;
+ if (channelState.ShouldSerializeParent())
+ channel.Parent = channelState.Parent;
+ if (channelState.ShouldSerializeTemporary())
+ channel.Temporary = channelState.Temporary;
+ if (channelState.ShouldSerializeDescription())
+ channel.Description = channelState.Description;
+ if (channelState.ShouldSerializePosition())
+ channel.Position = channelState.Position;
if (channel.Id == 0)
RootChannel = channel;
@@ -280,31 +276,28 @@ public virtual void UserState(UserState userState)
//Add new user to the dictionary
added = true;
return new User(this, userState.Session, _audioSampleRate, _audioSampleBits, _audioSampleChannels);
- }, (i, u) =>
- {
- //Update existing user in the dictionary
- if (userState.ShouldSerializeSelfDeaf())
- u.SelfDeaf = userState.SelfDeaf;
- if (userState.ShouldSerializeSelfMute())
- u.SelfMuted = userState.SelfMute;
- if (userState.ShouldSerializeMute())
- u.Muted = userState.Mute;
- if (userState.ShouldSerializeDeaf())
- u.Deaf = userState.Deaf;
- if (userState.ShouldSerializeSuppress())
- u.Suppress = userState.Suppress;
- if (userState.ShouldSerializeName())
- u.Name = userState.Name;
- if (userState.ShouldSerializeComment())
- u.Comment = userState.Comment;
-
- if (userState.ShouldSerializeChannelId())
- u.Channel = ChannelDictionary[userState.ChannelId];
- else if (u.Channel == null)
- u.Channel = RootChannel;
-
- return u;
- });
+ }, (i, u) => u);
+
+ //Update user in the dictionary
+ if (userState.ShouldSerializeSelfDeaf())
+ user.SelfDeaf = userState.SelfDeaf;
+ if (userState.ShouldSerializeSelfMute())
+ user.SelfMuted = userState.SelfMute;
+ if (userState.ShouldSerializeMute())
+ user.Muted = userState.Mute;
+ if (userState.ShouldSerializeDeaf())
+ user.Deaf = userState.Deaf;
+ if (userState.ShouldSerializeSuppress())
+ user.Suppress = userState.Suppress;
+ if (userState.ShouldSerializeName())
+ user.Name = userState.Name;
+ if (userState.ShouldSerializeComment())
+ user.Comment = userState.Comment;
+
+ if (userState.ShouldSerializeChannelId())
+ user.Channel = ChannelDictionary[userState.ChannelId];
+ else if (user.Channel == null)
+ user.Channel = RootChannel;
//if (added)
UserJoined(user);
diff --git a/MumbleSharp/MumbleSharp.nuspec b/MumbleSharp/MumbleSharp.nuspec
index ecee262..796623e 100644
--- a/MumbleSharp/MumbleSharp.nuspec
+++ b/MumbleSharp/MumbleSharp.nuspec
@@ -7,12 +7,12 @@