コード例 #1
0
        public RakNetGUID GetHostSystem()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.FullyConnectedMesh2_GetHostSystem(swigCPtr), true);

            return(ret);
        }
コード例 #2
0
        public virtual RakNetGUID GetMyGUID()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetMyGUID(swigCPtr), true);

            return(ret);
        }
コード例 #3
0
ファイル: TM_World.cs プロジェクト: samsonchen1989/RaknetMy
        public RakNetGUID GetHost()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.TM_World_GetHost(swigCPtr), true);

            return(ret);
        }
コード例 #4
0
 public virtual void WriteVJSUserData(BitStream bsOut, RakNetGUID userGuid)
 {
     RakNetPINVOKE.FullyConnectedMesh2_WriteVJSUserData(swigCPtr, BitStream.getCPtr(bsOut), RakNetGUID.getCPtr(userGuid));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #5
0
ファイル: RakPeer.cs プロジェクト: samsonchen1989/RaknetMy
 public override RakNetGUID GetMyGUID() {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeer_GetMyGUID(swigCPtr), true);
   return ret;
 }
コード例 #6
0
ファイル: RakPeer.cs プロジェクト: samsonchen1989/RaknetMy
 public override SystemAddress GetSystemAddressFromGuid(RakNetGUID input) {
   SystemAddress ret = new SystemAddress(RakNetPINVOKE.RakPeer_GetSystemAddressFromGuid(swigCPtr, RakNetGUID.getCPtr(input)), true);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #7
0
        public RakNetGUID Pop()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_Pop(swigCPtr), false);

            return(ret);
        }
コード例 #8
0
ファイル: MyRakNetPeer.cs プロジェクト: caomw/SpaceEngineers
 public uint SendMessage(BitStream data, RakNetGUID recipent, PacketPriorityEnum priority = PacketPriorityEnum.LOW_PRIORITY, PacketReliabilityEnum reliability = PacketReliabilityEnum.UNRELIABLE, byte channel = 0)
 {
     Debug.Assert(data.GetNumberOfBytesUsed() > 0, "no data");
     uint ret = m_peer.Send(data, priority, reliability, channel, recipent, false);
     Debug.Assert(ret != 0, "bad input?");
     return ret;
 }
コード例 #9
0
        public uint GetIndexOf(RakNetGUID input)
        {
            uint ret = RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_GetIndexOf(swigCPtr, RakNetGUID.getCPtr(input));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #10
0
        public RakNetGUID Get(uint position)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_Get(swigCPtr, position), false);

            return(ret);
        }
