public static void muteUnmuteRTP(bool state) { // Get the host address, username and port for the ServerQuery Login Dictionary <string, string> config = getTSInfo(); if (config == null) { return; } string sqPW = getSQPassword(); ushort port; uint talkPwr = (uint)(state ? 50 : 0); Regex regex = new Regex(@"^[0-9]+$"); if (regex.IsMatch(config["port"])) { port = Convert.ToUInt16(config["port"]); } else { string msg = "ERROR: Invalid port. Port number may contain numbers 1-9 only."; string cap = "Error"; errorMSG(msg, cap); return; } // Establish a connection with the TS3 server using (QueryRunner QR = new QueryRunner(new SyncTcpDispatcher(config["addr"], port))) { if (loginAndUse(QR, config, sqPW) != null) { SimpleResponse muteResponse = QR.EditChannel(CID_RTP, new ChannelModification() { NeededTalkPower = talkPwr }); if (muteResponse.IsErroneous) { string muteMsg = $"ERROR: {muteResponse.ErrorMessage}\n\n Error ID: {muteResponse.ErrorId}"; string muteCap = "Mute Channel Failed"; errorMSG(muteMsg, muteCap); } } } }
private const uint PID = 3; // Channel parent ID public static void moveSvParent(string region) { // Get the host address, username and port for the ServerQuery Login Dictionary <string, string> config = getTSInfo(); if (config == null) { return; } string sqPW = getSQPassword(); ushort port; Regex regex = new Regex(@"^[0-9]+$"); if (regex.IsMatch(config["port"])) { port = Convert.ToUInt16(config["port"]); } else { string msg = "ERROR: Invalid port. Port number may contain numbers 1-9 only."; string cap = "Error"; errorMSG(msg, cap); return; } // Establish a connection with the TS3 server using (QueryRunner QR = new QueryRunner(new SyncTcpDispatcher(config["addr"], port))) { if (loginAndUse(QR, config, sqPW) != null) { uint cid = 0; switch (region) { case "EU": cid = CID_EU; break; case "NA": cid = CID_NA; break; case "AU/NZ": cid = CID_AU; break; } SimpleResponse moveResponse = QR.EditChannel(cid, new ChannelModification() { ChannelOrder = CID_SUPPORT }); if (moveResponse.IsErroneous) { string moveMsg = $"ERROR: {moveResponse.ErrorMessage}\n\n Error ID: {moveResponse.ErrorId}"; string moveCap = "Channel Move Failed"; errorMSG(moveMsg, moveCap); } } } }