Skip to content

Commit

Permalink
Added notification: notifyserveredited
Browse files Browse the repository at this point in the history
  • Loading branch information
Scordo committed Oct 16, 2016
1 parent ea0e587 commit a54a11e
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TS3QueryLib.Core.Framework/TS3QueryLib.Core.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\MessageReceivedEventArgs.cs">
<Link>Server\Notification\EventArgs\MessageReceivedEventArgs.cs</Link>
</Compile>
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ServerEditedEventArgs.cs">
<Link>Server\Notification\EventArgs\ServerEditedEventArgs.cs</Link>
</Compile>
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\TokenUsedEventArgs.cs">
<Link>Server\Notification\EventArgs\TokenUsedEventArgs.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using TS3QueryLib.Core.CommandHandling;
using TS3QueryLib.Core.Common;
using TS3QueryLib.Core.Server.Responses;

namespace TS3QueryLib.Core.Server.Notification.EventArgs
{
public class ServerEditedEventArgs : System.EventArgs, IDump
{
#region Properties

public uint ReasonId { get; protected set; }
public uint InvokerId { get; protected set; }
public string InvokerName { get; protected set; }
public string InvokerUniqueId { get; protected set; }

public string Name { get; set; }
public uint? DefaultServerGroupId { get; set; }
public uint? DefaultChannelGroupId { get; set; }
public double? PrioritySpeakerDimmModification { get; set; }
public string HostBannerUrl { get; set; }
public string HostBannerGraphicsUrl { get; set; }
public uint? HostBannerGraphicsInterval { get; set; }
public string HostButtonGraphicsUrl { get; set; }
public string HostButtonTooltip { get; set; }
public string HostButtonUrl { get; set; }
public HostBannerMode? HostBannerMode { get; set; }

public string PhoneticName { get; set; }
public uint? IconId { get; set; }

#endregion

#region Constructors


public ServerEditedEventArgs(CommandParameterGroupList commandParameterGroupList)
{
if (commandParameterGroupList == null)
throw new ArgumentNullException(nameof(commandParameterGroupList));

ReasonId = commandParameterGroupList.GetParameterValue<uint>("reasonid");
InvokerId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
InvokerName = commandParameterGroupList.GetParameterValue<string>("invokername");
InvokerUniqueId = commandParameterGroupList.GetParameterValue<string>("invokeruid");

Name = commandParameterGroupList.GetParameterValue<string>("virtualserver_name");
DefaultServerGroupId = commandParameterGroupList.GetParameterValue<uint?>("virtualserver_default_server_group");
DefaultChannelGroupId = commandParameterGroupList.GetParameterValue<uint?>("virtualserver_default_channel_group");
HostBannerUrl = commandParameterGroupList.GetParameterValue<string>("virtualserver_hostbanner_url");
HostBannerGraphicsUrl = commandParameterGroupList.GetParameterValue<string>("virtualserver_hostbanner_gfx_url");

HostBannerGraphicsInterval = commandParameterGroupList.GetParameterValue<uint?>("virtualserver_hostbanner_gfx_interval");
PrioritySpeakerDimmModification = commandParameterGroupList.GetParameterValue<double?>("virtualserver_priority_speaker_dimm_modificator");
HostButtonTooltip = commandParameterGroupList.GetParameterValue("virtualserver_hostbutton_tooltip");
HostButtonUrl = commandParameterGroupList.GetParameterValue("virtualserver_hostbutton_url");
PhoneticName = commandParameterGroupList.GetParameterValue("virtualserver_name_phonetic");
IconId = commandParameterGroupList.GetParameterValue<uint?>("virtualserver_icon_id");
HostButtonGraphicsUrl = commandParameterGroupList.GetParameterValue<string>("virtualserver_hostbutton_gfx_url");
HostBannerMode = (HostBannerMode?)commandParameterGroupList.GetParameterValue<uint?>("virtualserver_hostbanner_mode");
}

#endregion
}
}
12 changes: 12 additions & 0 deletions TS3QueryLib.Core.Silverlight/Server/Notification/Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public class Notifications : NotificationsBase
/// </summary>
public event EventHandler<ChannelDeletedEventArgs> ChannelDeleted;

/// <summary>
/// Raised, when the current server was edited
/// </summary>
public event EventHandler<ServerEditedEventArgs> ServerEdited;

/// <summary>
/// Raised, when a unknown notification was received
/// </summary>
Expand Down Expand Up @@ -127,6 +132,7 @@ protected override Dictionary<string, Action<CommandParameterGroupList>> GetNoti
{ "notifychannelpasswordchanged", HandleChannelPasswordChanged },
{ "notifychannelcreated", HandleChannelCreated },
{ "notifychanneldeleted", HandleChannelDeleted },
{ "notifyserveredited", HandleServerEdited },
{ "*", HandleUnknownNotificationReceived },
};
}
Expand Down Expand Up @@ -255,6 +261,12 @@ private void HandleChannelDeleted(CommandParameterGroupList parameterGroupList)
ThreadPool.QueueUserWorkItem(x => ChannelDeleted(this, new ChannelDeletedEventArgs(parameterGroupList)), null);
}

private void HandleServerEdited(CommandParameterGroupList parameterGroupList)
{
if (ServerEdited != null)
ThreadPool.QueueUserWorkItem(x => ServerEdited(this, new ServerEditedEventArgs(parameterGroupList)), null);
}

private void HandleUnknownNotificationReceived(CommandParameterGroupList parameterGroupList)
{
if (UnknownNotificationReceived != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<Compile Include="Server\Notification\EventArgs\ClientMovedByClientEventArgs.cs" />
<Compile Include="Server\Notification\EventArgs\ClientMovedEventArgs.cs" />
<Compile Include="Server\Notification\EventArgs\MessageReceivedEventArgs.cs" />
<Compile Include="Server\Notification\EventArgs\ServerEditedEventArgs.cs" />
<Compile Include="Server\Notification\EventArgs\TokenUsedEventArgs.cs" />
<Compile Include="Server\Notification\EventArgs\UnknownNotificationEventArgs.cs" />
<Compile Include="Server\Notification\Notifications.cs" />
Expand Down
3 changes: 3 additions & 0 deletions TS3QueryLib.Core.WP7/TS3QueryLib.Core.WP7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\MessageReceivedEventArgs.cs">
<Link>Server\Notification\EventArgs\MessageReceivedEventArgs.cs</Link>
</Compile>
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ServerEditedEventArgs.cs">
<Link>Server\Notification\EventArgs\ServerEditedEventArgs.cs</Link>
</Compile>
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\TokenUsedEventArgs.cs">
<Link>Server\Notification\EventArgs\TokenUsedEventArgs.cs</Link>
</Compile>
Expand Down

0 comments on commit a54a11e

Please sign in to comment.