Skip to content

Commit eba64d4

Browse files
committed
Preparing Ts3lib client for nuget package
Ref #56
1 parent 1007ea1 commit eba64d4

File tree

168 files changed

+2072
-2312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+2072
-2312
lines changed

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "TS3Client/Declarations"]
2-
path = TS3Client/Declarations
1+
[submodule "TSLib/Declarations"]
2+
path = TSLib/Declarations
33
url = https://github.com/ReSpeak/tsdeclarations

Directory.Build.targets

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project>
22
<ItemGroup>
33
<PackageReference Include="NLog" Version="4.6.8" />
4-
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
5-
<PackageReference Condition="'$(TargetFramework)' != 'netcoreapp2.2'" Include="System.Memory" Version="4.5.3" />
4+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
5+
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="System.Memory" Version="4.5.3" />
6+
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="System.Memory" Version="4.5.3" />
67
</ItemGroup>
78
</Project>

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Translations need to be manually approved and will then be automatically built a
121121
This project is licensed under [OSL-3.0](https://opensource.org/licenses/OSL-3.0).
122122

123123
Why OSL-3.0:
124-
- OSL allows you to link to our libraries without needing to disclose your own project, which might be useful if you want to use the TS3Client as a library.
124+
- OSL allows you to link to our libraries without needing to disclose your own project, which might be useful if you want to use the TSLib as a library.
125125
- If you create plugins you do not have to make them public like in GPL. (Although we would be happy if you shared them :)
126126
- With OSL we want to allow you providing the TS3AB as a service (even commercially). We do not want the software to be sold but the service. We want this software to be free for everyone.
127127
- TL; DR? https://tldrlegal.com/license/open-software-licence-3.0

TS3ABotUnitTests/BotCommandTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using TS3AudioBot.CommandSystem.CommandResults;
1313
using TS3AudioBot.CommandSystem.Commands;
1414
using TS3AudioBot.Dependency;
15-
using TS3Client;
15+
using TSLib;
1616

1717
namespace TS3ABotUnitTests
1818
{

TS3ABotUnitTests/RingQueueTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using NUnit.Framework;
22
using System;
3-
using TS3Client.Full;
3+
using TSLib.Full;
44

55
namespace TS3ABotUnitTests
66
{

TS3ABotUnitTests/TS3ABotUnitTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<ItemGroup>
1919
<ProjectReference Include="..\TS3AudioBot\TS3AudioBot.csproj" />
20-
<ProjectReference Include="..\TS3Client\TS3Client.csproj" />
20+
<ProjectReference Include="..\TSLib\TSLib.csproj" />
2121
</ItemGroup>
2222

2323
</Project>

TS3ABotUnitTests/TS3MessageParserTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
using System.Collections;
33
using System.Reflection;
44
using System.Text;
5-
using TS3Client;
6-
using TS3Client.Messages;
5+
using TSLib;
6+
using TSLib.Messages;
77

88
namespace TS3ABotUnitTests
99
{

TS3ABotUnitTests/UnitTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
using TS3AudioBot.History;
1313
using TS3AudioBot.Playlists.Shuffle;
1414
using TS3AudioBot.ResourceFactories;
15-
using TS3Client;
16-
using TS3Client.Full;
17-
using TS3Client.Messages;
15+
using TSLib;
16+
using TSLib.Full;
17+
using TSLib.Messages;
1818

1919
namespace TS3ABotUnitTests
2020
{
@@ -235,12 +235,12 @@ public void Factory_YoutubeFactoryTest()
235235
}
236236
}
237237

238-
/* ======================= TS3Client Tests ========================*/
238+
/* ======================= TSLib Tests ========================*/
239239

240240
[Test]
241241
public void VersionSelfCheck()
242242
{
243-
Ts3Crypt.VersionSelfCheck();
243+
TsCrypt.VersionSelfCheck();
244244
}
245245
}
246246

TS3AudioBot.ruleset

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RuleSet Name="Rules for TS3Client" Description="Code analysis rules for TS3Client.csproj." ToolsVersion="16.0">
2+
<RuleSet Name="Rules for TSAB Project" Description="Code analysis rules for the TSAB Project." ToolsVersion="16.0">
33
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
44
<Rule Id="CA1001" Action="Warning" />
55
<Rule Id="CA1002" Action="Info" />

TS3AudioBot.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TS3AudioBot", "TS3AudioBot\
66
EndProject
77
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TS3ABotUnitTests", "TS3ABotUnitTests\TS3ABotUnitTests.csproj", "{20B6F767-5396-41D9-83D8-98B5730C6E2E}"
88
EndProject
9-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TS3Client", "TS3Client\TS3Client.csproj", "{0EB99E9D-87E5-4534-A100-55D231C2B6A6}"
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TSLib", "TSLib\TSLib.csproj", "{0EB99E9D-87E5-4534-A100-55D231C2B6A6}"
1010
EndProject
1111
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ADAA5A65-0CE1-45FA-91F4-3D8D39073AB0}"
1212
ProjectSection(SolutionItems) = preProject

TS3AudioBot/Algorithm/TimedCache.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using System;
1111
using System.Collections.Concurrent;
1212
using System.Linq;
13-
using TS3Client.Helper;
13+
using TSLib.Helper;
1414

1515
namespace TS3AudioBot.Algorithm
1616
{

TS3AudioBot/Audio/AudioValues.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System;
11-
using TS3Client.Helper;
11+
using TSLib.Helper;
1212

1313
namespace TS3AudioBot.Audio
1414
{

TS3AudioBot/Audio/CustomTargetPipe.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
using System;
1111
using System.Collections.Generic;
1212
using System.Linq;
13-
using TS3Client;
14-
using TS3Client.Audio;
15-
using TS3Client.Full;
13+
using TSLib;
14+
using TSLib.Audio;
15+
using TSLib.Full;
1616

1717
namespace TS3AudioBot.Audio
1818
{
@@ -56,9 +56,9 @@ public bool Active
5656
private bool subscriptionSetupChanged;
5757
private readonly object subscriptionLockObj = new object();
5858

59-
private readonly Ts3FullClient client;
59+
private readonly TsFullClient client;
6060

61-
public CustomTargetPipe(Ts3FullClient client)
61+
public CustomTargetPipe(TsFullClient client)
6262
{
6363
this.client = client;
6464
subscriptionSetupChanged = true;

TS3AudioBot/Audio/FfmpegProducer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
using System.Threading;
1818
using TS3AudioBot.Config;
1919
using TS3AudioBot.Helper;
20-
using TS3Client.Audio;
21-
using TS3Client.Helper;
20+
using TSLib.Audio;
21+
using TSLib.Helper;
2222

2323
namespace TS3AudioBot.Audio
2424
{

TS3AudioBot/Audio/IPlayerSource.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System;
11-
using TS3Client.Audio;
11+
using TSLib.Audio;
1212

1313
namespace TS3AudioBot.Audio
1414
{

TS3AudioBot/Audio/IVoiceTarget.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System.Collections.Generic;
11-
using TS3Client;
12-
using TS3Client.Audio;
11+
using TSLib;
12+
using TSLib.Audio;
1313

1414
namespace TS3AudioBot.Audio
1515
{

TS3AudioBot/Audio/MetaData.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System;
11-
using TS3Client;
11+
using TSLib;
1212

1313
namespace TS3AudioBot.Audio
1414
{

TS3AudioBot/Audio/PlayManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using TS3AudioBot.Localization;
1616
using TS3AudioBot.Playlists;
1717
using TS3AudioBot.ResourceFactories;
18-
using TS3Client.Helper;
18+
using TSLib.Helper;
1919

2020
namespace TS3AudioBot.Audio
2121
{

TS3AudioBot/Audio/Player.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
using TS3AudioBot.Config;
1212
using TS3AudioBot.Helper;
1313
using TS3AudioBot.ResourceFactories;
14-
using TS3Client;
15-
using TS3Client.Audio;
16-
using TS3Client.Helper;
14+
using TSLib;
15+
using TSLib.Audio;
16+
using TSLib.Helper;
1717

1818
namespace TS3AudioBot.Audio
1919
{

TS3AudioBot/Audio/StallCheckPipe.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System;
11-
using TS3Client.Audio;
11+
using TSLib.Audio;
1212

1313
namespace TS3AudioBot.Audio
1414
{

TS3AudioBot/Audio/StreamAudioPlayerSource.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

1010
using System;
11-
using TS3Client.Audio;
11+
using TSLib.Audio;
1212

1313
namespace TS3AudioBot.Audio
1414
{

TS3AudioBot/Bot.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
using TS3AudioBot.Plugins;
2626
using TS3AudioBot.ResourceFactories;
2727
using TS3AudioBot.Sessions;
28-
using TS3Client;
29-
using TS3Client.Full;
30-
using TS3Client.Helper;
31-
using TS3Client.Messages;
28+
using TSLib;
29+
using TSLib.Full;
30+
using TSLib.Helper;
31+
using TSLib.Messages;
3232

3333
namespace TS3AudioBot
3434
{
@@ -53,7 +53,7 @@ public sealed class Bot : IDisposable
5353
private readonly ResourceResolver resourceResolver;
5454
private readonly CommandManager commandManager;
5555
private Ts3Client ts3client;
56-
private Ts3FullClient ts3FullClient;
56+
private TsFullClient ts3FullClient;
5757
private SessionManager sessionManager;
5858
private PlayManager playManager;
5959
private IVoiceTarget targetManager;
@@ -90,8 +90,8 @@ public E<string> InitializeBot()
9090
builder.RequestModule<PlaylistIO>();
9191
builder.RequestModule<PlaylistManager>();
9292
builder.AddModule(Id);
93-
builder.AddModule(new Ts3FullClient());
94-
builder.RequestModule<Ts3BaseFunctions, Ts3FullClient>();
93+
builder.AddModule(new TsFullClient());
94+
builder.RequestModule<TsBaseFunctions, TsFullClient>();
9595
builder.RequestModule<Ts3Client>();
9696
builder.RequestModule<Player>();
9797
builder.RequestModule<CustomTargetPipe>();
@@ -110,7 +110,7 @@ public E<string> InitializeBot()
110110
return "Could not load all bot modules";
111111
}
112112

113-
ts3FullClient = Injector.GetModule<Ts3FullClient>();
113+
ts3FullClient = Injector.GetModule<TsFullClient>();
114114
ts3client = Injector.GetModule<Ts3Client>();
115115
player = Injector.GetModule<Player>();
116116
player.SetTarget(Injector.GetModule<CustomTargetPipe>());

TS3AudioBot/BotManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using TS3AudioBot.Config;
1515
using TS3AudioBot.Dependency;
1616
using TS3AudioBot.Helper;
17-
using TS3Client.Helper;
17+
using TSLib.Helper;
1818

1919
namespace TS3AudioBot
2020
{
@@ -56,7 +56,7 @@ public void RunBots(bool interactive)
5656

5757
string address = Interactive.LoopAction("Please enter the ip, domain or nickname (with port; default: 9987) where to connect to:", addr =>
5858
{
59-
if (TS3Client.TsDnsResolver.TryResolve(addr, out _))
59+
if (TSLib.TsDnsResolver.TryResolve(addr, out _))
6060
return true;
6161
Console.WriteLine("The address seems invalid or could not be resolved, continue anyway? [y/N]");
6262
return Interactive.UserAgree(defaultTo: false);

TS3AudioBot/ClientCall.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// You should have received a copy of the Open Software License along with this
88
// program. If not, see <https://opensource.org/licenses/OSL-3.0>.
99

10-
using TS3Client;
10+
using TSLib;
1111

1212
namespace TS3AudioBot
1313
{

TS3AudioBot/CommandSystem/Commands/FunctionCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using TS3AudioBot.Helper;
1818
using TS3AudioBot.Localization;
1919
using TS3AudioBot.Web.Api;
20-
using TS3Client.Helper;
20+
using TSLib.Helper;
2121

2222
namespace TS3AudioBot.CommandSystem.Commands
2323
{

TS3AudioBot/CommandSystem/Text/LongTextTransform.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@
1111
using System.Collections.Generic;
1212
using System.Linq;
1313
using System.Text;
14-
using TS3Client.Commands;
15-
using TS3Client.Helper;
14+
using TSLib.Commands;
15+
using TSLib.Helper;
1616

1717
namespace TS3AudioBot.CommandSystem.Text
1818
{
1919
public static class LongTextTransform
2020
{
2121
private static readonly byte[] SeparatorWeight = new byte[] { (byte)'\n', (byte)',', (byte)' ' };
2222

23-
public static IEnumerable<string> Transform(string text, LongTextBehaviour behaviour, int limit = int.MaxValue, int maxMessageSize = Ts3Const.MaxSizeTextMessage)
23+
public static IEnumerable<string> Transform(string text, LongTextBehaviour behaviour, int limit = int.MaxValue, int maxMessageSize = TsConst.MaxSizeTextMessage)
2424
{
2525
if (maxMessageSize < 4)
2626
throw new ArgumentOutOfRangeException(nameof(maxMessageSize), "The minimum split length must be at least 4 bytes to fit all utf8 characters");
2727

2828
// Assuming worst case that each UTF-8 character which epands to 4 bytes.
2929
// If the message is still shorter we can safely return in 1 block.
30-
if (text.Length * 4 <= Ts3Const.MaxSizeTextMessage)
30+
if (text.Length * 4 <= TsConst.MaxSizeTextMessage)
3131
return new[] { text };
3232

3333
var bytes = Encoding.UTF8.GetBytes(text);
3434

3535
// If the entire text UTF-8 encoded fits in one message we can return early.
36-
if (bytes.Length * 2 < Ts3Const.MaxSizeTextMessage)
36+
if (bytes.Length * 2 < TsConst.MaxSizeTextMessage)
3737
return new[] { text };
3838

3939
var list = new List<string>();
@@ -48,7 +48,7 @@ public static IEnumerable<string> Transform(string text, LongTextBehaviour behav
4848

4949
for (; i < block.Length; i++)
5050
{
51-
tokenCnt += Ts3String.IsDoubleChar(block[i]) ? 2 : 1;
51+
tokenCnt += TsString.IsDoubleChar(block[i]) ? 2 : 1;
5252

5353
if (tokenCnt > maxMessageSize)
5454
{

TS3AudioBot/CommandSystem/XCommandSystem.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using TS3AudioBot.CommandSystem.Commands;
1515
using TS3AudioBot.CommandSystem.Text;
1616
using TS3AudioBot.Web.Api;
17-
using TS3Client.Helper;
17+
using TSLib.Helper;
1818

1919
namespace TS3AudioBot.CommandSystem
2020
{

TS3AudioBot/Config/ConfigStructs.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ public class ConfPassword : ConfigTable
294294
public ConfigValue<bool> Hashed { get; } = new ConfigValue<bool>("hashed", false);
295295
public ConfigValue<bool> AutoHash { get; } = new ConfigValue<bool>("autohash", false);
296296

297-
public TS3Client.Password Get()
297+
public TSLib.Password Get()
298298
{
299299
if (string.IsNullOrEmpty(Password))
300-
return TS3Client.Password.Empty;
300+
return TSLib.Password.Empty;
301301
var pass = Hashed
302-
? TS3Client.Password.FromHash(Password)
303-
: TS3Client.Password.FromPlain(Password);
302+
? TSLib.Password.FromHash(Password)
303+
: TSLib.Password.FromPlain(Password);
304304
if (AutoHash && !Hashed)
305305
{
306306
Password.Value = pass.HashedPassword;

TS3AudioBot/Config/Deprecated/ConfigFile.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using System.Linq;
1616
using System.Reflection;
1717
using TS3AudioBot.Localization;
18-
using TS3Client.Helper;
18+
using TSLib.Helper;
1919

2020
namespace TS3AudioBot.Config.Deprecated
2121
{

TS3AudioBot/Helper/Environment/SystemData.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using System.IO;
1414
using System.Reflection;
1515
using System.Text.RegularExpressions;
16-
using TS3Client.Helper;
16+
using TSLib.Helper;
1717
using PlatformVersion = System.ValueTuple<TS3AudioBot.Helper.Environment.Runtime, string, System.Version>;
1818

1919
namespace TS3AudioBot.Helper.Environment

0 commit comments

Comments
 (0)