public override void Connect(ConnectionData conData)
        {
            var conDataFull = conData as ConnectionDataFull;

            if (conDataFull == null)
            {
                throw new ArgumentException($"Use the {nameof(ConnectionDataFull)} deriverate to connect with the full client.", nameof(conData));
            }
            if (conDataFull.Identity == null)
            {
                throw new ArgumentNullException(nameof(conDataFull.Identity));
            }
            if (conDataFull.VersionSign == null)
            {
                throw new ArgumentNullException(nameof(conDataFull.VersionSign));
            }
            connectionDataFull = conDataFull;
            ConnectionData     = conData;

            Disconnect();

            lock (StatusLock)
            {
                returnCode = 0;
                wasExit    = false;

                VersionSign       = conDataFull.VersionSign;
                ts3Crypt.Identity = conDataFull.Identity;

                packetHandler.Connect(conData.Hostname, conData.Port);
                dispatcher.Init(NetworkLoop, InvokeEvent);
            }
            dispatcher.EnterEventLoop();
        }
Beispiel #2
0
 public CmdR ClientInit(string nickname, bool inputHardware, bool outputHardware,
                        string defaultChannel, string defaultChannelPassword, string serverPassword, string metaData,
                        string nicknamePhonetic, string defaultToken, string hwid, VersionSign versionSign)
 => SendNoResponsed(
     new Ts3Command("clientinit", new List <ICommandPart> {
     new CommandParameter("client_nickname", nickname),
     new CommandParameter("client_version", versionSign.Name),
     new CommandParameter("client_platform", versionSign.PlattformName),
     new CommandParameter("client_input_hardware", inputHardware),
     new CommandParameter("client_output_hardware", outputHardware),
     new CommandParameter("client_default_channel", defaultChannel),
     new CommandParameter("client_default_channel_password", defaultChannelPassword),            // base64(sha1(pass))
     new CommandParameter("client_server_password", serverPassword),                             // base64(sha1(pass))
     new CommandParameter("client_meta_data", metaData),
     new CommandParameter("client_version_sign", versionSign.Sign),
     new CommandParameter("client_key_offset", ts3Crypt.Identity.ValidKeyOffset),
     new CommandParameter("client_nickname_phonetic", nicknamePhonetic),
     new CommandParameter("client_default_token", defaultToken),
     new CommandParameter("hwid", hwid)
 }));
 public CmdR ClientInit(string nickname, bool inputHardware, bool outputHardware,
                        string defaultChannel, string defaultChannelPassword, string serverPassword, string metaData,
                        string nicknamePhonetic, string defaultToken, string hwid, VersionSign versionSign)
 => SendNoResponsed(new Ts3Command("clientinit")
 {
     { "client_nickname", nickname },
     { "client_version", versionSign.Name },
     { "client_platform", versionSign.PlatformName },
     { "client_input_hardware", inputHardware },
     { "client_output_hardware", outputHardware },
     { "client_default_channel", defaultChannel },
     { "client_default_channel_password", defaultChannelPassword },    // base64(sha1(pass))
     { "client_server_password", serverPassword },                     // base64(sha1(pass))
     { "client_meta_data", metaData },
     { "client_version_sign", versionSign.Sign },
     { "client_key_offset", Identity.ValidKeyOffset },
     { "client_nickname_phonetic", nicknamePhonetic },
     { "client_default_token", defaultToken },
     { "hwid", hwid },
 });