예제 #1
0
            internal int ReadHeapValues(IntPtr ip)
            {
                if (ip.ToInt32() != 0)
                {
                    int offset   = 0;
                    int int_size = Marshal.SizeOf(typeof(System.Int32));

                    // Getting PlayerInfo
                    Player.ReadHeapValues(ip);
                    offset = Marshal.SizeOf(typeof(TSRemote.TtsrPlayerInfo));

                    Channel.ReadHeapValues(new IntPtr(ip.ToInt32() + offset - 2));
                    offset += Marshal.SizeOf(typeof(TSRemote.TtsrChannelInfo));

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

                    return(0);
                }
                return(-1);
            }
예제 #2
0
        // gets Player Info by Name
        public static TtsrPlayerInfo GetPlayerInfo(string player_name)
        {
            int            nRetVal = 0;
            TtsrPlayerInfo pi      = new TtsrPlayerInfo();
            int            size    = Marshal.SizeOf(typeof(TtsrPlayerInfo));

            System.IntPtr p_player = Marshal.AllocHGlobal(size);

            nRetVal = tsrGetPlayerInfoByName(player_name, p_player);

            if (nRetVal == 0)
            {
                nRetVal = pi.ReadHeapValues(p_player);
            }

            Marshal.DestroyStructure(p_player, typeof(TtsrPlayerInfo));

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

            return(pi);
        }
예제 #3
0
        // gets Player Info by Name
        public static TtsrPlayerInfo GetPlayerInfo( string player_name )
        {
            int        nRetVal = 0;
            TtsrPlayerInfo pi  = new TtsrPlayerInfo();
            int        size    = Marshal.SizeOf( typeof( TtsrPlayerInfo ) );

            System.IntPtr p_player = Marshal.AllocHGlobal(size);

            nRetVal = tsrGetPlayerInfoByName( player_name, p_player );

            if ( nRetVal == 0 )
            {
                nRetVal = pi.ReadHeapValues( p_player );
            }

            Marshal.DestroyStructure( p_player, typeof( TtsrPlayerInfo ) );

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

            return pi;
        }