예제 #1
0
        static void _SendUnitData (){
            FT_UnitData data = new FT_UnitData();

            BitStream writeBitStream = new BitStream();
            writeBitStream.Write((byte)FT_MessageTypes.ID_SERVER_LOGIN);
            writeBitStream.Write((byte)FT_MessageTypesNode.NODE_FT_TEST1);
            data.Serialize(true, writeBitStream);
            client.Send(writeBitStream, (char)0);
        }
예제 #2
0
    void sendClientPing(RakNet.RakPeerInterface rakPeerInterface)
    {
        while (true)
        {
            //Use unity console instead.
            RakNet.BitStream bitStream;
            bitStream = new RakNet.BitStream();
            bitStream.Write((char)ENUMGAMEMESSAGES.ID_SERVER_TEXT_MESSAGE);
            bitStream.Write("Ping!");

            rakPeerInterface.Send(bitStream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0,
                                  RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
            Thread.Sleep(1000);
        }
    }
예제 #3
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int    callBackID = 0, playerID = 0;
            String section, entry;

            stream.Read(out callBackID);
            stream.Read(out playerID);
            stream.Read(out section);
            stream.Read(out entry);

            String value = "";

            try
            {
                value = zCOption.GetOption(Process.ThisProcess()).getEntryValue(section, entry);
            }
            catch (Exception ex) {}

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.ReadIniEntryMessage);
            stream.Write(callBackID);
            stream.Write(playerID);
            stream.Write(section);
            stream.Write(entry);
            stream.Write(value);

            Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
        }
예제 #4
0
    private void sendNewClientID(RakNet.RakPeerInterface rakPeerInterface, ref RakNet.SystemAddress address)
    {
        RakNet.BitStream bitstream;
        bitstream = new RakNet.BitStream();
        bitstream.Write(nextClientID);
        nextClientID++;

        rakPeerInterface.Send(bitstream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, address, false);
    }
예제 #5
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int    callBackID = 0, playerID = 0;
            String md5File;

            stream.Read(out callBackID);
            stream.Read(out playerID);
            stream.Read(out md5File);

            String value = "";

            try
            {
                md5File = Path.GetFullPath(md5File);
                String minName = new DirectoryInfo(StartupState.getSystemPath()).Parent.FullName;
                if (md5File.StartsWith(minName))
                {
                    if (File.Exists(md5File))
                    {
                        value = FileMd5(md5File);
                    }
                }
            }
            catch (Exception ex) {}

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.ReadMd5Message);
            stream.Write(callBackID);
            stream.Write(playerID);
            stream.Write(md5File);
            stream.Write(value);

            Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
        }
예제 #6
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int callBackID = 0, npcID = 0, vobID = 0;

            stream.Read(out callBackID);
            stream.Read(out npcID);
            stream.Read(out vobID);

            if (!sWorld.VobDict.ContainsKey(npcID) || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob or NPC weren't in the List!");
            }

            NPCProto proto = (NPCProto)sWorld.VobDict[npcID];
            Vob      vob   = (Vob)sWorld.VobDict[vobID];

            bool canSee = false;

            if (proto.Address != 0 && vob.Address == 0)
            {
                canSee = (new oCNpc(Process.ThisProcess(), proto.Address).CanSee(new zCVob(Process.ThisProcess(), vob.Address), 0) == 1) ? true : false;
            }

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.CallbackNPCCanSee);
            stream.Write(callBackID);
            stream.Write(proto.ID);
            stream.Write(vob.ID);
            stream.Write(canSee);

            Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
        }
예제 #7
0
    private void DoReceive()
    {
        Packet recvPkg = this.client.Receive();

        if (recvPkg == null)
        {
            return;
        }

        byte type = recvPkg.data[0];

        switch ((DefaultMessageIDTypes)type)
        {
        case DefaultMessageIDTypes.ID_DISCONNECTION_NOTIFICATION:
        case DefaultMessageIDTypes.ID_CONNECTION_LOST:
        case DefaultMessageIDTypes.ID_REMOTE_DISCONNECTION_NOTIFICATION:
        case DefaultMessageIDTypes.ID_REMOTE_CONNECTION_LOST:
            UnityEngine.Debug.Log("连接断开");
            break;

        case DefaultMessageIDTypes.ID_NEW_INCOMING_CONNECTION:
            UnityEngine.Debug.LogFormat("终端 {0} 连入", recvPkg.systemAddress.ToString(true));
            break;

        // 主动连接成功
        case DefaultMessageIDTypes.ID_CONNECTION_REQUEST_ACCEPTED:
            Log.WriteLine("连接成功");
            break;

        // 主动连接失败
        case DefaultMessageIDTypes.ID_CONNECTION_ATTEMPT_FAILED:
            Log.WriteLine("目标不可达");
            break;

        // raknet自定义事件类型
        case DefaultMessageIDTypes.ID_USER_PACKET_ENUM:
        {
            RakNet.BitStream reader = new RakNet.BitStream();
            reader.Write(recvPkg.data, recvPkg.length);
            reader.IgnoreBytes(1);

            string msg;
            reader.Read(out msg);

            Log.WriteLine(msg);

            Debug.LogFormat("response msg:{0}", msg);
        }
        break;
        }
    }
예제 #8
0
        protected override void updateActive(VirtualKey key)
        {
            if (key == VirtualKey.Up)
            {
                mList.ActiveID--;
            }
            if (key == VirtualKey.Down || key == VirtualKey.Return)
            {
                mList.ActiveID++;
            }

            if (key == VirtualKey.Up || key == VirtualKey.Down || key == VirtualKey.Return)
            {
                RakNet.BitStream stream = Program.client.sentBitStream;
                stream.Reset();
                stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                stream.Write((byte)NetworkID.GuiMessage);
                stream.Write((byte)GuiMessageType.GuiEvent);
                stream.Write(Player.Hero.ID);
                stream.Write(this.id);
                stream.Write((int)GUIEvents.ListTextBoxSend);
                stream.Write(mText);

                Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
                return;
            }


            if ((int)key == 8)
            {
                if (mText.Length == 0)
                {
                    return;
                }
                mText = mText.Substring(0, mText.Length - 1);
                mTextView.Text.Set(hardText + mText);
                return;
            }

            String keyVal = Convert.ToString((char)key);

            keyVal = Gothic.mClasses.textBox.GetCharsFromKeys((WinApi.User.Enumeration.VirtualKeys)key, InputHooked.IsPressed((int)VirtualKey.Shift), InputHooked.IsPressed((int)VirtualKey.Control) && InputHooked.IsPressed((int)VirtualKey.Menu));

            if (keyVal != "")
            {
                mText += keyVal;
                mTextView.Text.Add(keyVal);
            }
        }
예제 #9
0
        public void timerTick()
        {
            if (this.enabledEvents.HasFlag(GUIEvents.Hover))
            {
                if (this.position.X < Gothic.mClasses.Cursor.CursorX() && this.position.X + this.size.X > Gothic.mClasses.Cursor.CursorX() &&
                    this.position.Y < Gothic.mClasses.Cursor.CursorY() && this.position.Y + this.size.Y > Gothic.mClasses.Cursor.CursorY())
                {
                    if (!hover)
                    {
                        RakNet.BitStream stream = Program.client.sentBitStream;
                        stream.Reset();
                        stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                        stream.Write((byte)NetworkID.GuiMessage);
                        stream.Write((byte)GuiMessageType.GuiEvent);
                        stream.Write(Player.Hero.ID);
                        stream.Write(this.id);

                        stream.Write((int)GUIEvents.Hover);
                        stream.Write(true);

                        Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);

                        hover = true;
                    }
                }
                else
                {
                    if (hover)
                    {
                        RakNet.BitStream stream = Program.client.sentBitStream;
                        stream.Reset();
                        stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                        stream.Write((byte)NetworkID.GuiMessage);
                        stream.Write((byte)GuiMessageType.GuiEvent);
                        stream.Write(Player.Hero.ID);
                        stream.Write(this.id);

                        stream.Write((int)GUIEvents.Hover);
                        stream.Write(false);

                        Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);

                        hover = false;
                    }
                }
            }
        }
예제 #10
0
    public void Update()
    {
        if (this.server == null)
        {
            Debug.LogError("this.server = null");
            return;
        }

        Packet recvPkg = this.server.Receive();

        if (recvPkg == null)
        {
            return;
        }

        byte type = recvPkg.data[0];

        switch ((DefaultMessageIDTypes)type)
        {
        case DefaultMessageIDTypes.ID_DISCONNECTION_NOTIFICATION:
        case DefaultMessageIDTypes.ID_CONNECTION_LOST:
        case DefaultMessageIDTypes.ID_REMOTE_DISCONNECTION_NOTIFICATION:
        case DefaultMessageIDTypes.ID_REMOTE_CONNECTION_LOST:
            Log.WriteLine("连接断开");
            break;

        case DefaultMessageIDTypes.ID_NEW_INCOMING_CONNECTION:
            string str = string.Format("终端 {0} 连入", recvPkg.systemAddress.ToString(true));
            Log.WriteLine(str);
            break;

        // raknet自定义事件类型
        case DefaultMessageIDTypes.ID_USER_PACKET_ENUM:
        {
            // 回转
            RakNet.BitStream bs = new RakNet.BitStream();
            bs.Write(recvPkg.data, recvPkg.length);
            server.Send(bs, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, recvPkg.systemAddress, false);
        }
        break;
        }

        server.DeallocatePacket(recvPkg);
    }
