Jump to content
Spartans Home

Beta Version Up And Running


CoBoL~SPARTA~
 Share

Recommended Posts

The LCD panel project well on it's way.

 

Here's some pics

 

 

Just sat in TS channel

User posted image

 

 

 

 

 

 

 

 

 

 

When somebody speak a S pops at the side of there name for more than one user

User posted image

 

 

 

 

 

 

 

 

 

 

 

Just pop it on your desk in front of you keyboard and monitor

User posted image

 

 

 

 

 

 

 

 

Here a pic of back of unit, plugs direct in to USB, no external power required.

User posted image

 

 

 

 

 

 

 

And of course the boot screen

User posted image

 

 

 

 

 

 

Things to do, CPU usage, Core Temp, Ect usual stuff. But the screen is large enough for quite a bit of info on there.

 

And of course place unit in a nice box or something, any of you want one of these you can get from here ,working with guy to try get cheaper, will also work with smaller screen too. But some mods will have to be done with software.

 

Other adding are some arrow buttons, enter button, menu button. Will allow for more info screens, or change channel, kick a player, stuff like. Without leaving the game.

 

Viiiper may need you help on the button side of things. You can research me some nice buttons. think panel as up to 8 inputs, so that eight buttons.

 

Oh and i am looking for a name for the unit like TSBuddy(Temp) or something.

Link to comment
Share on other sites

Nice, that will do exactly as you all were talking about. Is it color? And then you have to build a case for it. Heres a sight that has the whole shbang

 

http://www.vartechsystems.com/products/nem...ls-monitors.asp

 

http://www.millertech.com/housed-lcds.htm

Edited by Athlon64~SPARTA~
Link to comment
Share on other sites

Here's class for reading channel info, user info, server info, from TS. You really only need this if your planning on comms with TS. In VB.NET

 

 

 

Imports System
Imports System.Diagnostics
Imports System.Runtime.InteropServices

