From dc5744e0d294e42d41ca7b2a2b87739c42cd28c3 Mon Sep 17 00:00:00 2001 From: bonzaii Date: Fri, 3 Apr 2020 23:18:48 +0100 Subject: [PATCH 1/4] Added -secondsempty flag to channellist command --- TS3QueryLib.Net.Core/Server/Commands/ChannelListCommand.cs | 5 ++++- .../Server/Entitities/ChannelListEntryBase.cs | 6 ++++++ TS3QueryLib.Net.Core/TS3QueryLib.Net.Core.csproj | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/TS3QueryLib.Net.Core/Server/Commands/ChannelListCommand.cs b/TS3QueryLib.Net.Core/Server/Commands/ChannelListCommand.cs index 2683c3e..189e7df 100644 --- a/TS3QueryLib.Net.Core/Server/Commands/ChannelListCommand.cs +++ b/TS3QueryLib.Net.Core/Server/Commands/ChannelListCommand.cs @@ -5,7 +5,7 @@ namespace TS3QueryLib.Net.Core.Server.Commands { public class ChannelListCommand : ExecutableEntityListCommand { - public ChannelListCommand(bool includeAll, bool includeTopics = false, bool includeFlags = false, bool includeVoiceInfo = false, bool includeLimits = false, bool includeIcon = false) : base("ChannelList") + public ChannelListCommand(bool includeAll, bool includeTopics = false, bool includeFlags = false, bool includeVoiceInfo = false, bool includeLimits = false, bool includeIcon = false, bool includeSecondsEmpty = false) : base("ChannelList") { if (includeTopics || includeAll) AddOption("topic"); @@ -21,6 +21,9 @@ public ChannelListCommand(bool includeAll, bool includeTopics = false, bool incl if (includeIcon || includeAll) AddOption("icon"); + + if (includeSecondsEmpty || includeAll) + AddOption("secondsempty"); } } } \ No newline at end of file diff --git a/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs b/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs index 49849cc..e8080d9 100644 --- a/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs +++ b/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs @@ -75,6 +75,10 @@ public SpacerInfo SpacerInfo public uint? ChannelIconId { get; protected set; } + #endregion + #region SecondsEmpty-Properties + public double? SecondsEmpty { get; protected set; } + #endregion #endregion @@ -106,6 +110,8 @@ protected void ApplyFrom(CommandParameterGroup currrentParameterGroup, CommandPa MaxClients = currrentParameterGroup.GetParameterValue("channel_maxclients"); MaxFamilyClients = currrentParameterGroup.GetParameterValue("channel_maxfamilyclients"); ChannelIconId = currrentParameterGroup.GetParameterValue("channel_icon_id"); + + SecondsEmpty = currrentParameterGroup.GetParameterValue("seconds_empty"); } #endregion diff --git a/TS3QueryLib.Net.Core/TS3QueryLib.Net.Core.csproj b/TS3QueryLib.Net.Core/TS3QueryLib.Net.Core.csproj index 3a1fd52..6267958 100644 --- a/TS3QueryLib.Net.Core/TS3QueryLib.Net.Core.csproj +++ b/TS3QueryLib.Net.Core/TS3QueryLib.Net.Core.csproj @@ -5,7 +5,7 @@ Copyright © Jens Hofmann 2016 TS3QueryLib.Net.Core Jens Hofmann - netstandard1.4;netstandard1.6;netstandard2.0 + netstandard1.4;netstandard1.6;netstandard2.0;netstandard2.1 TS3QueryLib.Net.Core TS3QueryLib.Net.Core TeamSpeak;Query;C#;CSharp From bb77dbb7010ccac3b1af71f594ec215821bd3130 Mon Sep 17 00:00:00 2001 From: bonzaii Date: Fri, 3 Apr 2020 23:22:12 +0100 Subject: [PATCH 2/4] Added -secondsempty flag to channellist command (code cleaning) --- TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs b/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs index e8080d9..4bf8a06 100644 --- a/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs +++ b/TS3QueryLib.Net.Core/Server/Entitities/ChannelListEntryBase.cs @@ -76,7 +76,9 @@ public SpacerInfo SpacerInfo public uint? ChannelIconId { get; protected set; } #endregion + #region SecondsEmpty-Properties + public double? SecondsEmpty { get; protected set; } #endregion From 3f30ed4050da4078812209fa4f492caebd1c4e2b Mon Sep 17 00:00:00 2001 From: bonzaii Date: Sat, 4 Apr 2020 22:38:52 +0100 Subject: [PATCH 3/4] Hack for null client_icon_id --- .../Common/CommandHandling/CommandParameterGroup.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/TS3QueryLib.Net.Core/Common/CommandHandling/CommandParameterGroup.cs b/TS3QueryLib.Net.Core/Common/CommandHandling/CommandParameterGroup.cs index 041c12e..df7cc03 100644 --- a/TS3QueryLib.Net.Core/Common/CommandHandling/CommandParameterGroup.cs +++ b/TS3QueryLib.Net.Core/Common/CommandHandling/CommandParameterGroup.cs @@ -65,8 +65,13 @@ public static T ConvertValue(string parameterName, string parameterValue) try { if (default(T) != null && parameterValue == null) - throw new InvalidCastException(string.Format("Can not cast null value of parameter '{0}' to target type '{1}'.", parameterName, targetType)); - + { + if (parameterName.Contains("client_icon_id")) + parameterValue = "0"; + else + throw new InvalidCastException(string.Format("Can not cast null value of parameter '{0}' to target type '{1}'.", parameterName, targetType)); + } + if (parameterValue != null && (targetType == typeof(uint) || targetType == typeof(uint?))) { decimal decimalValue = Convert.ToDecimal(parameterValue, CultureInfo.InvariantCulture); From 397fa8274463fa92cff0e7bf649513cfcb775436 Mon Sep 17 00:00:00 2001 From: bonzaii Date: Sat, 4 Apr 2020 23:52:11 +0100 Subject: [PATCH 4/4] building agenst newer .net core (3.1.0) --- .../TS3QueryLib.Net.Core.TestApp.csproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TS3QueryLib.Net.Core.TestApp/TS3QueryLib.Net.Core.TestApp.csproj b/TS3QueryLib.Net.Core.TestApp/TS3QueryLib.Net.Core.TestApp.csproj index a8ff366..f2d0ccc 100644 --- a/TS3QueryLib.Net.Core.TestApp/TS3QueryLib.Net.Core.TestApp.csproj +++ b/TS3QueryLib.Net.Core.TestApp/TS3QueryLib.Net.Core.TestApp.csproj @@ -1,12 +1,11 @@  - netcoreapp2.0 + netcoreapp3.1 TS3QueryLib.Net.Core.TestApp Exe TS3QueryLib.Net.Core.TestApp - 2.0.3 - $(PackageTargetFallback);dnxcore50 + 3.1.0 false false false