Example #1
0
 public void AllowQuery(bool enabled)
 {
     if (pointer != IntPtr.Zero)
     {
         RakPeer_Native.NET_AllowQuery(pointer, enabled);
     }
 }
Example #2
0
 public void SendToAddress(byte[] data, string target_address, ushort target_port)
 {
     if (pointer != IntPtr.Zero)
     {
         RakPeer_Native.NETSND_ToAddress(pointer, data, data.Length, target_address, target_port);
     }
 }
Example #3
0
 public void SetQueryResponce(byte[] data)
 {
     if (pointer != IntPtr.Zero)
     {
         RakPeer_Native.NET_SetQueryResponce(pointer, data);
     }
 }
Example #4
0
 public uint GetMaximumConnections()
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetMaximumConnections(pointer));
 }
Example #5
0
 public uint GetIndexFromGUID(ulong guid)
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetIndexFromGUID(pointer, guid));
 }
Example #6
0
 public ushort GetPort(ulong guid = 0)
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetPort(pointer, guid));
 }
Example #7
0
 public ushort NumberOfConnections()
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_NumberOfConnections(pointer));
 }
Example #8
0
 public bool IsBannedIP(string address)
 {
     if (pointer == IntPtr.Zero)
     {
         return(false);
     }
     return(RakPeer_Native.NET_IsBannedIP(pointer, address));
 }
Example #9
0
 public void RemoveBanIP(string address)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_RemoveBanIP(pointer, address);
 }
Example #10
0
 public void SetLimitIPConnectionFrequency(bool value)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_SetLimitIPConnectionFrequency(pointer, value);
 }
Example #11
0
 public ulong GetStatisticsTotal(uint index, RNSPerSecondMetrics metrics)
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetStatisticsTotal(pointer, index, metrics));
 }
Example #12
0
 public bool HasPassword()
 {
     if (pointer == IntPtr.Zero)
     {
         return(false);
     }
     return(RakPeer_Native.NET_HasPassword(pointer));
 }
Example #13
0
 public void SetPassword(string password)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_SetPassword(pointer, password);
 }
Example #14
0
 public void SetMaxConnections(ushort max_connections)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_SetMaxConnections(pointer, max_connections);
 }
Example #15
0
 public StartupResult Startup()
 {
     if (pointer == IntPtr.Zero)
     {
         return(StartupResult.FAILED_TO_CREATE_NETWORK_THREAD);
     }
     return(RakPeer_Native.NET_Startup(pointer));
 }
Example #16
0
 public void AddBanIP(string address, int seconds = 60)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_AddBanIP(pointer, address, seconds);
 }
Example #17
0
 public ulong GetGUIDFromIndex(uint index)
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetGUIDFromIndex(pointer, index));
 }
Example #18
0
 public int GetLowestPing(ulong guid = 0)
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_GetLowestPing(pointer, guid));
 }
Example #19
0
 public ulong GetMyGUID()
 {
     if (pointer == IntPtr.Zero)
     {
         return(0);
     }
     return(RakPeer_Native.NET_MyGUID(pointer));
 }
Example #20
0
 public void CloseConnection(ulong guid, bool send_disconnect_notification = true)
 {
     if (pointer == IntPtr.Zero)
     {
         return;
     }
     RakPeer_Native.NET_CloseConnection(pointer, guid, send_disconnect_notification);
 }
Example #21
0
 public byte SendToServer(BitStream stream, PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, PacketReliability reliability = PacketReliability.RELIABLE, byte channel = 0)
 {
     if (pointer != IntPtr.Zero && stream != null && stream.pointer != IntPtr.Zero)
     {
         return(RakPeer_Native.NETSND_ToServer(pointer, stream.pointer, priority, reliability, channel));
     }
     return(0);
 }
Example #22
0
    public void SetLimitBandwidth(uint bytesPerSecond)
    {
        if (Type != PeerType.Server || pointer == IntPtr.Zero)
        {
            return;
        }

        RakPeer_Native.NET_LimitBandwidth(pointer, bytesPerSecond * 8);
    }
Example #23
0
    public bool IsQueryAllowed()
    {
        if (pointer != IntPtr.Zero)
        {
            return(RakPeer_Native.NET_IsQueryAllowed(pointer));
        }

        return(false);
    }
Example #24
0
    public bool IsActive()
    {
        if (pointer == IntPtr.Zero)
        {
            return(false);
        }

        return(RakPeer_Native.NET_IsActive(pointer));
    }
Example #25
0
    public int ReceiveCount()
    {
        if (pointer == IntPtr.Zero)
        {
            return(0);
        }

        return(RakPeer_Native.NET_ReceiveCount(pointer));
    }
Example #26
0
    public void Destroy()
    {
        Shutdown();

        if (pointer != IntPtr.Zero)
        {
            RakPeer_Native.NET_Destroy(pointer);
        }
    }
Example #27
0
    public ConnectionState GetConnectionState(ulong guid)
    {
        if (pointer == IntPtr.Zero)
        {
            return(ConnectionState.IS_NOT_CONNECTED);
        }

        return(RakPeer_Native.NET_ConnectionState(pointer, guid));
    }
Example #28
0
    private bool is_shutteddown = false;//Damn knows what the mistake is, but I'm too lazy to fix it... (See Shutdown())

    public void Shutdown()
    {
        if (pointer == IntPtr.Zero || is_shutteddown)
        {
            return;
        }

        is_shutteddown = true;
        RakPeer_Native.NET_Shutdown(pointer);
    }
Example #29
0
    public bool GetStatisticsFull(uint index, out RakNetStatistics _statistics)
    {
        _statistics = new RakNetStatistics();

        if (pointer == IntPtr.Zero)
        {
            return(false);
        }

        return(RakPeer_Native.NET_Statistics(pointer, index, ref _statistics));
    }
Example #30
0
    public bool Ping(string address, ushort port, bool onlyReplyOnAcceptingConnections = false)
    {
        StartupResult result = Startup();

        if (result == StartupResult.RAKNET_STARTED || result == StartupResult.RAKNET_ALREADY_STARTED)
        {
            return(RakPeer_Native.NET_Ping(pointer, address, port, onlyReplyOnAcceptingConnections));
        }
        else
        {
            return(false);
        }
    }