예제 #11
0
        private void tbSended(object obj, EventArgs args)
        {
            RakNet.BitStream stream = Program.client.sentBitStream;
            stream.Reset();
            stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.GuiMessage);
            stream.Write((byte)GuiMessageType.TextBoxCallSend);

            stream.Write(Player.Hero.ID);
            stream.Write(this.id);

            stream.Write(tB.getText());

            Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);

            tB.setText("");
            this.tB.KeyDisable();
        }
예제 #12
0
        public void KeyPressed(int key)
        {
            if (key == (int)VirtualKey.LeftButton && this.enabledEvents.HasFlag(GUIEvents.LeftClicked) ||
                key == (int)VirtualKey.RightButton && this.enabledEvents.HasFlag(GUIEvents.RightClicked))
            {
                if (this.position.X < Gothic.mClasses.Cursor.CursorX() && this.position.X + this.size.X > Gothic.mClasses.Cursor.CursorX() &&
                    this.position.Y < Gothic.mClasses.Cursor.CursorY() && this.position.Y + this.size.Y > Gothic.mClasses.Cursor.CursorY())
                {
                    RakNet.BitStream stream = Program.client.sentBitStream;
                    stream.Reset();
                    stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                    stream.Write((byte)NetworkID.GuiMessage);
                    stream.Write((byte)GuiMessageType.GuiEvent);
                    stream.Write(Player.Hero.ID);
                    stream.Write(this.id);


                    int evt = (key == (int)VirtualKey.LeftButton) ? (int)GUIEvents.LeftClicked : (int)GUIEvents.RightClicked;
                    stream.Write(evt);

                    Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
                }
            }
        }