コード例 #11
0
 public void Replace(RakNetGUID input)
 {
     RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_Replace__SWIG_1(swigCPtr, RakNetGUID.getCPtr(input));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #12
0
 public void Replace(RakNetGUID input, RakNetGUID filler, uint position, string file, uint line)
 {
     RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_Replace__SWIG_0(swigCPtr, RakNetGUID.getCPtr(input), RakNetGUID.getCPtr(filler), position, file, line);
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #13
0
 public void Insert(RakNetGUID input, string file, uint line)
 {
     RakNetPINVOKE.CSharp_RakNet_RakNetListRakNetGUID_Insert__SWIG_1(swigCPtr, RakNetGUID.getCPtr(input), file, line);
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #14
0
 private void SendClientConnected(ulong steamID, RakNetGUID exclude)
 {
     BitStream bs = new BitStream(null);
     bs.Write((byte)MessageIDEnum.REMOTE_CLIENT_CONNECTED);
     bs.Write((long)steamID);
     BroadcastMessage(bs, PacketPriorityEnum.HIGH_PRIORITY, PacketReliabilityEnum.RELIABLE_ORDERED, 0, exclude);
 }
コード例 #15
0
        public bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress saOut, RakNetGUID guidOut, out uint outLength)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystem(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), SystemAddress.getCPtr(saOut), RakNetGUID.getCPtr(guidOut), out outLength);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #16
0
        private void SendChatMessageInternal(ulong steamID, string message, RakNetGUID? exclude = null)
        {
            BitStream bs = new BitStream(null);

            bs.Write((byte)MessageIDEnum.CHAT_MESSAGE);
            bs.Write((long)steamID);
            bs.WriteCompressed(message);

            BroadcastMessage(bs, PacketPriorityEnum.IMMEDIATE_PRIORITY, PacketReliabilityEnum.RELIABLE_ORDERED, 0, exclude);
        }
コード例 #17
0
        public bool ConnectionExists(RakNetGUID g1, RakNetGUID g2)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_ConnectionExists(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #18
0
        private void ClientData(Packet packet)
        {
            BitStream bs = packet.Data;
            long tmpLong;
            bool success = bs.Read(out tmpLong);
            Debug.Assert(success, "Failed to read steamID");
            ulong steamID = (ulong)tmpLong;

            // already connected
            // TODO:SK handle properly (who to disconnect?)
            if (m_steamIDToGUID.ContainsKey(steamID))
            {
                m_peer.CloseConnection(packet.GUID, false);
                return;
            }

            int version;
            success = bs.Read(out version);
            Debug.Assert(success, "Failed to read version");
            if (version != Version)
            {
                m_peer.CloseConnection(packet.GUID, true);
                return;
            }

            SendServerData(packet.GUID);

            var guid = new RakNetGUID(packet.GUID);
            m_steamIDToGUID.Add(steamID, guid);
            m_GUIDToSteamID.Add(guid.G, steamID);

            SendClientConnected(steamID, packet.GUID);

            RaiseOnClientJoined(steamID);
        }
コード例 #19
0
        public ushort GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2)
        {
            ushort ret = RakNetPINVOKE.ConnectionGraph2_GetPingBetweenSystems(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #20
0
ファイル: RakPeer.cs プロジェクト: samsonchen1989/RaknetMy
 public override RakNetGUID GetGuidFromSystemAddress(SystemAddress input) {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeer_GetGuidFromSystemAddress(swigCPtr, SystemAddress.getCPtr(input)), false);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #21
0
        public RakNetGUID GetLowestAveragePingSystem()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.ConnectionGraph2_GetLowestAveragePingSystem(swigCPtr), true);

            return(ret);
        }
コード例 #22
0
ファイル: RakPeer.cs プロジェクト: samsonchen1989/RaknetMy
 public override void ChangeSystemAddress(RakNetGUID guid, SystemAddress systemAddress) {
   RakNetPINVOKE.RakPeer_ChangeSystemAddress(swigCPtr, RakNetGUID.getCPtr(guid), SystemAddress.getCPtr(systemAddress));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #23
0
 public void AddParticipant(SystemAddress systemAddress, RakNetGUID rakNetGUID)
 {
     RakNetPINVOKE.ConnectionGraph2_AddParticipant(swigCPtr, SystemAddress.getCPtr(systemAddress), RakNetGUID.getCPtr(rakNetGUID));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #24
0
 public virtual void GetVerifiedJoinRequiredProcessingList(RakNetGUID host, RakNetListSystemAddress addresses, RakNetListRakNetGUID guids, SWIGTYPE_p_DataStructures__ListT_RakNet__BitStream_p_t userData)
 {
     RakNetPINVOKE.FullyConnectedMesh2_GetVerifiedJoinRequiredProcessingList(swigCPtr, RakNetGUID.getCPtr(host), RakNetListSystemAddress.getCPtr(addresses), RakNetListRakNetGUID.getCPtr(guids), SWIGTYPE_p_DataStructures__ListT_RakNet__BitStream_p_t.getCPtr(userData));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #25
0
        private bool GetConnectionListForRemoteSystemHelper(RakNetGUID remoteSystemGuid, RakNetListSystemAddress saOut, RakNetListRakNetGUID guidOut, ref uint inOutLength)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystemHelper(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), RakNetListSystemAddress.getCPtr(saOut), RakNetListRakNetGUID.getCPtr(guidOut), ref inOutLength);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #26
0
 public FCM2Participant(long _fcm2Guid, RakNetGUID _rakNetGuid) : this(RakNetPINVOKE.new_FullyConnectedMesh2_FCM2Participant__SWIG_1(_fcm2Guid, RakNetGUID.getCPtr(_rakNetGuid)), true)
 {
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #27
0
        public bool RemoveFromWaitList(int eventId, RakNetGUID guid)
        {
            bool ret = RakNetPINVOKE.ReadyEvent_RemoveFromWaitList(swigCPtr, eventId, RakNetGUID.getCPtr(guid));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #28
0
        public virtual RakNetGUID GetGUIDFromIndex(uint index)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetGUIDFromIndex(swigCPtr, index), true);

            return(ret);
        }
コード例 #29
0
        public RakNetGUID GetFromWaitListAtIndex(int eventId, uint index)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.ReadyEvent_GetFromWaitListAtIndex(swigCPtr, eventId, index), true);

            return(ret);
        }
コード例 #30
0
        public virtual SystemAddress GetSystemAddressFromGuid(RakNetGUID input)
        {
            SystemAddress ret = new SystemAddress(RakNetPINVOKE.RakPeerInterface_GetSystemAddressFromGuid(swigCPtr, RakNetGUID.getCPtr(input)), true);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #31
0
        public ReadyEventSystemStatus GetReadyStatus(int eventId, RakNetGUID guid)
        {
            ReadyEventSystemStatus ret = (ReadyEventSystemStatus)RakNetPINVOKE.ReadyEvent_GetReadyStatus(swigCPtr, eventId, RakNetGUID.getCPtr(guid));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #32
0
        private void SendServerData(RakNetGUID recipent)
        {
            BitStream bs = new BitStream(null);
            bs.Write((byte)MessageIDEnum.SERVER_DATA);

            // connected client steamIDs
            bs.Write(m_steamIDToGUID.Count);
            foreach (var steamID in m_steamIDToGUID.Keys)
            {
                bs.Write((long)steamID);
            }

            // serverID
            bs.Write((long)ServerId);

            // Mods
            bs.Write(m_mods.Count);
            foreach (ulong modId in m_mods)
            {
                bs.Write((long)modId);
            }

            // type table
            var types = MyRakNetSyncLayer.Static.GetTypeTable();
            bs.Write(types.Count);
            foreach (var type in types)
            {
                bs.Write(type.GUID.ToByteArray(), 16);
            }

            SendMessage(bs, recipent, PacketPriorityEnum.IMMEDIATE_PRIORITY, PacketReliabilityEnum.RELIABLE);
        }
コード例 #33
0
        public bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, uint timeoutOnNoDataMS, BitStream serverSelectionBitstream)
        {
            bool ret = RakNetPINVOKE.UDPProxyClient_RequestForwarding__SWIG_2(swigCPtr, SystemAddress.getCPtr(proxyCoordinator), SystemAddress.getCPtr(sourceAddress), RakNetGUID.getCPtr(targetGuid), timeoutOnNoDataMS, BitStream.getCPtr(serverSelectionBitstream));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #34
0
 public uint BroadcastMessage(BitStream data, PacketPriorityEnum priority = PacketPriorityEnum.LOW_PRIORITY, PacketReliabilityEnum reliability = PacketReliabilityEnum.UNRELIABLE, byte channel = 0, RakNetGUID? exclude = null)
 {
     exclude = exclude.HasValue ? exclude.Value : RakNetGUID.UNASSIGNED_RAKNET_GUID;
     Debug.Assert(data.GetNumberOfBytesUsed() > 0, "no data");
     uint ret = m_peer.Send(data, priority, reliability, channel, exclude.Value, true);
     Debug.Assert(ret != 0, "bad input?");
     return ret;
 }
コード例 #35
0
ファイル: RakPeer.cs プロジェクト: samsonchen1989/RaknetMy
 public override RakNetGUID GetGUIDFromIndex(uint index) {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeer_GetGUIDFromIndex(swigCPtr, index), true);
   return ret;
 }
コード例 #36
0
        private void ServerData(Packet packet)
        {
            BitStream bs = packet.Data;
            bool success;
            int count;
            long tmpLong;
            byte[] tmpGUID = new byte[16];

            success = bs.Read(out count);
            Debug.Assert(success, "Failed to read client count");
            List<ulong> clients = new List<ulong>(count);

            for (int i = 0; i < count; i++)
            {
                success = bs.Read(out tmpLong);
                Debug.Assert(success, "Failed to read client SteamID " + (i + 1) + "/" + count);
                clients.Add((ulong)tmpLong);
            }

            success = bs.Read(out tmpLong);
            Debug.Assert(success, "Failed to read serverID");
            ServerId = (ulong)tmpLong;

            var guid = new RakNetGUID(packet.GUID);
            m_steamIDToGUID.Add(ServerId, guid);
            m_GUIDToSteamID.Add(guid.G, ServerId);

            RaiseOnClientJoined(ServerId);

            success = bs.Read(out count);
            Debug.Assert(success, "Failed to read mods count");
            List<ulong> mods = new List<ulong>(count);

            for (int i = 0; i < count; i++)
            {
                success = bs.Read(out tmpLong);
                Debug.Assert(success, "Failed to read mod " + (i + 1) + "/" + count);
                mods.Add((ulong)tmpLong);
            }

            var handler = OnModListRecieved;
            if (handler != null)
                handler(mods);

            success = bs.Read(out count);
            Debug.Assert(success, "Failed to read type table count");
            List<Guid> types = new List<Guid>(count);

            for (int i = 0; i < count; i++)
            {
                success = bs.Read(tmpGUID, 16);
                Debug.Assert(success, "Failed to read type table GUID " + (i + 1) + "/" + count);
                types.Add(new Guid(tmpGUID));
            }

            MyRakNetSyncLayer.Static.SetTypeTable(types);

            SendStateDataRequest();
        }
コード例 #37
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);
            }
        }