Namespace TS
   '''' 
   '''' Provides a wrapper for the exported methods in TSRemote.dll.
   '''' Also provides the Classes and Flag enumerations for various
   '''' calls and returns from TSRemote.dll.
   '''' 
   Friend Class TSRemote
#Region "Public bitmasked types for use with TSRemote"

        _
       Public Enum Codecs
           cmCelp51 = 1
           cmCelp63 = 2
           cmGSM148 = 4
           cmGSM164 = 8
           cmWindowsCELP52 = 16
           SPEEX2150 = 32
           SPEEX3950 = 64
           SPEEX5950 = 128
           SPEEX8000 = 256
           SPEEX11000 = 512
           SPEEX15000 = 1024
           SPEEX18200 = 2048
           SPEEX24600 = 4096
       End Enum

       'PlayerChannelPrivileges
        _
       Public Enum ChannelPrivileges
           Admin = 1
           [Operator] = 2
           AutoOperator = 4
           Voiced = 8
           AutoVoice = 16
       End Enum

       'UserPrivileges
        _
       Public Enum UserPrivileges
           SuperServerAdmin = 1
           ServerAdmin = 2
           CanRegister = 4
           Registered = 8
           Unregistered = 16
       End Enum

       'player flags
        _
       Public Enum PlayerFlags
           ChannelCommander = 1
           WantVoice = 2
           NoWhisper = 4
           Away = 8
           InputMuted = 16
           OutputMuted = 32
           Recording = 64
       End Enum

       'channel flags
        _
       Public Enum ChannelFlags
           Registered = 1
           Unregistered = 2
           Moderated = 4
           Password = 8
           Hierarchical = 16
           [Default] = 32
       End Enum

       'ServerType Flags
        _
       Public Enum ServerType
           stClan = 1
           stPublic = 2
           stFreeware = 4
           stCommercial = 8
       End Enum

#End Region

#Region "Public Classes for use with TSRemote"

        _
       Public Class TtsrPlayerInfo
           Public PlayerID As Integer = 0
           Public ChannelID As Integer = 0
            _
           Public NickName As String = ""
           Public PlayerChannelPrivileges As Integer = 0
           Public PlayerPrivileges As Integer = 0
           Public PlayerFlags As Integer = 0

           Public Sub New()
               PlayerID = 0
               ChannelID = 0
               NickName = New String(Chr(0), 30)
               PlayerChannelPrivileges = 0
               PlayerPrivileges = 0
               PlayerFlags = 0
           End Sub

           Friend Function ReadHeapValues(ByVal ip As IntPtr) As Integer
               If ip.ToInt32()  0 Then
                   Dim offset As Integer = 0
                   Dim int_size As Integer = Marshal.SizeOf(GetType(Integer))
                   Dim str_size As Integer = 0

                   PlayerID = Marshal.ReadInt32(ip)

                   offset += int_size
                   ChannelID = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   str_size = NickName.Length
                   NickName = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   offset += str_size
                   PlayerChannelPrivileges = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   PlayerPrivileges = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   PlayerFlags = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   Return 0
               End If
               Return -1
           End Function
       End Class

        _
       Public Class TtsrChannelInfo
           Public ChannelID As Integer
           Public ChannelParentID As Integer
           Public PlayerCountInChannel As Integer
           Public ChannelFlags As Integer
           Public Codec As Integer
            _
           Public Name As String

           Public Sub New()
               ChannelID = 0
               ChannelParentID = 0
               PlayerCountInChannel = 0
               ChannelFlags = 0
               Codec = 0
               Name = New String(Chr(0), 30)
           End Sub

           Friend Function ReadHeapValues(ByVal ip As IntPtr) As Integer
               If ip.ToInt32()  0 Then
                   Dim offset As Integer = 0
                   Dim int_size As Integer = Marshal.SizeOf(GetType(Integer))

                   ChannelID = Marshal.ReadInt32(ip)
                   offset += int_size

                   ChannelParentID = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))
                   offset += int_size

                   PlayerCountInChannel = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))
                   offset += int_size

                   ChannelFlags = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))
                   offset += int_size

                   Codec = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))
                   offset += int_size

                   Name = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   Return 0
               End If
               Return -1
           End Function
       End Class

        _
       Public Class TtsrVersion
           Public Major As Integer = 0
           Public Minor As Integer = 0
           Public Release As Integer = 0
           Public Build As Integer = 0
       End Class

        _
       Public Class TtsrServerInfo
            _
           Public ServerName As String
            _
           Public WelcomeMessage As String
           Public ServerVMajor As Integer
           Public ServerVMinor As Integer
           Public ServerVRelease As Integer
           Public ServerVBuild As Integer
            _
           Public ServerPlatform As String
            _
           Public ServerIp As String
            _
           Public ServerHost As String
           Public ServerType As Integer
           Public ServerMaxUsers As Integer
           Public SupportedCodecs As Integer
           Public ChannelCount As Integer
           Public PlayerCount As Integer

           Public Sub New()
               ServerName = New String(Chr(0), 30)
               WelcomeMessage = New String(Chr(0), 256)
               ServerVMajor = 0
               ServerVMinor = 0
               ServerVRelease = 0
               ServerVBuild = 0
               ServerPlatform = New String(Chr(0), 30)
               ServerIp = New String(Chr(0), 30)
               ServerHost = New String(Chr(0), 100)
               ServerType = 0
               ServerMaxUsers = 0
               SupportedCodecs = 0
               ChannelCount = 0
               PlayerCount = 0
           End Sub

           Friend Function ReadHeapValues(ByVal ip As IntPtr) As Integer
               If ip.ToInt32()  0 Then
                   Dim offset As Integer = 0
                   Dim int_size As Integer = Marshal.SizeOf(offset)
                   Dim str_size As Integer = 0

                   str_size = ServerName.Length
                   ServerName = Marshal.PtrToStringAnsi(ip)

                   offset += str_size
                   str_size = WelcomeMessage.Length
                   WelcomeMessage = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   offset += str_size
                   ServerVMajor = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   ServerVMinor = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   ServerVRelease = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   ServerVBuild = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   str_size = ServerPlatform.Length
                   ServerPlatform = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   offset += str_size
                   str_size = ServerIp.Length
                   ServerIp = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   offset += str_size
                   str_size = ServerHost.Length
                   ServerHost = Marshal.PtrToStringAnsi(New IntPtr(ip.ToInt32() + offset))

                   offset += str_size
                   ServerType = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   ServerMaxUsers = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   SupportedCodecs = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   ChannelCount = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   offset += int_size
                   PlayerCount = Marshal.ReadInt32(New IntPtr(ip.ToInt32() + offset))

                   Return 0
               End If
               Return -1
           End Function
       End Class

        _
       Public Class TtsrUserInfo
           Public Player As TtsrPlayerInfo
           Public Channel As TtsrChannelInfo
           Public ParentChannel As TtsrChannelInfo

           Public Sub New()
               Player = New TtsrPlayerInfo()
               Channel = New TtsrChannelInfo()
               ParentChannel = New TtsrChannelInfo()
           End Sub

           Friend Function ReadHeapValues(ByVal ip As IntPtr) As Integer
               If ip.ToInt32()  0 Then
                   Dim offset As Integer = 0
                   Dim int_size As Integer = Marshal.SizeOf(GetType(Integer))

                   ' Getting PlayerInfo
                   Player.ReadHeapValues(ip)
                   offset = Marshal.SizeOf(GetType(TSRemote.TtsrPlayerInfo))

                   Channel.ReadHeapValues(New IntPtr(ip.ToInt32() + offset - 2))
                   offset += Marshal.SizeOf(GetType(TSRemote.TtsrChannelInfo))

                   ParentChannel.ReadHeapValues(New IntPtr(ip.ToInt32() + offset - 4))

                   Return 0
               End If
               Return -1
           End Function
       End Class


#End Region

#Region "TSRemote Imports"

       '		[ DllImport( "TSRemote.dll" ) ]
       '		private static extern void tsrGetLastError( [in, Out] string pchBuffer, [in, Out] int BufferLength );
        _
       Private Shared Sub tsrGetLastError(ByVal pchBuffer As IntPtr, ByVal BufferLength As Integer)
       End Sub

       '''' 
       '''' Connect the ts to a new server as described in the URL. Will disconnect
       '''' if the client is currently connected. The Url is the same format as the
       '''' normal starup link ("teamspeak://voice.teamspeak.org:9500" etc)
       '''' 
       '''' A pointer to a null terminated string containing the url for the server.
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrConnect(ByVal URL As String) As Integer
       End Function

       '''' 
       '''' Disconnects the client from the current server
       '''' 
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrDisconnect() As Integer
       End Function

       '''' 
       '''' Disconnect, Close and terminate the client
       '''' 
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrQuit() As Integer
       End Function

       '''' 
       '''' Switch to the channel with the name "Channelname"
       '''' Note that tsrSwitchChannelID is preferred.
       '''' 
       '''' Name of the channel to switch to
       '''' Password for the channel. May be null
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSwitchChannelName(ByVal ChannelName As String, ByVal ChannelPassword As String) As Integer
       End Function

       '''' 
       '''' Switch to the channel with the id "ChannelID"
       '''' 
       '''' ID of the channel to switch to
       '''' Password for the channel. May be null
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSwitchChannelID(ByVal ChannelID As Integer, ByVal ChannelPassword As String) As Integer
       End Function

       '''' 
       '''' Get the version of the TS Client
       '''' 
       '''' Pointer to a TtsrVersion record
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrVersion is filled with the client version
       '''' 
        _
       Private Shared Function tsrGetVersion( _
ByVal tsrVersion As TtsrVersion) As Integer
       End Function

       '''' 
       '''' Get the Info on the server (name, channelcount, playercount etc etc)
       '''' 
       '''' Pointer to a TtsrServerInfo record
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrServerInfo is filled with the server info
       '''' 
        _
       Private Shared Function tsrGetServerInfo(ByVal tsrServerInfo As IntPtr) As Integer
       End Function

       '''' 
       '''' Get the Info on the user (name, channel, flags etc etc)
       '''' 
       '''' Pointer to a TtsrUserInfo record
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrUserInfo is filled with the user info
       '''' 
        _
       Private Shared Function tsrGetUserInfo(ByVal tsrUserInfo As IntPtr) As Integer
       End Function

       '''' 
       '''' Get the Info on the channel specified by ChannelID and optionally also get the users from that channel
       '''' 
       '''' The ID of the channel you want the info from
       '''' pointer to a TtsrChannelInfo record
       ''''  This is the pointer to an array of TtsrPlayerInfo records. If it is NIL, no player records will be retrieved
       '''' Pointer to an integer. It must contain how many records tsrPlayerInfo has room for. (records, not bytes)
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrChannelInfo is filled with the channel info.
       '''' If tsrPlayerInfo was not NIL then the player records are
       '''' filled. PlayerRecords indicates how many records were filled
       '''' 
        _
       Private Shared Function tsrGetChannelInfoByID(ByVal ChannelID As Integer, ByVal tsrChannelInfo As IntPtr, ByVal tsrPlayerInfo As IntPtr, ByRef PlayerRecords As Integer) As Integer
       End Function

       '''' 
       '''' Get the Info on the channel specified by ChannelName and optionally also get the users from that channel
       '''' 
       '''' The Name of the channel you want the info from
       '''' pointer to a TtsrChannelInfo record
       ''''  This is the pointer to an array of TtsrPlayerInfo records. If it is NIL, no player records will be retrieved
       '''' Pointer to an integer. It must contain how many records tsrPlayerInfo has room for. (records, not bytes)
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrChannelInfo is filled with the channel info.
       '''' If tsrPlayerInfo was not NIL then the player records are
       '''' filled. PlayerRecords indicates how many records were filled
       '''' 
        _
       Private Shared Function tsrGetChannelInfoByName(ByVal ChannelName As String, ByVal tsrChannelInfo As IntPtr, ByVal tsrPlayerInfo As IntPtr, ByRef PlayerRecords As Integer) As Integer
       End Function

       '''' 
       '''' Get the Info on the player specified by PlayerID
       '''' 
       '''' The ID of the player you want the info from
       '''' This is the pointer to a TtsrPlayerInfo record
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrPlayerInfo is filled with the player info.
       '''' 
        _
       Private Shared Function tsrGetPlayerInfoByID(ByVal PlayerID As Integer, ByVal tsrPlayerInfo As IntPtr) As Integer
       End Function

       '''' 
       '''' Get the Info on the player specified by PlayerName
       '''' 
       '''' The Name of the player you want the info from
       '''' This is the pointer to a TtsrPlayerInfo record
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrPlayerInfo is filled with the player info.
       '''' 
        _
       Private Shared Function tsrGetPlayerInfoByName(ByVal PlayerName As String, ByVal tsrPlayerInfo As IntPtr) As Integer
       End Function

       '''' 
       '''' Get a list of the channels on the server
       '''' 
       '''' A pointer to an array of TtsrChannelInfo records
       '''' pointer to an integer which specifies how many TtsrChannelInfo records tsrChannels can hold.
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' If result = 0 then tsrChannels is filled with the channel info.
       '''' ChannelRecords will have the number or records that were filled.
       '''' 
        _
       Private Shared Function tsrGetChannels(ByVal tsrChannels As IntPtr, ByRef ChannelRecords As Integer) As Integer
       End Function

       '''' 
       '''' Get a list of the Players on the server
       '''' 
       '''' A pointer to an array of TtsrPlayerInfo records
       '''' pointer to an integer which specifies how many TtsrPlayerInfo records tsrPlayers can hold
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' PlayerRecords will have the number or records that were filled
       '''' 
        _
       Private Shared Function tsrGetPlayers(ByVal tsrPlayers As IntPtr, ByRef PlayerRecords As Integer) As Integer
       End Function

       '''' 
       '''' 
       '''' 
       '''' A pointer to an array of integers
       '''' pointer to an integer which specifies how many TtsrPlayerInfo records tsrPlayers can hold
       '''' 
       '''' Result: 0 = OK, else the error number
       '''' PlayerRecords will have the number or records that were filled
       '''' 
        _
       Private Shared Function tsrGetSpeakers(ByVal tsrPlayerIDs As Integer(), ByRef PlayerRecords As Integer) As Integer
       End Function

       '''' 
       '''' Set player flags of the user
       '''' 
       '''' An integer which has the bitmask for all the flags. All flags are set to this bitmask.
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSetPlayerFlags(ByVal tsrPlayerFlags As Integer) As Integer
       End Function

       '''' 
       '''' Set the reason you want voice on a channel
       '''' 
       '''' The reseason for voice
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSetWantVoiceReason(ByVal tsrReason As String) As Integer
       End Function

       '''' 
       '''' Grant or revoke Operator status
       '''' 
       '''' ID of the player to set the operator status for
       '''' Set to TSRemoteWrap.GRANT to grant or TSRemoteWrap.REVOKE to revoke the privilege
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSetOperator(ByVal PlayerID As Integer, ByVal GrantRevoke As Integer) As Integer
       End Function

       '''' 
       '''' Grant or revoke Voice status
       '''' 
       '''' ID of the player to set the Voice status for
       '''' Set to TSRemoteWrap.GRANT to grant or TSRemoteWrap.REVOKE to revoke the privilege
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSetVoice(ByVal PlayerID As Integer, ByVal GrantRevoke As Integer) As Integer
       End Function

       '''' 
       '''' Kick a player from the server
       '''' 
       '''' ID of the player to set the Voice status for
       '''' The reason why he was kicked
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrKickPlayerFromServer(ByVal PlayerID As Integer, ByVal Reason As String) As Integer
       End Function

       '''' 
       '''' Kick a player from the Channel
       '''' 
       '''' ID of the player to set the Voice status for
       '''' The reason why he was kicked
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrKickPlayerFromChannel(ByVal PlayerID As Integer, ByVal Reason As String) As Integer
       End Function

       '''' 
       '''' Send a text message to a channel
       '''' 
       '''' The ID of the channel you want to send the txt message to
       '''' The message you want to send
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSendTextMessageToChannel(ByVal ChannelID As Integer, ByVal Message As String) As Integer
       End Function

       '''' 
       '''' Send a text message to everyone
       '''' 
       '''' The message you want to send
       '''' Result: 0 = OK, else the error number
        _
       Private Shared Function tsrSendTextMessage(ByVal Message As String) As Integer
       End Function

#End Region

#Region "Public (static) TSRemote interface"

       '
       ' TODO: Add constructor logic here
       '
       Public Sub New()
       End Sub

       ' will attempt to open the TeamSpeak Client for you
       Public Shared Function Open() As Integer
           Dim proc As Process = Nothing
           Dim procs As Process() = Nothing

           Try
               procs = Process.GetProcessesByName("TeamSpeak")

               If procs.Length = 0 Then
                   Dim RegKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
                   Dim RegValue As Microsoft.Win32.RegistryKey = RegKey.OpenSubKey("teamspeak\Shell\Open\command")

                   Dim Value As String = DirectCast(RegValue.GetValue(""), String)

                   Value = Value.Replace("""%1""", "")
                   Value = Value.Trim()

                   proc = New Process()
                   proc.StartInfo.FileName = Value
                   proc.StartInfo.Verb = proc.StartInfo.Verbs(0)
                   proc.Start()
               Else
                   proc = procs(0)
               End If
               If proc Is Nothing Then
                   Throw New Exception("Unable to find or create process 'TeamSpeak'")
               End If
           Catch e As Exception
               Throw (e)
           End Try
           Return (IIf(proc Is Nothing, -1, 0))
       End Function

       Public Shared Function GetLastError() As String
           Dim error_str As New String(Chr(0), 256)
           Dim size As Integer = error_str.Length
           Dim p_strErr As System.IntPtr = Marshal.AllocHGlobal(size)

           tsrGetLastError(p_strErr, size)

           error_str = Marshal.PtrToStringAnsi(p_strErr)
           Marshal.FreeHGlobal(p_strErr)

           System.GC.Collect()

           Return error_str
       End Function

       ''' 
       ''' Connects to the TeamSpeak server specified in URL
       ''' 
       ''' 
       ''' URL Parts:
       ''' 1) teamspeak://
       ''' 2) www.serveraddress.com OR IP address
       ''' 3) : (a colon)
       ''' 4) port number
       ''' 5) ?nickname=and the nickname (if unregistered)
       ''' 6) ?loginname=and the login name (if registered)
       ''' 7) ?channelname=and the channel name
       ''' 7) ?password=and the password for the server/channel
       ''' 
       ''' Note that if you do not use a parameter, you should leave it off, as in the following:
       ''' teamspeak://192.168.1.150:8767?nickname=guest?loginname=admin?password=admin
       ''' 
       ''' 0 if successful otherwise non-zero, use GetLastError()
       Public Shared Function Connect(ByVal URL As String) As Integer
           Return tsrConnect(URL)
       End Function

       Public Shared Function Disconnect() As Integer
           Return tsrDisconnect()
       End Function

       Public Shared Function Quit() As Integer
           Return tsrQuit()
       End Function

       Public Shared Function SwitchChannels(ByVal channel_name As String, ByVal password As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSwitchChannelName(channel_name, password)

           Return nRetVal
       End Function

       Public Shared Function SwitchChannels(ByVal channel_id As Integer, ByVal password As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSwitchChannelID(channel_id, password)

           Return nRetVal
       End Function

       Public Shared ReadOnly Property ClientVersion() As TtsrVersion
           Get
               Dim nRetVal As Integer = 0
               Dim vi As New TtsrVersion()

               nRetVal = tsrGetVersion(vi)

               Return vi
           End Get
       End Property

       Public Shared ReadOnly Property ServerInfo() As TtsrServerInfo
           Get
               Dim nRetVal As Integer = 0
               Dim size As Integer = Marshal.SizeOf(GetType(TtsrServerInfo))

               Dim si As New TtsrServerInfo()

               Dim p_current As System.IntPtr = Marshal.AllocHGlobal(size)

               nRetVal = tsrGetServerInfo(p_current)

               If nRetVal = 0 Then
                   ' this is where you'll create a new object and copy the data over instead of
                   ' using this stupid array.
                   si.ReadHeapValues(p_current)

                   Marshal.DestroyStructure(p_current, GetType(TtsrServerInfo))
               End If

               ' Free the memory that was allocated on the heap, otherwise
               ' you will create a memory leak. 
               Marshal.FreeHGlobal(p_current)

               Return si
           End Get
       End Property

       Public Shared ReadOnly Property UserInfo() As TtsrUserInfo
           Get
               Dim nRetVal As Integer = 0
               Dim ui As New TtsrUserInfo()
               Dim size As Integer = Marshal.SizeOf(GetType(TtsrUserInfo))

               Dim p_current As System.IntPtr = Marshal.AllocHGlobal(size)

               nRetVal = tsrGetUserInfo(p_current)

               If nRetVal = 0 Then
                   nRetVal = ui.ReadHeapValues(p_current)
                   Marshal.DestroyStructure(p_current, GetType(TtsrUserInfo))
               End If

               ' Free the memory that was allocated on the heap, otherwise
               ' you will create a memory leak. 
               Marshal.FreeHGlobal(p_current)

               Return ui
           End Get
       End Property

       ' gets Channel Info and Players by ID
       Public Shared Function GetChannelInfo(ByVal channel_id As Integer, ByRef arr_pi As TtsrPlayerInfo()) As TtsrChannelInfo
           Const MAX_PLAYERS As Integer = 200
           Dim nRetVal As Integer = 0
           Dim records As Integer = MAX_PLAYERS
           Dim bGetPlayers As Boolean = False
           Dim ci As New TtsrChannelInfo()
           Dim pi As TtsrPlayerInfo() = New TtsrPlayerInfo(MAX_PLAYERS - 1) {}

           Dim ci_size As Integer = Marshal.SizeOf(GetType(TtsrChannelInfo))
           Dim pi_size As Integer = Marshal.SizeOf(GetType(TtsrPlayerInfo)) * MAX_PLAYERS

           Dim p_channel As System.IntPtr = Marshal.AllocHGlobal(ci_size)
           Dim p_player As System.IntPtr = Marshal.AllocHGlobal(pi_size)
           Dim p_current As System.IntPtr '= DirectCast(0, IntPtr)

           nRetVal = tsrGetChannelInfoByID(channel_id, p_channel, p_player, records)

           ' figure out if we are to get the player list too.
           If arr_pi IsNot Nothing Then
               bGetPlayers = True
           End If
           arr_pi = Nothing

           ' now process the items
           If nRetVal = 0 Then
               nRetVal = ci.ReadHeapValues(p_channel)
               Marshal.DestroyStructure(p_channel, GetType(TtsrChannelInfo))

               If nRetVal = 0 AndAlso bGetPlayers = True Then
                   ' build the new player array...
                   arr_pi = New TtsrPlayerInfo(records - 1) {}

                   ' keep track of our player pointer
                   p_current = p_player
                   For i As Integer = 0 To records - 1

                       arr_pi(i) = New TtsrPlayerInfo()

                       Marshal.PtrToStructure(p_current, arr_pi(i))
                       Marshal.DestroyStructure(p_current, GetType(TtsrPlayerInfo))

                       'p_current = DirectCast((CInt(p_current) + Marshal.SizeOf(GetType(TtsrPlayerInfo)) - 2), IntPtr)
                   Next
               End If
           End If

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_channel)
           Marshal.FreeHGlobal(p_player)

           Return ci
       End Function

       ' gets Channel Info by ID
       Public Shared Function GetChannelInfo(ByVal channel_id As Integer) As TtsrChannelInfo
           Dim nRetVal As Integer = 0
           Dim records As Integer = 0
           Dim ci As New TtsrChannelInfo()

           Dim ci_size As Integer = Marshal.SizeOf(GetType(TtsrChannelInfo))

           Dim p_channel As System.IntPtr = Marshal.AllocHGlobal(ci_size)

           nRetVal = tsrGetChannelInfoByID(channel_id, p_channel, 0, records) 'DirectCast(0, IntPtr)

           ' now process the items
           If nRetVal = 0 Then
               nRetVal = ci.ReadHeapValues(p_channel)
               Marshal.DestroyStructure(p_channel, GetType(TtsrChannelInfo))
           End If

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_channel)

           Return ci
       End Function

       ' gets Channel Info and Players by Name
       Public Shared Function GetChannelInfo(ByVal channel_name As String, ByRef arr_pi As TtsrPlayerInfo()) As TtsrChannelInfo
           Const MAX_PLAYERS As Integer = 200
           Dim nRetVal As Integer = 0
           Dim records As Integer = MAX_PLAYERS
           Dim bGetPlayers As Boolean = False
           Dim ci As New TtsrChannelInfo()
           Dim pi As TtsrPlayerInfo() = New TtsrPlayerInfo(MAX_PLAYERS - 1) {}

           Dim ci_size As Integer = Marshal.SizeOf(GetType(TtsrChannelInfo))
           Dim pi_size As Integer = Marshal.SizeOf(GetType(TtsrPlayerInfo)) * MAX_PLAYERS

           Dim p_channel As System.IntPtr = Marshal.AllocHGlobal(ci_size)
           Dim p_player As System.IntPtr = Marshal.AllocHGlobal(pi_size)
           Dim p_current As System.IntPtr = 0 'DirectCast(0, IntPtr)

           nRetVal = tsrGetChannelInfoByName(channel_name, p_channel, p_player, records)

           ' figure out if we are to get the player list too.
           If arr_pi IsNot Nothing Then
               bGetPlayers = True
           End If
           arr_pi = Nothing

           ' now process the items
           If nRetVal = 0 Then
               nRetVal = ci.ReadHeapValues(p_channel)
               Marshal.DestroyStructure(p_channel, GetType(TtsrChannelInfo))

               If nRetVal = 0 AndAlso bGetPlayers = True Then
                   ' build the new player array...
                   arr_pi = New TtsrPlayerInfo(records - 1) {}

                   ' keep track of our player pointer
                   p_current = p_player
                   For i As Integer = 0 To records - 1

                       arr_pi(i) = New TtsrPlayerInfo()

                       Marshal.PtrToStructure(p_current, arr_pi(i))
                       Marshal.DestroyStructure(p_current, GetType(TtsrPlayerInfo))

                       p_current = CInt(p_current) + Marshal.SizeOf(GetType(TtsrPlayerInfo)) - 2
                   Next
               End If
           End If

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_channel)
           Marshal.FreeHGlobal(p_player)

           Return ci
       End Function

       ' gets Channel Info by Name
       Public Shared Function GetChannelInfo(ByVal channel_name As String) As TtsrChannelInfo
           Dim nRetVal As Integer = 0
           Dim records As Integer = 0
           Dim ci As New TtsrChannelInfo()

           Dim ci_size As Integer = Marshal.SizeOf(GetType(TtsrChannelInfo))

           Dim p_channel As System.IntPtr = Marshal.AllocHGlobal(ci_size)

           nRetVal = tsrGetChannelInfoByName(channel_name, p_channel, 0, records) 'DirectCast(0, IntPtr)

           ' now process the items
           If nRetVal = 0 Then
               nRetVal = ci.ReadHeapValues(p_channel)
               Marshal.DestroyStructure(p_channel, GetType(TtsrChannelInfo))
           End If

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_channel)

           Return ci
       End Function

       ' gets Player Info by ID
       Public Shared Function GetPlayerInfo(ByVal player_id As Integer) As TtsrPlayerInfo
           Dim nRetVal As Integer = 0
           Dim pi As New TtsrPlayerInfo()
           Dim size As Integer = Marshal.SizeOf(GetType(TtsrPlayerInfo))

           Dim p_player As System.IntPtr = Marshal.AllocHGlobal(size)

           nRetVal = tsrGetPlayerInfoByID(player_id, p_player)

           If nRetVal = 0 Then
               nRetVal = pi.ReadHeapValues(p_player)
           End If

           Marshal.DestroyStructure(p_player, GetType(TtsrPlayerInfo))

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_player)

           Return pi
       End Function

       ' gets Player Info by Name
       Public Shared Function GetPlayerInfo(ByVal player_name As String) As TtsrPlayerInfo
           Dim nRetVal As Integer = 0
           Dim pi As New TtsrPlayerInfo()
           Dim size As Integer = Marshal.SizeOf(GetType(TtsrPlayerInfo))

           Dim p_player As System.IntPtr = Marshal.AllocHGlobal(size)

           nRetVal = tsrGetPlayerInfoByName(player_name, p_player)

           If nRetVal = 0 Then
               nRetVal = pi.ReadHeapValues(p_player)
           End If

           Marshal.DestroyStructure(p_player, GetType(TtsrPlayerInfo))

           ' Free the memory that was allocated on the heap, otherwise
           ' you will create a memory leak. 
           Marshal.FreeHGlobal(p_player)

           Return pi
       End Function

       Public Shared ReadOnly Property Channels() As TtsrChannelInfo()
           Get
               Dim size As Integer = 10
               Dim retval As Integer = 0

               Dim p_array As IntPtr
               Dim p_current As IntPtr

               Dim tci As New TtsrChannelInfo()

               p_array = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(TtsrChannelInfo)) * size)

               retval = tsrGetChannels(p_array, size)

               Dim channel As TtsrChannelInfo() = New TtsrChannelInfo(size - 1) {}

               p_current = p_array
               For i As Integer = 0 To size - 1

                   channel(i) = New TtsrChannelInfo()

                   ' this is where you'll create a new object and copy the data over instead of
                   ' using this stupid array.
                   Marshal.PtrToStructure(p_current, channel(i))
                   Marshal.DestroyStructure(p_current, GetType(TtsrChannelInfo))

                   p_current = CInt(p_current) + Marshal.SizeOf(GetType(TtsrChannelInfo)) - 2 'DirectCast((), IntPtr)
               Next
               Marshal.FreeHGlobal(p_array)

               System.GC.Collect()

               Return channel
           End Get
       End Property

       Public Shared ReadOnly Property Players() As TtsrPlayerInfo()
           Get
               Const MAX_PLAYERS As Integer = 200

               Dim records As Integer = MAX_PLAYERS

               Dim nRetVal As Integer = 0
               Dim arr_players As TtsrPlayerInfo()

               Dim size As Integer = Marshal.SizeOf(GetType(TtsrPlayerInfo)) * MAX_PLAYERS

               Dim p_player As System.IntPtr = Marshal.AllocHGlobal(size)
               Dim p_current As System.IntPtr

               nRetVal = tsrGetPlayers(p_player, records)

               If nRetVal = 0 Then
                   ' keep track of our player pointer
                   p_current = p_player

                   arr_players = New TtsrPlayerInfo(records - 1) {}
                   For i As Integer = 0 To records - 1

                       arr_players(i) = New TtsrPlayerInfo()

                       nRetVal = arr_players(i).ReadHeapValues(p_current)

                       Marshal.DestroyStructure(p_current, GetType(TtsrPlayerInfo))

                       p_current = CInt(p_current) + Marshal.SizeOf(GetType(TtsrPlayerInfo)) - 2 'DirectCast((), IntPtr)
                   Next
               Else
                   arr_players = New TtsrPlayerInfo(-1) {}
               End If


               ' Free the memory that was allocated on the heap, otherwise
               ' you will create a memory leak. 
               Marshal.FreeHGlobal(p_player)

               Return arr_players
           End Get
       End Property

       Public Shared ReadOnly Property SpeakerIds() As Integer()
           Get
               Const MAX_SPEAKERS As Integer = 200

               Dim speakers As Integer() = New Integer(MAX_SPEAKERS - 1) {}
               Dim arr_return As Integer() = Nothing
               Dim records As Integer = MAX_SPEAKERS
               Dim nRetVal As Integer = 0

               tsrGetSpeakers(speakers, records)

               If nRetVal = 0 Then
                   arr_return = New Integer(records - 1) {}
                   Array.Copy(speakers, arr_return, records)
               End If

               Return arr_return
           End Get
       End Property

       Public Shared Function SetPlayerFlags(ByVal flags As Integer) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSetPlayerFlags(flags)

           Return nRetVal
       End Function

       Public Shared Function SetWantVoiceReason(ByVal reason As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSetWantVoiceReason(reason)

           Return nRetVal
       End Function

       Public Shared Function SetOperator(ByVal player_id As Integer, ByVal revoke As Boolean) As Integer
           Dim nRetVal As Integer = 0
           Dim nGrantRevoke As Integer = 0 + (IIf(revoke = True, 0, 1))

           nRetVal = tsrSetOperator(player_id, nGrantRevoke)

           Return nRetVal
       End Function

       Public Shared Function SetVoice(ByVal player_id As Integer, ByVal revoke As Boolean) As Integer
           Dim nRetVal As Integer = 0
           Dim nGrantRevoke As Integer = 0 + (IIf(revoke = True, 0, 1))

           nRetVal = tsrSetVoice(player_id, nGrantRevoke)

           Return nRetVal
       End Function

       Public Shared Function KickPlayerFromServer(ByVal player_id As Integer, ByVal reason As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrKickPlayerFromServer(player_id, reason)

           Return nRetVal
       End Function

       Public Shared Function KickPlayerFromChannel(ByVal player_id As Integer, ByVal reason As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrKickPlayerFromChannel(player_id, reason)

           Return nRetVal
       End Function

       Public Shared Function SendTextToChannel(ByVal channel_id As Integer, ByVal message As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSendTextMessageToChannel(channel_id, message)

           Return nRetVal
       End Function
       Public Shared Function SendText(ByVal message As String) As Integer
           Dim nRetVal As Integer = 0

           nRetVal = tsrSendTextMessage(message)

           Return nRetVal
       End Function


#End Region

#Region "Public (static) BitMask to Array Converter"

       Public Shared Function CodecArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim codec_mask As Codecs = DirectCast(Value, Codecs)

           value_list = codec_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function
       Public Shared Function ChannelPrivilegesArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim cp_mask As ChannelPrivileges = DirectCast(Value, ChannelPrivileges)

           value_list = cp_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function
       Public Shared Function UserPrivilegesArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim up_mask As UserPrivileges = DirectCast(Value, UserPrivileges)

           value_list = up_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function
       Public Shared Function PlayerFlagsArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim pf_mask As PlayerFlags = DirectCast(Value, PlayerFlags)

           value_list = pf_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function
       Public Shared Function ChannelFlagsArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim cf_mask As ChannelFlags = DirectCast(Value, ChannelFlags)

           value_list = cf_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function
       Public Shared Function ServerTypeArray(ByVal Value As Integer) As String()
           Dim values As String()
           Dim value_list As String
           Dim st_mask As ServerType = DirectCast(Value, ServerType)

           value_list = st_mask.ToString("G")
           values = value_list.Split(","c)
           For i As Integer = 0 To values.Length - 1
               values(i) = values(i).Trim()
           Next


           Return values
       End Function

#End Region
   End Class
End Namespace

Link to comment
Share on other sites

Very cool bro. Any way to port it through USB to another PC?

 

Say TS is running on gaming machine. This is because the PTT button is on the gamepad and/or on PC 1's keyboard.

 

But I want to be able to see it on PC2's monitor.

 

Any way to do this through TSBuddy?

Link to comment
Share on other sites

Very cool bro. Any way to port it through USB to another PC?

 

Say TS is running on gaming machine. This is because the PTT button is on the gamepad and/or on PC 1's keyboard.

 

But I want to be able to see it on PC2's monitor.

 

Any way to do this through TSBuddy?

 

 

That's a pretty good idea, run TS on game machine, Send info via a USB link, or Network link. Onto another PC screen.

 

May take more than 5 mins to knock up, so I will take 6 instead. LOL

 

 

Let me see what I can do.

Link to comment
Share on other sites

very cool. You may have to write two progs to make it happen, one to transmit the data from PC1 and then a second on PC2 to recieve and display the data.

 

You would know better than me though. I wish I knew half as much as you know in programming.

 

Come on TS I will be on for a while tonight.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...