예제 #13
0
        protected override void updateActive(VirtualKey key)
        {
            base.updateActive(key);

            if (key == VirtualKey.Return)
            {
                //ButtonPressed(this, new ButtonPressedEventArg() { Key = key, Data = this, list = this.mList });


                RakNet.BitStream stream = Program.client.sentBitStream;
                stream.Reset();
                stream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                stream.Write((byte)NetworkID.GuiMessage);
                stream.Write((byte)GuiMessageType.GuiEvent);
                stream.Write(Player.Hero.ID);
                stream.Write(this.id);


                //int evt = (key == (int)VirtualKeys.LeftButton) ? (int)GUIEvents.LeftClicked : (int)GUIEvents.RightClicked;
                stream.Write((int)GUIEvents.ListButtonClicked);

                Program.client.client.Send(stream, PacketPriority.IMMEDIATE_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
            }
        }
예제 #14
0
        public void Write(Player player)
        {
            RakNet.BitStream stream = Program.server.SendBitStream;
            stream.Reset();

            //stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            //stream.Write((byte)NetworkIDS.ConnectionMessage);

            //Writing Player-Informations:
            //stream.Write(player.ID);


            stream.Write(Player.EnableStatusMenu);
            stream.Write(Player.EnableLogMenu);



            stream.Write(Player.sSendAllKeys);
            stream.Write(Player.sSendKeys.Count);
            foreach (byte k in Player.sSendKeys)
            {
                stream.Write(k);
            }


            stream.Write(sWorld.Day);
            stream.Write(sWorld.Hour);
            stream.Write(sWorld.Minute);

            stream.Write(sWorld.WeatherType);
            stream.Write(sWorld.StartRainHour);
            stream.Write(sWorld.StartRainMinute);
            stream.Write(sWorld.EndRainHour);
            stream.Write(sWorld.EndRainMinute);


            //Writing Spells:
            stream.Write((short)Spell.SpellList.Count);
            foreach (Spell spell in Spell.SpellList)
            {
                spell.Write(stream);
            }

            //Writing created item instances:
            stream.Write((short)ItemInstance.ItemInstanceList.Count);
            foreach (ItemInstance ii in ItemInstance.ItemInstanceList)
            {
                ii.Write(stream);
            }

            //ItemList:
            stream.Write(sWorld.ItemList.Count);
            foreach (Item item in sWorld.ItemList)
            {
                item.Write(stream);
            }

            //VobList:
            stream.Write(sWorld.VobList.Count);
            foreach (Vob vob in sWorld.VobList)
            {
                stream.Write((int)vob.VobType);
                vob.Write(stream);
            }

            //NPCList:
            stream.Write(sWorld.NpcList.Count);
            foreach (NPCProto proto in sWorld.NpcList)
            {
                proto.Write(stream);
            }
            //PlayerList:
            stream.Write(sWorld.PlayerList.Count);
            foreach (NPCProto proto in sWorld.PlayerList)
            {
                proto.Write(stream);
            }

            //World-SpawnList:
            stream.Write(sWorld.WorldDict.Count);
            foreach (KeyValuePair <String, World> worldPair in sWorld.WorldDict)
            {
                worldPair.Value.Write(stream);
            }

            //System.IO.File.WriteAllBytes("test.stream", stream.GetData());

            using (BitStream stream2 = new BitStream())
            {
                stream2.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
                stream2.Write((byte)NetworkID.ConnectionMessage);

                //Writing Player-Informations:
                stream2.Write(player.ID);
                GUC.Types.Zip.Compress(stream, 0, stream2);


                using (RakNetGUID guid = player.GUID)
                    Program.server.ServerInterface.Send(stream2, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, guid, false);
            }
        }
예제 #15
0
파일: TestMain.cs 프로젝트: 0521guo/RakNet
        static void Main(string[] args)
        {
            if (!File.Exists("RakNet.dll"))
            {
                Console.WriteLine("The SWIG build of the DLL has not been copied to the executable directory\nCopy from Swig/SwigWindowsCSharpSample/SwigTestApp/bin/X86/Debug/RakNet.dll to\nSwigWindowsCSharpSample/SwigTestApp/bin/Debug/RakNet.dll\nPress enter to quit.");
                Console.Read();
                return;
            }

            try
            {
                RakString dllCallTest = new RakString();
            }
            catch (Exception e)
            {
                Console.WriteLine("DLL issue\nAdd SwigOutput/CplusDLLIncludes/RakNetWrap.cxx to the project\nDLL_Swig/RakNet.sln and rebuild.\nPress enter to quit.");
                Console.Read();
                return;
            }

            Packet testPacket;
            int loopNumber;
            BitStream stringTestSendBitStream = new BitStream();
            BitStream rakStringTestSendBitStream = new BitStream();
            BitStream receiveBitStream = new BitStream();
            String holdingString;
            TimeSpan startTimeSpan;
            RakString rakStringTest = new RakString();

            RakPeerInterface testClient = RakPeer.GetInstance();
            
            testClient.Startup(1, new SocketDescriptor(60000, "127.0.0.1"), 1);

            RakPeerInterface testServer = RakPeer.GetInstance();
            testServer.Startup(1, new SocketDescriptor(60001, "127.0.0.1"), 1);
            testServer.SetMaximumIncomingConnections(1);

            Console.WriteLine("Send and receive loop using BitStream.\nBitStream read done into RakString");

            testClient.Connect("127.0.0.1", 60001, "", 0);

            String sendString = "The test string";
            stringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stringTestSendBitStream.Write(sendString);

            RakString testRakString = new RakString("Test RakString");
            rakStringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            rakStringTestSendBitStream.Write(testRakString);

            startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            loopNumber = 0;

            while (startTimeSpan.TotalSeconds + 5 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
            {
                testPacket = testServer.Receive();
                if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                {
                    receiveBitStream.Reset();
                    receiveBitStream.Write(testPacket.data, testPacket.length);
                    receiveBitStream.IgnoreBytes(1);
                    receiveBitStream.Read(rakStringTest);
                    Console.WriteLine("Loop number: " + loopNumber + "\nData: " + rakStringTest.C_String());
                }
                testServer.DeallocatePacket(testPacket);
                loopNumber++;
                System.Threading.Thread.Sleep(50);
                testClient.Send(rakStringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
            }

            Console.WriteLine("String send and receive loop using BitStream.\nBitStream read done into String");

            SystemAddress[] remoteSystems;
            ushort numberOfSystems=1;
            testServer.GetConnectionList(out remoteSystems, ref numberOfSystems);

            startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            loopNumber = 0;
            while (startTimeSpan.TotalSeconds + 5 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
            {
                testPacket = testServer.Receive();
                if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                {
                    receiveBitStream.Reset();
                    receiveBitStream.Write(testPacket.data, testPacket.length);
                    receiveBitStream.IgnoreBytes(1);
                    receiveBitStream.Read(out holdingString);
                    Console.WriteLine("Loop number: " + loopNumber + "\nData: " + holdingString);
                }
                testServer.DeallocatePacket(testPacket);
                loopNumber++;
                System.Threading.Thread.Sleep(50);
                SystemAddress sa = RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS;
                testClient.Send(stringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
            }
            //If RakString is not freed before program exit it will crash
            rakStringTest.Dispose();
            testRakString.Dispose();

            RakPeer.DestroyInstance(testClient);
            RakPeer.DestroyInstance(testServer);
            Console.WriteLine("Demo complete. Press Enter.");
            Console.Read();
        }
예제 #16
0
        static void Main(string[] args)
        {
            Packet testPacket;
            int loopNumber;
            BitStream stringTestSendBitStream = new BitStream();
            BitStream rakStringTestSendBitStream = new BitStream();
            BitStream receiveBitStream = new BitStream();
            String holdingString;
            TimeSpan startTimeSpan;
            RakString rakStringTest = new RakString();

            RakPeerInterface testClient = RakPeer.GetInstance();

            testClient.Startup(1, new SocketDescriptor(60000, "127.0.0.1"), 1);

            RakPeerInterface testServer = RakPeer.GetInstance();
            testServer.Startup(1, new SocketDescriptor(60001, "127.0.0.1"), 1);
            testServer.SetMaximumIncomingConnections(1);

            Console.WriteLine("Press enter to start RakString send and receive loop using BitStream.\nBitStream read done into RakString");
            Console.WriteLine("Loop will run for 15 seconds");
            Console.ReadLine();

            testClient.Connect("127.0.0.1", 60001, "", 0);

            String sendString = "The test string";
            stringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stringTestSendBitStream.Write(sendString);

            RakString testRakString = new RakString("Test RakString");
            rakStringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            rakStringTestSendBitStream.Write(testRakString);

            startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            loopNumber = 0;

            while (startTimeSpan.TotalSeconds + 15 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
            {
                testPacket = testServer.Receive();
                if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                {
                    receiveBitStream.Reset();
                    receiveBitStream.Write(testPacket.data, testPacket.length);
                    receiveBitStream.IgnoreBytes(1);
                    receiveBitStream.Read(rakStringTest);
                    Console.WriteLine("Loop number: " + loopNumber + "\nData: " + rakStringTest.C_String());
                }
                testServer.DeallocatePacket(testPacket);
                loopNumber++;
                System.Threading.Thread.Sleep(50);
                testClient.Send(rakStringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
            }

            Console.WriteLine("Press enter to start String send and receive loop using BitStream.\nBitStream read done into String");
            Console.WriteLine("Loop will run for 15 seconds");
            Console.ReadLine();

            startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            loopNumber = 0;
            while (startTimeSpan.TotalSeconds + 15 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
            {
                testPacket = testServer.Receive();
                if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                {
                    receiveBitStream.Reset();
                    receiveBitStream.Write(testPacket.data, testPacket.length);
                    receiveBitStream.IgnoreBytes(1);
                    receiveBitStream.Read(out holdingString);
                    Console.WriteLine("Loop number: " + loopNumber + "\nData: " + holdingString);
                }
                testServer.DeallocatePacket(testPacket);
                loopNumber++;
                System.Threading.Thread.Sleep(50);
                testClient.Send(stringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
            }
            //If RakString is not freed before program exit it will crash
            rakStringTest.Dispose();
            testRakString.Dispose();

            RakPeer.DestroyInstance(testClient);
            RakPeer.DestroyInstance(testServer);
            Console.WriteLine("Demo complete. Press Enter.");
            Console.Read();
        }
예제 #17
0
        static void ProcessMessage(RakPeerInterface peer, RakNet.Packet packet)
        {
            if (packet != null)
            {
                if (packet.data[0] == (byte)(FT_MessageTypes.ID_SERVER_LOGIN))
                {
                    BitStream receiveBitStream = new BitStream();
                    receiveBitStream.Write(packet.data, packet.length);
                    receiveBitStream.IgnoreBytes(2);
                    FT_UnitData data = new FT_UnitData();
                    data.Serialize(false, receiveBitStream);
                    Log.Debug(" data.nGrid_x: " + data.nGrid_x);

                    BitStream writeBitStream = new BitStream();
                    writeBitStream.Write((byte)FT_MessageTypes.ID_SERVER_LOGIN);
                    writeBitStream.Write((byte)FT_MessageTypesNode.NODE_FT_TEST1);
                    data.Serialize(true, writeBitStream);
                    uint sendLength = peer.Send(writeBitStream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, packet.systemAddress, false);
                    Log.Debug("SendLength = " + sendLength);
                }
            }
        }
예제 #18
0
    // Use this for initialization
    void Start()
    {
        try
        {
            RakString dllCallTest = new RakString();
        }
        catch (Exception e)
        {
            Debug.Log("DLL issue\nAdd SwigOutput/CplusDLLIncludes/RakNetWrap.cxx to the project\nDLL_Swig/RakNet.sln and rebuild.\nPress enter to quit.");
            return;
        }

        Packet testPacket;
        int    loopNumber;

        RakNet.BitStream stringTestSendBitStream    = new RakNet.BitStream();
        RakNet.BitStream rakStringTestSendBitStream = new RakNet.BitStream();
        RakNet.BitStream receiveBitStream           = new RakNet.BitStream();
        String           holdingString;
        TimeSpan         startTimeSpan;
        RakString        rakStringTest = new RakString();

        RakPeerInterface testClient = RakPeer.GetInstance();

        testClient.Startup(1, new SocketDescriptor(60000, "127.0.0.1"), 1);

        RakPeerInterface testServer = RakPeer.GetInstance();

        testServer.Startup(1, new SocketDescriptor(60001, "127.0.0.1"), 1);
        testServer.SetMaximumIncomingConnections(1);

        Console.WriteLine("Send and receive loop using BitStream.\nBitStream read done into RakString");

        testClient.Connect("127.0.0.1", 60001, "", 0);

        String sendString = "The test string";

        stringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
        stringTestSendBitStream.Write(sendString);

        RakString testRakString = new RakString("Test RakString");

        rakStringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
        rakStringTestSendBitStream.Write(testRakString);

        startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
        loopNumber    = 0;

        while (startTimeSpan.TotalSeconds + 5 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
        {
            testPacket = testServer.Receive();
            if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
            {
                receiveBitStream.Reset();
                receiveBitStream.Write(testPacket.data, testPacket.length);
                receiveBitStream.IgnoreBytes(1);
                receiveBitStream.Read(rakStringTest);
                Debug.Log("Loop number: " + loopNumber + "\nData: " + rakStringTest.C_String());
            }
            testServer.DeallocatePacket(testPacket);
            loopNumber++;
            System.Threading.Thread.Sleep(50);
            testClient.Send(rakStringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
        }

        Debug.Log("String send and receive loop using BitStream.\nBitStream read done into String");

        SystemAddress[] remoteSystems;
        ushort          numberOfSystems = 1;

        testServer.GetConnectionList(out remoteSystems, ref numberOfSystems);

        startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
        loopNumber    = 0;
        while (startTimeSpan.TotalSeconds + 5 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
        {
            testPacket = testServer.Receive();
            if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
            {
                receiveBitStream.Reset();
                receiveBitStream.Write(testPacket.data, testPacket.length);
                receiveBitStream.IgnoreBytes(1);
                receiveBitStream.Read(out holdingString);
                Debug.Log("Loop number: " + loopNumber + "\nData: " + holdingString);
            }
            testServer.DeallocatePacket(testPacket);
            loopNumber++;
            System.Threading.Thread.Sleep(50);
            SystemAddress sa = RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS;
            testClient.Send(stringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
        }
        //If RakString is not freed before program exit it will crash
        rakStringTest.Dispose();
        testRakString.Dispose();

        RakPeer.DestroyInstance(testClient);
        RakPeer.DestroyInstance(testServer);
        Debug.Log("Demo complete. Press Enter.");
    }
예제 #19
0
파일: TestMain.cs 프로젝트: 0521guo/RakNet
        static void Main(string[] args)
        {

           if(!File.Exists("RakNet.dll"))
           {
                Console.WriteLine("Error: The SWIG build of the DLL has not been copied to the executable directory.\nPress enter.");
                Console.Read();
                return;
           }
            
            Packet testPacket;
            int loopNumber;
            BitStream stringTestSendBitStream = new BitStream();
            BitStream rakStringTestSendBitStream = new BitStream();
            BitStream receiveBitStream = new BitStream();
            String holdingString;
            TimeSpan startTimeSpan;
            RakString rakStringTest = new RakString();

            RakPeerInterface testClient = RakPeer.GetInstance();
            testClient.Startup(1, new SocketDescriptor(60000, "127.0.0.1"), 1);

            RakPeerInterface testServer = RakPeer.GetInstance();
            testServer.Startup(1, new SocketDescriptor(60001, "127.0.0.1"), 1);
            testServer.SetMaximumIncomingConnections(1);

            Console.WriteLine("Press enter to start RakString send and receive loop using BitStream.\nBitStream read done into RakString");
            Console.WriteLine("Loop will run for 15 seconds");
            Console.ReadLine();

            testClient.Connect("127.0.0.1", 60001, "", 0);

            String sendString = "The test string";
            stringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stringTestSendBitStream.Write(sendString);

            RakString testRakString = new RakString("Test RakString");
            rakStringTestSendBitStream.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            rakStringTestSendBitStream.Write(testRakString);

            startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            loopNumber = 0;
                while (startTimeSpan.TotalSeconds + 15 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
                {
                    testPacket = testServer.Receive();
                    if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                    {
                        receiveBitStream.Reset();
                        receiveBitStream.Write(testPacket.data, testPacket.length);
                        receiveBitStream.IgnoreBytes(1);
                        receiveBitStream.Read(rakStringTest);
                        Console.WriteLine("Loop number: " + loopNumber + "\nData: " + rakStringTest.C_String());
                    }
                    testServer.DeallocatePacket(testPacket);
                    loopNumber++;
                    System.Threading.Thread.Sleep(50);
                    testClient.Send(rakStringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
                }

                Console.WriteLine("Press enter to start String send and receive loop using BitStream.\nBitStream read done into String");
                Console.WriteLine("Loop will run for 15 seconds");
                Console.ReadLine();

                startTimeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1));
                loopNumber = 0;
                while (startTimeSpan.TotalSeconds + 15 > (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)
                {
                    testPacket = testServer.Receive();
                    if (testPacket != null && testPacket.data[0] == (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
                    {
                        receiveBitStream.Reset();
                        receiveBitStream.Write(testPacket.data, testPacket.length);
                        receiveBitStream.IgnoreBytes(1);
                        receiveBitStream.Read(out holdingString);
                        Console.WriteLine("Loop number: " + loopNumber + "\nData: " + holdingString);
                    }
                    testServer.DeallocatePacket(testPacket);
                    loopNumber++;
                    System.Threading.Thread.Sleep(50);
                    testClient.Send(stringTestSendBitStream, PacketPriority.LOW_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(new SystemAddress("127.0.0.1", 60001)), false);
                }
            //-----------------------------Above is the same as the public tests, below the internal tests are ran.
            /*Member variables are also tested to assure working typemaps
             * Also variables use functions as well, they are not direct access
             * act like it. Test write and read on these items, especially arrays.
             * Most tests in this section are simple running functions with no verification.
             * 
             * 
            */

            RakString workingRakStringCopy;//This is needed for temp RakString Instances in the main function so dispose can be called

            //RakNetStatistics
            Console.WriteLine("RakNetStatistics");
            string rakNetStatisticsTestString;
            RakNetStatistics testRakNetStatistics = new RakNetStatistics();
            testRakNetStatistics.bytesInSendBuffer[0] = 22.44;
            testRakNetStatistics.BPSLimitByCongestionControl = 9;
            testRakNetStatistics.BPSLimitByOutgoingBandwidthLimit = 9;
            testRakNetStatistics.connectionStartTime = 9;
            testRakNetStatistics.isLimitedByCongestionControl = false;
            testRakNetStatistics.isLimitedByOutgoingBandwidthLimit = true;
            testRakNetStatistics.messageInSendBuffer[0] = 112;
            testRakNetStatistics.messagesInResendBuffer = 9;
            testRakNetStatistics.packetlossLastSecond = 4.3f;
            testRakNetStatistics.packetlossTotal = 9.9f;
            testRakNetStatistics.runningTotal[0] = 121;
            testRakNetStatistics.valueOverLastSecond[0] = 112;

            Console.WriteLine(testRakNetStatistics.bytesInSendBuffer[0]);
            Console.WriteLine(testRakNetStatistics.BPSLimitByCongestionControl);
            Console.WriteLine(testRakNetStatistics.BPSLimitByOutgoingBandwidthLimit);
            Console.WriteLine(testRakNetStatistics.connectionStartTime);
            Console.WriteLine(testRakNetStatistics.isLimitedByCongestionControl);
            Console.WriteLine(testRakNetStatistics.isLimitedByOutgoingBandwidthLimit);
            Console.WriteLine(testRakNetStatistics.messageInSendBuffer[0]);
            Console.WriteLine(testRakNetStatistics.messagesInResendBuffer);
            Console.WriteLine(testRakNetStatistics.packetlossLastSecond);
            Console.WriteLine(testRakNetStatistics.packetlossTotal);
            Console.WriteLine(testRakNetStatistics.runningTotal[0]);
            Console.WriteLine(testRakNetStatistics.valueOverLastSecond[0]);

            RakNet.RakNet.StatisticsToString(testRakNetStatistics, out rakNetStatisticsTestString, 1);
            Console.WriteLine(rakNetStatisticsTestString);

            //SystemAddress
            Console.WriteLine("SystemAddress");
            SystemAddress testSystemAddress = new SystemAddress("127.0.0.1", 60001);

            //RakNetGUID
            RakNetGUID testRakNetGUID = testClient.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);

            Console.WriteLine(testRakNetGUID);

            //AddressOrGUID
            Console.WriteLine("AddressOrGUID");
            AddressOrGUID testAddressOrGUIDAddress = new AddressOrGUID(testSystemAddress);

            Console.WriteLine(testAddressOrGUIDAddress.systemAddress);

            AddressOrGUID testAddressOrGUIDRakNetGUID = new AddressOrGUID(testRakNetGUID);

            Console.WriteLine(testAddressOrGUIDRakNetGUID.rakNetGuid);

            //BitStream
            Console.WriteLine("BitStream");
            BitStream testBitStream1 = new BitStream();
            BitStream testBitStream2 = new BitStream();
            byte[] testBuffer = new byte[999];
            byte[] writeArray = new byte[99];
            Packet bitStreamTestPacket = null;

            testBitStream1.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            testBitStream1.ResetWritePointer();
            testBitStream1.Write((byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM);

            writeArray[0] = (byte)127;
            testBitStream1.Write("xy");
            testBitStream1.WriteCompressed("xy");
            testBitStream1.WriteFloat16(23.5f, 0, 100);
            testBitStream1.WriteBits(writeArray, 7);
            testBitStream1.WriteAlignedBytesSafe(writeArray, 1, 1);
            testBitStream1.WriteAlignedBytes(writeArray, 1);
            testBitStream1.Write0();
            testBitStream1.Write1();
            int intForSerialization = 99;
            testBitStream1.Serialize(true, ref intForSerialization);

            testClient.Send(testBitStream1, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), true);

            while (bitStreamTestPacket == null || bitStreamTestPacket.data[0] != (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
            {
                if (bitStreamTestPacket != null)
                {
                    testServer.DeallocatePacket(bitStreamTestPacket);
                }
                bitStreamTestPacket = testServer.Receive();
                testClient.Send(testBitStream1, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), true);
            }

            testBitStream2.Reset();
            testBitStream2 = new BitStream(bitStreamTestPacket.data, bitStreamTestPacket.length, true);

            testBitStream2.IgnoreBytes(1);
            testBitStream2.ResetReadPointer();
            testBitStream2.IgnoreBits(8);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadBits(testBuffer, 8);
            Console.WriteLine(testBuffer[0]);
            Console.WriteLine(DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar8(testBuffer);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar16(testBuffer);
            Console.WriteLine(testBuffer[1]);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar32(testBuffer);
            Console.WriteLine(testBuffer[1]);
            testBitStream2.ResetReadPointer();
            testBitStream2.IgnoreBits(8);

            Console.WriteLine("testBitStream1 hex and bits");
            testBitStream1.PrintHex();
            Console.WriteLine("\n");
            testBitStream1.PrintBits();
            Console.WriteLine("\ntestBitStream1 hex and bits");

            Console.WriteLine("testBitStream2 hex and bits end");
            testBitStream2.PrintHex();
            Console.WriteLine("\n");
            testBitStream2.PrintBits();
            Console.WriteLine("\ntestBitStream2 hex and bits end");

            String testString;
            Console.WriteLine("testBitStream2 hex and bits string output");
            testBitStream2.PrintHex(out testString);
            Console.WriteLine(testString + "\n");
            testBitStream2.PrintBits(out testString);
            Console.WriteLine(testString);
            Console.WriteLine("testBitStream2 hex and bits string output end");

            testBitStream2.Read(out testString);
            Console.WriteLine(testString);

            Console.WriteLine(testBitStream2.ReadCompressed(out testString));
            Console.WriteLine(testString);
            testBitStream2.WriteCompressedDelta("xy", "yz");
            testBitStream2.WriteCompressedDelta("xy", "xy");
            Console.WriteLine(testBitStream2.ReadCompressedDelta(out testString));
            Console.WriteLine(testString);
            Console.WriteLine(testBitStream2.ReadCompressedDelta(out testString));
            Console.WriteLine(testString);
            testBitStream2.WriteDelta("xy", "yz");
            testBitStream2.WriteDelta("xy", "xy");
            Console.WriteLine(testBitStream2.ReadDelta(out testString));
            Console.WriteLine(testString);
            Console.WriteLine(testBitStream2.ReadDelta(out testString));
            Console.WriteLine(testString);

            float testFloat;
            testBitStream2.ReadFloat16(out testFloat, 0, 100);
            Console.WriteLine(testFloat);
            testBitStream2.ReadBits(testBuffer, 7);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ReadAlignedBytesSafe(testBuffer, 1, 1);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ReadAlignedBytes(testBuffer, 1);
            Console.WriteLine(testBuffer[0]);
            Console.WriteLine(testBitStream2.ReadBit());
            Console.WriteLine(testBitStream2.ReadBit());
            int intForSerialization2 = 0;
            testBitStream2.Serialize(false, ref intForSerialization2);
            Console.WriteLine(intForSerialization2);

            testBitStream2.PadWithZeroToByteLength(99);
            testBitStream2.PrintBits();
            testBitStream2.SetData(testBuffer);
            Console.WriteLine("setbuff");
            testBitStream2.PrintBits();

            Console.WriteLine(testBitStream2.GetNumberOfBitsAllocated());

            //ByteQueue
            Console.WriteLine("ByteQueue");
            ByteQueue testByteQueue = new ByteQueue();
            testByteQueue.WriteBytes(testBuffer, (uint)testBuffer.Length, "", 0);
            testByteQueue.DecrementReadOffset(1);
            Console.WriteLine(testByteQueue.GetBytesWritten());
            testByteQueue.IncrementReadOffset(1);
            uint testUint;
            byte[] returnArray = testByteQueue.PeekContiguousBytes(out testUint);
            testByteQueue.Print();
            testByteQueue.ReadBytes(returnArray, (uint)returnArray.Length, true);
            testByteQueue.Clear("", 0);

            testBitStream2.AddBitsAndReallocate(99);
            testBitStream2.AlignReadToByteBoundary();
            testBitStream2.AlignWriteToByteBoundary();
            testBitStream2.EndianSwapBytes(5, 5);
            returnArray = testBitStream2.GetData();
            Console.WriteLine(testBitStream2.GetNumberOfBitsAllocated());
            Console.WriteLine(testBitStream2.GetNumberOfBitsUsed());
            Console.WriteLine(testBitStream2.GetNumberOfBytesUsed());
            Console.WriteLine(testBitStream2.GetNumberOfUnreadBits());
            Console.WriteLine(testBitStream2.GetReadOffset());
            Console.WriteLine(testBitStream2.GetWriteOffset());
            testBitStream2.SetData(returnArray);
            testBitStream2.SetNumberOfBitsAllocated(testBitStream2.GetNumberOfBitsAllocated());
            testBitStream2.SetReadOffset(3);
            testBitStream2.SetWriteOffset(3);
            testBitStream2.WriteBits(returnArray, (uint)returnArray.Length);

            //Cell, Table, Row
            Console.WriteLine("Cell, Table, Row");
            Cell testCell = new Cell();
            Byte[] tableTestByteArray = new byte[1];
            tableTestByteArray[0] = (byte)'t';
            int outInt;
            double outDouble;

            testCell.Set("test1232");
            testCell.Get(out testString);
            Console.WriteLine(testString);
            Console.WriteLine((int)testCell.EstimateColumnType());
            testCell.CopyData(testCell);
            testCell.Set(12.5d);
            testCell.Get(out outDouble);
            Console.WriteLine(outDouble);
            testCell.Set((uint)1);
            testCell.Set((int)1);
            testCell.Get(out outInt);
            Console.WriteLine(outInt);
            testCell.Set(tableTestByteArray, tableTestByteArray.Length);
            testCell.Get(tableTestByteArray, out outInt);
            Console.WriteLine(testCell.i);
            Console.WriteLine(testCell.isEmpty);

            Table testTable = new Table();
            testTable.Clear();
            testTable.AddColumn("testNumeric", Table.ColumnType.NUMERIC);
            testTable.AddColumn("testString", Table.ColumnType.STRING);
            testTable.AddColumn("testBinary", Table.ColumnType.BINARY);
            testTable.AddRow(0, new RakNetListCell());
            testTable.AddRow(1, new RakNetListCell());
            testTable.AddRow(2);
            testTable.AddRow(3);
            testTable.AddRow(4);
            testTable.AddRow(5);

            Console.WriteLine(testTable.ColumnIndex("testNumeric"));
            Console.WriteLine(testTable.ColumnName(0));
            Console.WriteLine(testTable.GetAvailableRowId());
            testTable.UpdateCell(0, 0, 9);
            testTable.UpdateCell(0, 1, "testCell");
            testTable.UpdateCell(0, 2, 1, tableTestByteArray);
            testTable.GetCellValueByIndex(0, 0, out outInt);
            Console.WriteLine(outInt);
            string outString;
            testTable.GetCellValueByIndex(0, 1, out outString);
            Console.WriteLine(outString);

            int outLen;
            testTable.GetCellValueByIndex(0, 2, out tableTestByteArray, out outLen);
            Console.WriteLine(tableTestByteArray[0]);
            Console.WriteLine(outLen);
            Console.WriteLine(testTable.GetColumnCount());
            RakNetListColumnDescriptor descriptorList = testTable.GetColumns();
            Console.WriteLine(testTable.GetColumnType(1) == Table.ColumnType.STRING);

            RakNetPageRow testPageRow = testTable.GetListHead();
            Console.WriteLine(testPageRow.isLeaf);
            Console.WriteLine(testPageRow.size);
            Row testRow = testTable.GetRowByID(0);
            Console.WriteLine(testRow.cells[0]);

            Console.WriteLine(testTable.GetRowCount());
            RakNetBPlusTreeRow bplus = testTable.GetRows();

            byte[] byteTest = new byte[999];
            testTable.PrintColumnHeaders(byteTest, 999, ';');

            testTable.PrintRow(byteTest, 999, ';', true, testRow);

            uint[] columnIds = new uint[1];
            columnIds[0] = 0;
            uint[] rowIds = new uint[1];
            rowIds[0] = 0;

            Table outTable = new Table();
            testTable.QueryTable(columnIds, 1, null, 0, rowIds, 1, outTable);
            Row[] testRows;
            testTable.SortTable(null, 0, out testRows);

            testTable.UpdateCellByIndex(0, 1, "5");
            testTable.PrintColumnHeaders(testBuffer, testBuffer.Length, ';');
            Console.WriteLine(System.Text.Encoding.GetEncoding(1251).GetString(testBuffer).Trim('\0'));

            testTable.PrintRow(testBuffer, testBuffer.Length, ';', true, testRow);
            Console.WriteLine(System.Text.Encoding.GetEncoding(1251).GetString(testBuffer).Trim('\0'));

            testTable.RemoveColumn(2);
            testTable.RemoveRow(2);
            testTable.RemoveRows(outTable);

            //ColumnDescriptor
            Console.WriteLine("ColumnDescriptor");
            ColumnDescriptor testColumnDescriptor = descriptorList.Pop();
            Console.WriteLine(testColumnDescriptor.columnName);
            Console.WriteLine(testColumnDescriptor.columnType);

            //ConnectionGraph2
            Console.WriteLine("ConnectionGraph2");
            ConnectionGraph2 testConnectionGraph2 = new ConnectionGraph2();

            testClient.AttachPlugin(testConnectionGraph2);
            testConnectionGraph2.ConnectionExists(testClient.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), testServer.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS));
            SystemAddress[] outSystemAddressList = new SystemAddress[1];
            RakNetGUID[] outGuidList = new RakNetGUID[1];
            uint inOutUint = 1;
            testConnectionGraph2.GetConnectionListForRemoteSystem(testServer.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), outSystemAddressList, outGuidList, ref inOutUint);

            //DirectoryDeltaTransfer
            Console.WriteLine("DirectoryDeltaTransfer");
            DirectoryDeltaTransfer testDirectoryDeltaTransfer = new DirectoryDeltaTransfer();
            testClient.AttachPlugin(testDirectoryDeltaTransfer);

            testDirectoryDeltaTransfer.AddUploadsFromSubdirectory("./");
            testDirectoryDeltaTransfer.ClearUploads();

            FileListTransferCBInterface testCallBack = new FileListTransferCB();
            FileListProgress testFileListProgress = new FileListProgress();

            Console.WriteLine(testDirectoryDeltaTransfer.GetNumberOfFilesForUpload());
            testDirectoryDeltaTransfer.SetApplicationDirectory("./");
           
            IncrementalReadInterface testIncrementalReadInterface = null;
            testDirectoryDeltaTransfer.SetDownloadRequestIncrementalReadInterface(testIncrementalReadInterface, 24);
            FileListTransfer testFileListTransfer = new FileListTransfer();
            testDirectoryDeltaTransfer.SetFileListTransferPlugin(testFileListTransfer);
            testDirectoryDeltaTransfer.SetUploadSendParameters(PacketPriority.HIGH_PRIORITY, (char)0);

            testDirectoryDeltaTransfer.DownloadFromSubdirectory("./", "./", false, testClient.GetSystemAddressFromIndex(0), testCallBack, PacketPriority.HIGH_PRIORITY, (char)0, testFileListProgress);

            //FileListNode
            Console.WriteLine("FileListNode");
            FileListNode testFileListNode = new FileListNode();

            //FileListNodeContext
            Console.WriteLine("FileListNodeContext");
            FileListNodeContext testFileListNodeContext = new FileListNodeContext();
            testFileListNodeContext.op = 0;
            testFileListNodeContext.fileId = 0;
            Console.WriteLine(testFileListNodeContext.op);
            Console.WriteLine(testFileListNodeContext.fileId);

            //FileList
            Console.WriteLine("FileList");
            FileList testFileList = FileList.GetInstance();

            testFileList.AddFile("./", "RakNet.dll", testFileListNodeContext);
            testFileList.AddFilesFromDirectory("./", "./", true, true, false, testFileListNodeContext);
            testFileList.FlagFilesAsReferences();
            FileList outFileList = FileList.GetInstance();
            testFileList.GetDeltaToCurrent(testFileList, outFileList, "", "./");
            Console.WriteLine(testFileList.fileList);
            testFileList.Clear();
            testFileList.DeleteFiles("./notexisting");
            testFileList.ListMissingOrChangedFiles("./", outFileList, false, false);
            testFileList.PopulateDataFromDisk("./", false, false, false);
            testFileList.WriteDataToDisk("./notexisting/");
            testFileList.Serialize(testBitStream2);
            testFileList.SetCallback(testFileListProgress);

            //FileListProgress
            Console.WriteLine("FileListProgress");
            testFileListProgress.OnAddFilesFromDirectoryStarted(testFileList, "./");
            testFileListProgress.OnDirectory(testFileList, "./", 9);
            testFileListProgress.OnFile(testFileList, "./", "nonexist", 22);
            testFileListProgress.OnFilePush("./Nonexist", 99, 99, 99, true, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);

            //FileListTransferCBInterface
            Console.WriteLine("FileListTransferCBInterface");
            FileListTransferCBInterface testFileListTransferCBInterface = new FileListTransferCBInterface();

            //FileListTransfer
            Console.WriteLine("FileListTransfer");
            FileListTransfer testFileListTransferServer = new FileListTransfer();

            testClient.AttachPlugin(testFileListTransfer);
            testServer.AttachPlugin(testFileListTransferServer);
            testFileListTransfer.GetCallback();
            testFileListTransfer.GetPendingFilesToAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testFileListTransfer.IsHandlerActive(99);
            testFileListTransfer.SetCallback(testFileListProgress);
            testFileListTransfer.SetupReceive(testFileListTransferCBInterface, false, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testFileListTransfer.Send(testFileList, testClient, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, 99, PacketPriority.LOW_PRIORITY, (char)0, testIncrementalReadInterface);
            testFileListTransfer.CancelReceive(0);
            testFileListTransfer.RemoveReceiver(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);

            //FileProgressStruct
            Console.WriteLine("FileProgressStruct");
            FileProgressStruct testFileProgressStruct = new FileProgressStruct();

            testFileProgressStruct.allocateIrIDataChunkAutomatically = true;
            testFileProgressStruct.dataChunkLength = 99;
            testFileProgressStruct.firstDataChunk = testBuffer;
            testFileProgressStruct.iriDataChunk = testBuffer;
            testFileProgressStruct.iriWriteOffset = 99;
            testFileProgressStruct.onFileStruct = new OnFileStruct();
            testFileProgressStruct.partCount = 99;
            testFileProgressStruct.partTotal = 99;

            Console.WriteLine(testFileProgressStruct.allocateIrIDataChunkAutomatically);
            Console.WriteLine(testFileProgressStruct.dataChunkLength);
            Console.WriteLine(testFileProgressStruct.firstDataChunk[0]);
            Console.WriteLine(testFileProgressStruct.iriDataChunk[0]);
            Console.WriteLine(testFileProgressStruct.iriWriteOffset);
            Console.WriteLine(testFileProgressStruct.onFileStruct);
            Console.WriteLine(testFileProgressStruct.partCount);
            Console.WriteLine(testFileProgressStruct.partTotal);

            //FilterQuery
            Console.WriteLine("FilterQuery");
            FilterQuery testFilterQuery = new FilterQuery();
            testFilterQuery.cellValue = testCell;
            testFilterQuery.columnIndex = 0;
            testFilterQuery.columnName = "TestName";
            testFilterQuery.operation = Table.FilterQueryType.QF_EQUAL;

            Console.WriteLine(testFilterQuery.cellValue);
            Console.WriteLine(testFilterQuery.columnIndex);
            Console.WriteLine(testFilterQuery.columnName);
            Console.WriteLine(testFilterQuery.operation);

            //FLP_Printf
            Console.WriteLine("FLP_Printf");
            FLP_Printf testFLP_Printf = new FLP_Printf();

            testFLP_Printf.OnAddFilesFromDirectoryStarted(testFileList, "./");
            testFLP_Printf.OnDirectory(testFileList, "./", 9);
            testFLP_Printf.OnFile(testFileList, "./", "nonexist", 22);
            testFLP_Printf.OnFilePush("./Nonexist", 99, 99, 99, true, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);

            //FullyConnectedMesh2
            Console.WriteLine("FullyConnectedMesh2");
            FullyConnectedMesh2 testFullyConnectedMesh2 = FullyConnectedMesh2.GetInstance();
            testClient.AttachPlugin(testFullyConnectedMesh2);
            testFullyConnectedMesh2.AddParticipant(testServer.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS));
            Console.WriteLine(testFullyConnectedMesh2.GetConnectedHost());
            Console.WriteLine(testFullyConnectedMesh2.GetConnectedHostAddr());
            Console.WriteLine(testFullyConnectedMesh2.GetHostSystem());
            Console.WriteLine(testFullyConnectedMesh2.GetParticipantCount());
            uint outUint;
            testFullyConnectedMesh2.GetParticipantCount(out outUint);
            Console.WriteLine(outUint);
            Console.WriteLine(testFullyConnectedMesh2.IsConnectedHost());
            Console.WriteLine(testFullyConnectedMesh2.IsHostSystem());
            testFullyConnectedMesh2.ResetHostCalculation();
            testFullyConnectedMesh2.SetAutoparticipateConnections(true);
            workingRakStringCopy = "none";
            testFullyConnectedMesh2.SetConnectOnNewRemoteConnection(false, workingRakStringCopy);
            workingRakStringCopy.Dispose();

            //MessageFilter
            Console.WriteLine("MessageFilter");
            MessageFilter testMessageFilter = new MessageFilter();
            testClient.AttachPlugin(testMessageFilter);

            testMessageFilter.SetSystemFilterSet(testClient.GetSystemAddressFromIndex(0), 99);
            testMessageFilter.SetAllowRPC(false, "test", 99);
            testMessageFilter.SetAllowMessageID(true, 99, 99, 99);
            testMessageFilter.SetAutoAddNewConnectionsToFilter(99);
            testMessageFilter.SetFilterMaxTime(99, false, 0, 98);
            testMessageFilter.GetSystemFilterSet(testClient.GetSystemAddressFromIndex(0));
            testMessageFilter.GetSystemCount(99);
            testMessageFilter.GetSystemByIndex(99, 0);
            testMessageFilter.GetFilterSetIDByIndex(0);
            testMessageFilter.GetFilterSetCount();
            testMessageFilter.DeleteFilterSet(99);

            //NatPunchthroughClient
            Console.WriteLine("NatPunchthroughClient");
            NatPunchthroughClient testNatPunchthroughClient = new NatPunchthroughClient();
            testClient.AttachPlugin(testNatPunchthroughClient);
            testNatPunchthroughClient.GetPunchthroughConfiguration();
            testNatPunchthroughClient.GetUPNPExternalPort();
            workingRakStringCopy = testNatPunchthroughClient.GetUPNPInternalAddress();
            workingRakStringCopy.Dispose();
            testNatPunchthroughClient.GetUPNPInternalPort();
            testNatPunchthroughClient.OpenNAT(testServer.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), testClient.GetSystemAddressFromIndex(0));
            NatPunchthroughDebugInterface_PacketLogger testNatPunchthroughDebugInterface_PacketLogger = new NatPunchthroughDebugInterface_PacketLogger();
            testNatPunchthroughClient.SetDebugInterface(testNatPunchthroughDebugInterface_PacketLogger);
            
            //NatPunchthroughDebugInterface_PacketLogger
            Console.WriteLine("NatPunchthroughDebugInterface_PacketLogger");
            testNatPunchthroughDebugInterface_PacketLogger.OnClientMessage("test");
            Console.WriteLine(testNatPunchthroughDebugInterface_PacketLogger.pl);

            //NatPunchthroughDebugInterface_Printf
            Console.WriteLine("NatPunchthroughDebugInterface_Printf");
            NatPunchthroughDebugInterface_Printf testNatPunchthroughDebugInterface_Printf = new NatPunchthroughDebugInterface_Printf();
            testNatPunchthroughClient.SetDebugInterface(testNatPunchthroughDebugInterface_Printf);
            testNatPunchthroughDebugInterface_Printf.OnClientMessage("test");
 
            //NatTypeDetectionClient
            Console.WriteLine("NatTypeDetectionClient");
            NatTypeDetectionClient testNatTypeDetectionClient = new NatTypeDetectionClient();
            testClient.AttachPlugin(testNatTypeDetectionClient);
            testNatTypeDetectionClient.DetectNATType(testClient.GetSystemAddressFromIndex(0));

            //NatTypeDetectionServer
            Console.WriteLine("NatTypeDetectionServer");
            NatTypeDetectionServer testNatTypeDetectionServer = new NatTypeDetectionServer();
            testServer.AttachPlugin(testNatTypeDetectionServer);
            testNatTypeDetectionServer.Startup("127.0.0.1","127.0.0.1","127.0.0.1");
            testNatTypeDetectionServer.Shutdown();

            //NetworkIDObject
            Console.WriteLine("NetworkIDObject");
            NetworkIDManager testNetworkIDManager = new NetworkIDManager();
            NetworkIDObject testNetworkIDObject = new TestNetworkIDObjectSubClass();
            testNetworkIDObject.SetNetworkIDManager(testNetworkIDManager);
            testNetworkIDObject.GetNetworkIDManager();
            testNetworkIDObject.GetNetworkID();

            //OnFileStruct
            Console.WriteLine("OnFileStruct");
            OnFileStruct testOnFileStruct = new OnFileStruct();
            testOnFileStruct.byteLengthOfThisFile = 99;
            testOnFileStruct.byteLengthOfThisSet = 99;
            testOnFileStruct.bytesDownloadedForThisFile = 99;
            testOnFileStruct.bytesDownloadedForThisSet = 99;
            testOnFileStruct.context = testFileListNodeContext;
            testOnFileStruct.fileIndex = 99;
            testOnFileStruct.fileName = "99";
            testOnFileStruct.numberOfFilesInThisSet = 99;
            testOnFileStruct.setID = 99;
            testOnFileStruct.fileData = testBuffer;
            Console.WriteLine(testOnFileStruct.fileData[0]);

            //OutOfBandIdentifiers
            Console.WriteLine("OutOfBandIdentifiers");
            OutOfBandIdentifiers testOutOfBandIdentifiers = new OutOfBandIdentifiers();

            //Packet
            Console.WriteLine("Packet");

            //PacketConsoleLogger
            Console.WriteLine("PacketConsoleLogger");
            PacketConsoleLogger testPacketConsoleLogger = new PacketConsoleLogger();

            testClient.AttachPlugin(testPacketConsoleLogger);

            LogCommandParser testLogCommandParser = new LogCommandParser();

            testPacketConsoleLogger.SetLogCommandParser(testLogCommandParser);

            //LogCommandParser
            Console.WriteLine("LogCommandParser");

            //PacketFileLogger
            Console.WriteLine("PacketFileLogger");
            PacketFileLogger testPacketFileLogger = new PacketFileLogger();
            string bigString = new string('c', 9999);

            testPacketFileLogger.StartLog("TestLog");
            testClient.AttachPlugin(testPacketFileLogger);
            testPacketFileLogger.FormatLine(ref bigString, "./", "none", 9, 9, 99, 99, 99, testClient.GetSystemAddressFromIndex(0), testClient.GetSystemAddressFromIndex(0), 99, 99, 99, 99);
            testPacketFileLogger.LogHeader();
            testPacketFileLogger.SetLogDirectMessages(false);
            testPacketFileLogger.SetPrefix("lv");
            testPacketFileLogger.SetPrintAcks(false);
            testPacketFileLogger.SetPrintID(false);
            testPacketFileLogger.SetSuffix("tr");
            testPacketFileLogger.WriteLog("gr");
            testPacketFileLogger.WriteMiscellaneous("lf", "mr");

            testClient.DetachPlugin(testPacketFileLogger);
            testPacketFileLogger.Dispose();

            foreach (string file in Directory.GetFiles("./", "TestLog*.csv"))
            {
                File.Delete(file);
            }
             
            //PluginInterface2
            Console.WriteLine("PluginInterface2");
            PluginInterface2 testPluginInterface2 = new PluginInterface2();

            //PluginReceiveResult
            Console.WriteLine("PluginReceiveResult");
            PluginReceiveResult testPluginReceiveResult = new PluginReceiveResult();

            //PunchthroughConfiguration
            Console.WriteLine("PunchthroughConfiguration");
            PunchthroughConfiguration testPunchthroughConfiguration = new PunchthroughConfiguration();

            //Raknet
            RakNet.RakNet.NonNumericHostString("12");

            //RakNetBPlusTreeRow
            Console.WriteLine("RakNetBPlusTreeRow");
            RakNetBPlusTreeRow testRakNetBPlusTreeRow = new RakNetBPlusTreeRow();

            //RakNetGUID
            Console.WriteLine("RakNetGUID");
            Console.WriteLine(testRakNetGUID.g);
            Console.WriteLine(testRakNetGUID.systemIndex);
            Console.WriteLine(testRakNetGUID == RakNet.RakNet.UNASSIGNED_RAKNET_GUID);
            Console.WriteLine(testRakNetGUID > RakNet.RakNet.UNASSIGNED_RAKNET_GUID);
            Console.WriteLine(testRakNetGUID < RakNet.RakNet.UNASSIGNED_RAKNET_GUID);

            //RakNetList, only one is needed
            //RakNetListSystemAddress
            Console.WriteLine("RakNetListSystemAddress");
            RakNetListSystemAddress testRakNetListSystemAddress = new RakNetListSystemAddress();
            testRakNetListSystemAddress.Insert(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS,"",0);
            testRakNetListSystemAddress.Preallocate(99, "", 0);
            testRakNetListSystemAddress.Push(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS,"",0);
            testRakNetListSystemAddress.RemoveAtIndex(0);
            testRakNetListSystemAddress.RemoveAtIndexFast(0);
            testRakNetListSystemAddress.Insert(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, "", 0);
            testRakNetListSystemAddress.Push(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, "", 0);
            testRakNetListSystemAddress.RemoveFromEnd();
            testRakNetListSystemAddress.Replace(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testRakNetListSystemAddress.Size();
            testRakNetListSystemAddress.Pop();
            testRakNetListSystemAddress.Compress("", 0);
            testRakNetListSystemAddress.CopyData(testRakNetListSystemAddress);
            testRakNetListSystemAddress.Clear(false, "", 0);
            testRakNetListSystemAddress.Insert(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, "", 0);
            testRakNetListSystemAddress.Push(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, "", 0);
            testRakNetListSystemAddress.Get(0);
            testRakNetListSystemAddress.GetIndexOf(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);

            //RakNetPageRow
            Console.WriteLine("RakNetPageRow");
            RakNetPageRow testRakNetPageRow = new RakNetPageRow();
            testRakNetPageRow.isLeaf = false;
            testRakNetPageRow.next = testRakNetPageRow;
            testRakNetPageRow.previous = testRakNetPageRow;
            testRakNetPageRow.size = 9;

            Console.WriteLine(testRakNetPageRow.isLeaf);
            Console.WriteLine(testRakNetPageRow.next);
            Console.WriteLine(testRakNetPageRow.previous);
            Console.WriteLine(testRakNetPageRow.size);

            //RakNetSocket
            Console.WriteLine("RakNetSocket");
            RakNetSocket testRakNetSocket = new RakNetSocket();
            testRakNetSocket.boundAddress = RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS;
            testRakNetSocket.remotePortRakNetWasStartedOn_PS3 = 0;
            testRakNetSocket.s = 99;
            testRakNetSocket.userConnectionSocketIndex = 0;

            Console.WriteLine(testRakNetSocket.boundAddress);
            Console.WriteLine(testRakNetSocket.remotePortRakNetWasStartedOn_PS3);
            Console.WriteLine(testRakNetSocket.s);
            Console.WriteLine(testRakNetSocket.userConnectionSocketIndex);

            //ReadyEvent
            Console.WriteLine("ReadyEvent");
            ReadyEvent testReadyEvent = new ReadyEvent();
            testClient.AttachPlugin(testReadyEvent);
            testReadyEvent.AddToWaitList(99, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testReadyEvent.GetEventAtIndex(0);
            testReadyEvent.GetEventListSize();
            testReadyEvent.GetFromWaitListAtIndex(99, 0);
            testReadyEvent.GetReadyStatus(99, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testReadyEvent.GetRemoteWaitListSize(99);
            testReadyEvent.HasEvent(99);
            testReadyEvent.IsEventCompleted(99);
            testReadyEvent.IsEventCompletionProcessing(99);
            testReadyEvent.IsEventSet(99);
            testReadyEvent.IsInWaitList(99, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testReadyEvent.SetEvent(99, false);
            testReadyEvent.SetSendChannel(9);
            testReadyEvent.RemoveFromWaitList(99, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testReadyEvent.ForceCompletion(99);
            testReadyEvent.DeleteEvent(99);

            //RemoteSystemIndex
            Console.WriteLine("RemoteSystemIndex");
            RemoteSystemIndex testRemoteSystemIndex = new RemoteSystemIndex();
            testRemoteSystemIndex.index = 5;
            testRemoteSystemIndex.next = testRemoteSystemIndex;

            Console.WriteLine(testRemoteSystemIndex.index);
            Console.WriteLine(testRemoteSystemIndex.next);

            //Router2
            Console.WriteLine("Router2");
            Router2 testRouter2 = new Router2();
            testClient.AttachPlugin(testRouter2);
            testRouter2.EstablishRouting(testClient.GetGUIDFromIndex(0));
            testRouter2.GetConnectionRequestIndex(testClient.GetGUIDFromIndex(0));
            testRouter2.SetMaximumForwardingRequests(99);
         

            //SimpleMutex
            Console.WriteLine("SimpleMutex");
            SimpleMutex testSimpleMutex = new SimpleMutex();
            testSimpleMutex.Lock();
            testSimpleMutex.Unlock();

            //SocketDescriptor
            Console.WriteLine("SocketDescriptor");
            SocketDescriptor testSocketDescriptor = new SocketDescriptor();
            testSocketDescriptor.hostAddress = "127.0.0.1";
            testSocketDescriptor.port = 60002;
            testSocketDescriptor.remotePortRakNetWasStartedOn_PS3 = 0;

            Console.WriteLine(testSocketDescriptor.hostAddress);
            Console.WriteLine(testSocketDescriptor.port);
            Console.WriteLine(testSocketDescriptor.remotePortRakNetWasStartedOn_PS3);

            //TeamBalancer
            Console.WriteLine("TeamBalancer");
            TeamBalancer testTeamBalancer = new TeamBalancer();
            testClient.AttachPlugin(testTeamBalancer);
            testTeamBalancer.SetAllowHostMigration(false);
            testTeamBalancer.SetDefaultAssignmentAlgorithm(TeamBalancer.DefaultAssigmentAlgorithm.FILL_IN_ORDER);
            testTeamBalancer.SetHostGuid(testClient.GetGUIDFromIndex(0));
            testTeamBalancer.SetLockTeams(false);
            RakNetListUnsignedShort ushortList = new RakNetListUnsignedShort();
            ushortList.Push(5, "", 0);
            testTeamBalancer.SetTeamSizeLimits(ushortList);
            testTeamBalancer.SetForceEvenTeams(true);
            testTeamBalancer.CancelRequestSpecificTeam();
            testTeamBalancer.GetMyTeam();
            testTeamBalancer.RequestAnyTeam(); 
            testTeamBalancer.RequestSpecificTeam(0);
            
            //ThreadsafePacketLogger
            Console.WriteLine("ThreadsafePacketLogger");
            ThreadsafePacketLogger testThreadsafePacketLogger = new ThreadsafePacketLogger();
            testClient.AttachPlugin(testThreadsafePacketLogger);
            testThreadsafePacketLogger.FormatLine(ref bigString,"./","none",9,9,99,99,99,testClient.GetSystemAddressFromIndex(0),testClient.GetSystemAddressFromIndex(0),99,99,99,99);
            testThreadsafePacketLogger.LogHeader();
            testThreadsafePacketLogger.SetLogDirectMessages(false);
            testThreadsafePacketLogger.SetPrefix("lv");
            testThreadsafePacketLogger.SetPrintAcks(false);
            testThreadsafePacketLogger.SetPrintID(false);
            testThreadsafePacketLogger.SetSuffix("tr");
            testThreadsafePacketLogger.WriteLog("gr");
            testThreadsafePacketLogger.WriteMiscellaneous("lf","mr");

            //UDPForwarder
            Console.WriteLine("UDPForwarder");
            UDPForwarder testUDPForwarder = new UDPForwarder();
            testUDPForwarder.Startup();
            testUDPForwarder.GetMaxForwardEntries();
            testUDPForwarder.GetUsedForwardEntries();
            testUDPForwarder.SetMaxForwardEntries(99);
            ushort outUshort;
            testUDPForwarder.StartForwarding(testClient.GetSystemAddressFromIndex(0), testServer.GetSystemAddressFromIndex(0), 99, "127.0.0.1", out outUshort, out outUint);
            testUDPForwarder.StopForwarding(testClient.GetSystemAddressFromIndex(0),testServer.GetSystemAddressFromIndex(0));
            Thread.Sleep(2000);
            testUDPForwarder.StartForwardingThreaded(testClient.GetSystemAddressFromIndex(0), testServer.GetSystemAddressFromIndex(0), 99, "127.0.0.1", out outUshort, out outUint);
            testUDPForwarder.StopForwardingThreaded(testClient.GetSystemAddressFromIndex(0), testServer.GetSystemAddressFromIndex(0));
            Thread.Sleep(1000);
            //testUDPForwarder.threadOperationIncomingMutex=new SimpleMutex();
           // testUDPForwarder.threadOperationOutgoingMutex=new SimpleMutex();
            testUDPForwarder.threadRunning=false;
            testUDPForwarder.isRunning=false;
            testUDPForwarder.maxForwardEntries = 99;

            Console.WriteLine(testUDPForwarder.threadOperationIncomingMutex);
            Console.WriteLine(testUDPForwarder.threadOperationOutgoingMutex);
            Console.WriteLine(testUDPForwarder.threadRunning);
            Console.WriteLine(testUDPForwarder.isRunning);
            Console.WriteLine(testUDPForwarder.maxForwardEntries);

            testUDPForwarder.Shutdown();

            //UDPProxyClient
            Console.WriteLine("UDPProxyClient");
            UDPProxyClient testUDPProxyClient = new UDPProxyClient();
            UDPProxyClientResultHandler testUDPProxyClientResultHandler= new UDPProxyClientResultHandlerCB();

            testUDPProxyClient.SetResultHandler(testUDPProxyClientResultHandler);
            testClient.AttachPlugin(testUDPProxyClient);
            testUDPProxyClient.RequestForwarding(testClient.GetSystemAddressFromIndex(0), testServer.GetSystemAddressFromIndex(0),testClient.GetGUIDFromIndex(0),1);
 
            //UDPProxyCoordinator
            Console.WriteLine("UDPProxyCoordinator");
            UDPProxyCoordinator testUDPProxyCoordinator = new UDPProxyCoordinator();
            testClient.AttachPlugin(testUDPProxyCoordinator);
            testUDPProxyCoordinator.SetRemoteLoginPassword(rakStringTest);
           
            //UDPProxyServer
            Console.WriteLine("UDPProxyServer");
            UDPProxyServer testUDPProxyServer = new UDPProxyServer();
            UDPProxyServerResultHandler testUDPProxyServerResultHandler= new UDPProxyServerResultHandlerCB();
            testServer.AttachPlugin(testUDPProxyServer);
            testUDPProxyServer.SetResultHandler(testUDPProxyServerResultHandler);
            testUDPProxyServer.LoginToCoordinator(rakStringTest,testServer.GetSystemAddressFromIndex(0));
            testUDPProxyServer.udpForwarder = testUDPProxyServer.udpForwarder;
            Console.WriteLine(testUDPProxyServer.udpForwarder);

            //RakString
            Console.WriteLine("RakString");
            testRakString.AppendBytes(testBuffer, (uint)testBuffer.Length);
            Console.WriteLine(testRakString.C_String());
            Console.WriteLine(testRakString.C_StringUnsafe());
            testRakString.Clear();
            Console.WriteLine(testRakString.ContainsNonprintableExceptSpaces());
            workingRakStringCopy = testRakString.Assign("MayJuneJuly", 0, 3);
            workingRakStringCopy.Dispose();
            Console.WriteLine(testRakString);
            testRakString.CopyData(testRakString);
            testRakString.Serialize(testBitStream2);
            testRakString.Deserialize(testBitStream2);
            testRakString.SerializeCompressed(testBitStream2);
            testRakString.DeserializeCompressed(testBitStream2);
            workingRakStringCopy = testRakString.Assign("MayJuneJuly", 0, 3);
            workingRakStringCopy.Dispose();

            testRakString.Erase(0, 1);

            Console.WriteLine(testRakString.Find("y", 0));
            Console.WriteLine(testRakString.GetLength());
            Console.WriteLine(testRakString.IPAddressMatch("127.0.0.1"));
            Console.WriteLine(testRakString.IsEmailAddress());
            Console.WriteLine(testRakString.IsEmpty());
            Console.WriteLine(testRakString.MakeFilePath());
            testRakString.Printf();
            testRakString.RemoveCharacter('a');
            testRakString.Replace(0, 1, 'c');
            testRakString.Set("cat");
            testRakString.SetChar(0, 'r');
            testRakString.SQLEscape();
            Console.WriteLine(testRakString.StrCmp(testRakString));
            Console.WriteLine(testRakString.StrICmp(testRakString));
            workingRakStringCopy = testRakString.SubStr(0, 2);
            Console.WriteLine(workingRakStringCopy);
            workingRakStringCopy.Dispose();
            Console.WriteLine(testRakString);
            testRakString.TerminateAtFirstCharacter('y');
            testRakString.TerminateAtLastCharacter('y');
            Console.WriteLine(testRakString.ToLower());
            Console.WriteLine(testRakString.ToUpper());
            testRakString.Truncate(2);
            testRakString.URLDecode();
            testRakString.URLEncode();

            //PluginInterface2
            testUDPProxyServer.GetRakPeerInterface();

            //RakPeerInterface
            testPacket = testClient.AllocatePacket(5);
            testClient.AddToBanList("127.0.0.1", 10);
            testClient.AddToSecurityExceptionList("127.0.0.1");
            testBuffer = testPacket.data;
            testClient.AdvertiseSystem("127.0.0.1",60002,testBuffer,testBuffer.Length);
            testClient.AllowConnectionResponseIPMigration(false);
            testClient.CancelConnectionAttempt(testClient.GetSystemAddressFromIndex(0));
            testClient.ChangeSystemAddress(testClient.GetGUIDFromIndex(0),testClient.GetSystemAddressFromIndex(0));
            testClient.ClearBanList();
            uint[] testFrequencyTable = new uint[256];
            testClient.DisableSecurity();
            testClient.GetAveragePing(new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS));
            SystemAddress[] remoteSystems;
            ushort numberOfSystems=4;
            testClient.GetConnectionList(out remoteSystems,ref numberOfSystems);
            testClient.GetExternalID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testClient.GetGUIDFromIndex(0);
            testClient.GetGuidFromSystemAddress(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            int inOutInt=testBuffer.Length;
            testClient.GetIncomingPassword(testBuffer,ref inOutInt);
            testClient.GetIndexFromSystemAddress(testClient.GetSystemAddressFromIndex(0));
            testClient.GetInternalID();
            testClient.GetLastPing(new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS));
            testClient.GetLocalIP(0);
            testClient.GetLowestPing(new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS));
            testClient.GetMaximumIncomingConnections();
            testClient.GetMaximumNumberOfPeers();
            testClient.GetMTUSize(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testClient.GetNextSendReceipt();
            testClient.GetNumberOfAddresses();
            testClient.SetOfflinePingResponse(testBuffer, (uint)testBuffer.Length);
            testClient.GetOfflinePingResponse(testBuffer,out outUint);
            testClient.GetReceiveBufferSize();
            testClient.GetSplitMessageProgressInterval();
            testClient.GetStatistics(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testClient.GetSystemAddressFromGuid(testClient.GetGUIDFromIndex(0));
            testClient.GetSystemAddressFromIndex(0);
            RakNetListSystemAddress systemAddressList= new RakNetListSystemAddress();
            RakNetListRakNetGUID guidList= new RakNetListRakNetGUID();
            testClient.GetSystemList(systemAddressList,guidList);
            testClient.GetTimeoutTime(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testClient.IncrementNextSendReceipt();
            testClient.InitializeSecurity("dsf","sdaf");
            testClient.IsActive();
            testClient.IsBanned("127.0.0.1");
            testClient.GetConnectionState(new AddressOrGUID(testClient.GetSystemAddressFromIndex(0)));
            testClient.IsInSecurityExceptionList("127.0.0.1");
            testClient.IsLocalIP("127.0.0.1");
            testClient.NumberOfConnections();
            testClient.Ping(testClient.GetSystemAddressFromIndex(0));
            testClient.PushBackPacket(testPacket,true);
            testClient.RemoveFromBanList("127.0.0.1");
            testClient.RemoveFromSecurityExceptionList("127.0.0.1");
            testClient.SendLoopback(testBuffer,testBuffer.Length);
            testClient.SendTTL("127.0.0.1",60002,5);
            testClient.SetIncomingPassword(testBuffer,testBuffer.Length);
            testClient.SetLimitIPConnectionFrequency(true);
            testClient.SetMaximumIncomingConnections(99);
            testClient.SetOccasionalPing(true);
            testClient.SetPerConnectionOutgoingBandwidthLimit(10);
            testClient.SetSplitMessageProgressInterval(99);
            testClient.SetTimeoutTime(99,RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS);
            testClient.SetUnreliableTimeout(99);
            testClient.WriteOutOfBandHeader(testBitStream1);
            testClient.CloseConnection(testClient.GetSystemAddressFromIndex(0),false);
            testClient.Shutdown(20);

            RakPeer.DestroyInstance(testClient);
            RakPeer.DestroyInstance(testServer);

            //These need to be freed if used in the main function.
            testUDPForwarder.Dispose();
            testUDPProxyCoordinator.Dispose();
            FileList.DestroyInstance(testFileList);
            FileList.DestroyInstance(outFileList);
            FullyConnectedMesh2.DestroyInstance(testFullyConnectedMesh2);
            //If RakString is not freed before program exit it will crash
            rakStringTest.Dispose();
            testRakString.Dispose();
            workingRakStringCopy.Dispose();
            RakString.FreeMemory();

            Console.WriteLine("Demo complete. Press enter.");
            Console.Read();
        }