Esempio n. 1
0
        private void CheckParameters()
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0018: Expected O, but got Unknown
            RailID server_id = (RailID)(object)new RailID();

            if (GetRailConnectIDFromCmdLine(server_id))
            {
                if (((RailComparableID)server_id).IsValid())
                {
                    Main.OpenPlayerSelect(delegate(PlayerFileData playerData)
                    {
                        Main.ServerSideCharacter = false;
                        playerData.SetAsActive();
                        Main.menuMode   = 882;
                        Main.statusText = Language.GetTextValue("Social.Joining");
                        WeGameHelper.WriteDebugString(" CheckParameters, lobby.join");
                        JoinServer(server_id);
                    });
                }
                else
                {
                    WeGameHelper.WriteDebugString("Invalid RailID passed to +connect_lobby");
                }
            }
        }
Esempio n. 2
0
        private void OnLobbyCreated(RailID lobbyID)
        {
            WeGameHelper.WriteDebugString("SetLocalPeer: {0}", (object)(ulong)((RailComparableID)lobbyID).id_);
            this._reader.SetLocalPeer(lobbyID);
            this._writer.SetLocalPeer(lobbyID);
            this._serverID = lobbyID;
            Action action = (Action)(() =>
            {
                // ISSUE: explicit non-virtual call
                ReportServerID t = new ReportServerID()
                {
                    _serverID = (((RailComparableID)lobbyID).id_.ToString())
                };
                IPCMessage msg = new IPCMessage();
                msg.Build <ReportServerID>(IPCMessageType.IPCMessageTypeReportServerID, t);
                WeGameHelper.WriteDebugString("Send serverID to game client - " + this._client.SendMessage(msg).ToString());
            });

            if (this._serverConnected)
            {
                action();
            }
            else
            {
                this._ipcConnetedAction += action;
                WeGameHelper.WriteDebugString("report server id fail, no connection");
            }
        }
Esempio n. 3
0
        private void OnGetFriendMetaData(RailFriendsGetMetadataResult data)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_005c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0062: Expected O, but got Unknown
            if ((int)((EventBase)data).result != 0 || data.friend_kvs.Count <= 0)
            {
                return;
            }
            WeGameHelper.WriteDebugString("OnGetFriendMetaData - " + DumpMataDataString(data.friend_kvs));
            string valueByKey = GetValueByKey(_serverIDMedataKey, data.friend_kvs);

            if (valueByKey == null)
            {
                return;
            }
            if (valueByKey.Length > 0)
            {
                RailID val = (RailID)(object)new RailID();
                ((RailComparableID)val).id_ = ulong.Parse(valueByKey);
                if (((RailComparableID)val).IsValid())
                {
                    JoinServer(val);
                }
                else
                {
                    WeGameHelper.WriteDebugString("JoinServer failed, invalid server id");
                }
            }
            else
            {
                WeGameHelper.WriteDebugString("can not find server id key");
            }
        }
Esempio n. 4
0
        private void OnGetFriendMetaData(RailFriendsGetMetadataResult data)
        {
            if (((EventBase)data).result != null || ((List <RailKeyValueResult>)data.friend_kvs).Count <= 0)
            {
                return;
            }
            WeGameHelper.WriteDebugString("OnGetFriendMetaData - " + this.DumpMataDataString((List <RailKeyValueResult>)data.friend_kvs));
            string valueByKey = this.GetValueByKey(this._serverIDMedataKey, (List <RailKeyValueResult>)data.friend_kvs);

            if (valueByKey == null)
            {
                return;
            }
            if (valueByKey.Length > 0)
            {
                RailID server_id = new RailID();
                ((RailComparableID)server_id).id_ = (__Null)(long)ulong.Parse(valueByKey);
                if (((RailComparableID)server_id).IsValid())
                {
                    this.JoinServer(server_id);
                }
                else
                {
                    WeGameHelper.WriteDebugString("JoinServer failed, invalid server id");
                }
            }
            else
            {
                WeGameHelper.WriteDebugString("can not find server id key");
            }
        }
Esempio n. 5
0
        private void CheckParameters()
        {
            RailID server_id = new RailID();

            if (!this.GetRailConnectIDFromCmdLine(server_id))
            {
                return;
            }
            if (((RailComparableID)server_id).IsValid())
            {
                Main.OpenPlayerSelect((Main.OnPlayerSelected)(playerData =>
                {
                    Main.ServerSideCharacter = false;
                    playerData.SetAsActive();
                    Main.menuMode   = 882;
                    Main.statusText = Language.GetTextValue("Social.Joining");
                    WeGameHelper.WriteDebugString(" CheckParameters, lobby.join");
                    this.JoinServer(server_id);
                }));
            }
            else
            {
                WeGameHelper.WriteDebugString("Invalid RailID passed to +connect_lobby");
            }
        }
Esempio n. 6
0
        protected virtual bool BeginReadData()
        {
            bool       flag       = false;
            IPCContent ipcContent = new IPCContent()
            {
                data        = new byte[this.BufferSize],
                CancelToken = this._cancelTokenSrc.Token
            };

            WeGameHelper.WriteDebugString(nameof(BeginReadData));
            try
            {
                if (this._pipeStream != null)
                {
                    this._pipeStream.BeginRead(ipcContent.data, 0, this.BufferSize, new AsyncCallback(this.ReadCallback), (object)ipcContent);
                    flag = true;
                }
            }
            catch (IOException ex)
            {
                this._pipeBrokenFlag = true;
                WeGameHelper.WriteDebugString("BeginReadData Exception, {0}", (object)ex.Message);
            }
            return(flag);
        }
        private void OnLobbyCreated(RailID lobbyID)
        {
            WeGameHelper.WriteDebugString("SetLocalPeer: {0}", ((RailComparableID)lobbyID).id_);
            _reader.SetLocalPeer(lobbyID);
            _writer.SetLocalPeer(lobbyID);
            _serverID = lobbyID;
            Action action = delegate
            {
                ReportServerID t = new ReportServerID
                {
                    _serverID = ((RailComparableID)lobbyID).id_.ToString()
                };
                IPCMessage iPCMessage = new IPCMessage();
                iPCMessage.Build(IPCMessageType.IPCMessageTypeReportServerID, t);
                WeGameHelper.WriteDebugString("Send serverID to game client - " + _client.SendMessage(iPCMessage));
            };

            if (_serverConnected)
            {
                action();
                return;
            }
            _ipcConnetedAction = (Action)Delegate.Combine(_ipcConnetedAction, action);
            WeGameHelper.WriteDebugString("report server id fail, no connection");
        }
 public void OnRailEvent(RAILEventID event_id, EventBase data)
 {
     //IL_0038: Unknown result type (might be due to invalid IL or missing references)
     //IL_003e: Invalid comparison between Unknown and I4
     //IL_0040: Unknown result type (might be due to invalid IL or missing references)
     //IL_0046: Invalid comparison between Unknown and I4
     //IL_0048: Unknown result type (might be due to invalid IL or missing references)
     //IL_004e: Invalid comparison between Unknown and I4
     //IL_0053: Unknown result type (might be due to invalid IL or missing references)
     //IL_005d: Expected O, but got Unknown
     //IL_0060: Unknown result type (might be due to invalid IL or missing references)
     //IL_006a: Expected O, but got Unknown
     //IL_006d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0077: Expected O, but got Unknown
     WeGameHelper.WriteDebugString("OnRailEvent,id=" + ((object)(RAILEventID)(event_id)).ToString() + " ,result=" + ((object)(RailResult)(data.result)).ToString());
     if ((int)event_id != 3006)
     {
         if ((int)event_id != 16001)
         {
             if ((int)event_id == 16002)
             {
                 OnCreateSessionFailed((CreateSessionFailed)data);
             }
         }
         else
         {
             OnCreateSessionRequest((CreateSessionRequest)data);
         }
     }
     else
     {
         UpdateUserStateBySessionAuthResult((GameServerStartSessionWithPlayerResponse)data);
     }
 }
Esempio n. 9
0
        protected virtual bool BeginReadData()
        {
            bool       result     = false;
            IPCContent iPCContent = new IPCContent
            {
                data        = new byte[BufferSize],
                CancelToken = _cancelTokenSrc.Token
            };

            WeGameHelper.WriteDebugString("BeginReadData");
            try
            {
                if (_pipeStream == null)
                {
                    return(result);
                }
                _pipeStream.BeginRead(iPCContent.data, 0, BufferSize, ReadCallback, iPCContent);
                result = true;
                return(result);
            }
            catch (IOException ex)
            {
                _pipeBrokenFlag = true;
                WeGameHelper.WriteDebugString("BeginReadData Exception, {0}", ex.Message);
                return(result);
            }
        }
		public override string GetUsername()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			string text = default(string);
			rail_api.RailFactory().RailPlayer().GetPlayerName(out text);
			WeGameHelper.WriteDebugString("GetUsername by wegame" + text);
			return text;
		}
Esempio n. 11
0
        public override string GetUsername()
        {
            string str;

            rail_api.RailFactory().RailPlayer().GetPlayerName(ref str);
            WeGameHelper.WriteDebugString("GetUsername by wegame" + str);
            return(str);
        }
Esempio n. 12
0
 public void OnRailEvent(RAILEventID id, EventBase data)
 {
     WeGameHelper.WriteDebugString("OnRailEvent,id=" + id.ToString() + " ,result=" + data.result.ToString());
     if ((int)id != 3002)
     {
         return;
     }
     this.OnGameServerCreated((CreateGameServerResult)data);
 }
Esempio n. 13
0
 protected bool GetSessionState(RailID userId, RailNetworkSessionState state)
 {
     if (rail_api.RailFactory().RailNetworkHelper().GetSessionState(userId, state) == null)
     {
         return(true);
     }
     WeGameHelper.WriteDebugString("GetSessionState Failed user:{0}", (object)(ulong)((RailComparableID)userId).id_);
     return(false);
 }
Esempio n. 14
0
 private void OnRailCreateSessionRequest(CreateSessionRequest result)
 {
     WeGameHelper.WriteDebugString(nameof(OnRailCreateSessionRequest));
     if (!this._connectionStateMap.ContainsKey((RailID)result.remote_peer) || this._connectionStateMap[(RailID)result.remote_peer] == NetSocialModule.ConnectionState.Inactive)
     {
         return;
     }
     WeGameHelper.WriteDebugString("AcceptSessionRequest, local{0}, remote:{1}", (object)(ulong)((RailComparableID)result.local_peer).id_, (object)(ulong)((RailComparableID)result.remote_peer).id_);
     rail_api.RailFactory().RailNetworkHelper().AcceptSessionRequest((RailID)result.local_peer, (RailID)result.remote_peer);
 }
Esempio n. 15
0
 private void OnRailCreateSessionRequest(CreateSessionRequest result)
 {
     //IL_0082: Unknown result type (might be due to invalid IL or missing references)
     WeGameHelper.WriteDebugString("OnRailCreateSessionRequest");
     if (_connectionStateMap.ContainsKey(result.remote_peer) && _connectionStateMap[result.remote_peer] != 0)
     {
         WeGameHelper.WriteDebugString("AcceptSessionRequest, local{0}, remote:{1}", ((RailComparableID)result.local_peer).id_, ((RailComparableID)result.remote_peer).id_);
         rail_api.RailFactory().RailNetworkHelper().AcceptSessionRequest(result.local_peer, result.remote_peer);
     }
 }
Esempio n. 16
0
 public void OnConnected()
 {
     this._serverConnected = true;
     if (this._ipcConnetedAction != null)
     {
         this._ipcConnetedAction();
     }
     this._ipcConnetedAction = (Action)null;
     WeGameHelper.WriteDebugString("IPC connected");
 }
Esempio n. 17
0
 public void Join(RailID local_peer, RailID remote_peer)
 {
     if (State != 0)
     {
         WeGameHelper.WriteDebugString("Lobby connection attempted while already in a lobby. This should never happen?");
     }
     else
     {
         State = LobbyState.Connecting;
     }
 }
Esempio n. 18
0
 public void OnRailEvent(RAILEventID id, EventBase data)
 {
     //IL_0038: Unknown result type (might be due to invalid IL or missing references)
     //IL_003e: Invalid comparison between Unknown and I4
     //IL_0042: Unknown result type (might be due to invalid IL or missing references)
     //IL_004c: Expected O, but got Unknown
     WeGameHelper.WriteDebugString("OnRailEvent,id=" + ((object)(RAILEventID)(ref id)).ToString() + " ,result=" + ((object)(RailResult)(ref data.result)).ToString());
     if ((int)id == 3002)
     {
         OnGameServerCreated((CreateGameServerResult)(object)(CreateGameServerResult)data);
     }
 }
Esempio n. 19
0
        protected bool GetSessionState(RailID userId, RailNetworkSessionState state)
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            IRailNetwork val = rail_api.RailFactory().RailNetworkHelper();

            if ((int)val.GetSessionState(userId, state) != 0)
            {
                WeGameHelper.WriteDebugString("GetSessionState Failed user:{0}", ((RailComparableID)userId).id_);
                return(false);
            }
            return(true);
        }
 private void CloseAndUpdateUserState(RailID remote_peer)
 {
     if (_connectionStateMap.ContainsKey(remote_peer))
     {
         WeGameHelper.WriteDebugString("CloseAndUpdateUserState, remote:{0}", ((RailComparableID)remote_peer).id_);
         TerminateRemotePlayerSession(remote_peer);
         CloseNetWorkSession(remote_peer);
         _connectionStateMap[remote_peer] = ConnectionState.Inactive;
         _reader.ClearUser(remote_peer);
         _writer.ClearUser(remote_peer);
     }
 }
Esempio n. 21
0
 public void OnRailEvent(RAILEventID id, EventBase data)
 {
     WeGameHelper.WriteDebugString("OnRailEvent,id=" + id.ToString() + " ,result=" + data.result.ToString());
     if (id <= 12010)
     {
         if (id != 12002)
         {
             if (id != 12003)
             {
                 if (id != 12010)
                 {
                     return;
                 }
                 this.OnFriendlistChange((RailFriendsListChanged)data);
             }
             else
             {
                 this.OnGetFriendMetaData((RailFriendsGetMetadataResult)data);
             }
         }
         else
         {
             this.OnRailSetMetaData((RailFriendsSetMetadataResult)data);
         }
     }
     else if (id <= 13503)
     {
         if (id != 13501)
         {
             if (id != 13503)
             {
                 return;
             }
             this.OnRailRespondInvation((RailUsersRespondInvitation)data);
         }
         else
         {
             this.OnRailGetUsersInfo((RailUsersInfoData)data);
         }
     }
     else if (id != 16001)
     {
         if (id != 16002)
         {
             return;
         }
         this.OnRailCreateSessionFailed((CreateSessionFailed)data);
     }
     else
     {
         this.OnRailCreateSessionRequest((CreateSessionRequest)data);
     }
 }
Esempio n. 22
0
        private void JoinServer(RailID server_id)
        {
            WeGameHelper.WriteDebugString("JoinServer:{0}", (object)(ulong)((RailComparableID)server_id).id_);
            this._connectionStateMap[server_id] = NetSocialModule.ConnectionState.Authenticating;
            int length = 3;

            byte[] numArray = new byte[length];
            numArray[0] = (byte)(length & (int)byte.MaxValue);
            numArray[1] = (byte)(length >> 8 & (int)byte.MaxValue);
            numArray[2] = (byte)93;
            rail_api.RailFactory().RailNetworkHelper().SendReliableData(this.GetLocalPeer(), server_id, numArray, (uint)length);
        }
Esempio n. 23
0
 private void Close(RailID remote_peer)
 {
     if (!this._connectionStateMap.ContainsKey(remote_peer))
     {
         return;
     }
     WeGameHelper.WriteDebugString("CloseRemotePeer, remote:{0}", (object)(ulong)((RailComparableID)remote_peer).id_);
     rail_api.RailFactory().RailNetworkHelper().CloseSession(this.GetLocalPeer(), remote_peer);
     this._connectionStateMap[remote_peer] = NetSocialModule.ConnectionState.Inactive;
     this._lobby.Leave();
     this._reader.ClearUser(remote_peer);
     this._writer.ClearUser(remote_peer);
 }
Esempio n. 24
0
        private void JoinServer(RailID server_id)
        {
            //IL_0064: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString("JoinServer:{0}", ((RailComparableID)server_id).id_);
            _connectionStateMap[server_id] = ConnectionState.Authenticating;
            int num = 3;

            byte[] array = new byte[num];
            array[0] = (byte)(num & 0xFF);
            array[1] = (byte)((num >> 8) & 0xFF);
            array[2] = 93;
            rail_api.RailFactory().RailNetworkHelper().SendReliableData(GetLocalPeer(), server_id, array, (uint)num);
        }
Esempio n. 25
0
 private void Close(RailID remote_peer)
 {
     //IL_003e: Unknown result type (might be due to invalid IL or missing references)
     if (_connectionStateMap.ContainsKey(remote_peer))
     {
         WeGameHelper.WriteDebugString("CloseRemotePeer, remote:{0}", ((RailComparableID)remote_peer).id_);
         rail_api.RailFactory().RailNetworkHelper().CloseSession(GetLocalPeer(), remote_peer);
         _connectionStateMap[remote_peer] = ConnectionState.Inactive;
         _lobby.Leave();
         _reader.ClearUser(remote_peer);
         _writer.ClearUser(remote_peer);
     }
 }
Esempio n. 26
0
 private void CloseAndUpdateUserState(RailID remote_peer)
 {
     if (!this._connectionStateMap.ContainsKey(remote_peer))
     {
         return;
     }
     WeGameHelper.WriteDebugString("CloseAndUpdateUserState, remote:{0}", (object)(ulong)((RailComparableID)remote_peer).id_);
     this.TerminateRemotePlayerSession(remote_peer);
     this.CloseNetWorkSession(remote_peer);
     this._connectionStateMap[remote_peer] = NetSocialModule.ConnectionState.Inactive;
     this._reader.ClearUser(remote_peer);
     this._writer.ClearUser(remote_peer);
 }
Esempio n. 27
0
        public override void ReadCallback(IAsyncResult result)
        {
            IPCContent obj = (IPCContent)result.AsyncState;

            base.ReadCallback(result);
            if (!obj.CancelToken.IsCancellationRequested)
            {
                ContinueReadOrWait();
            }
            else
            {
                WeGameHelper.WriteDebugString("servcer.ReadCallback cancel");
            }
        }
        private bool AcceptAnUserSession(RailID local_peer, RailID remote_peer)
        {
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_0049: Invalid comparison between Unknown and I4
            bool result = false;

            WeGameHelper.WriteDebugString("AcceptAnUserSession server:" + ((RailComparableID)local_peer).id_ + " remote:" + ((RailComparableID)remote_peer).id_);
            IRailNetwork val = rail_api.RailFactory().RailNetworkHelper();

            if (val != null)
            {
                result = (int)val.AcceptSessionRequest(local_peer, remote_peer) == 0;
            }
            return(result);
        }
Esempio n. 29
0
 protected virtual void SendCallback(IAsyncResult result)
 {
     try
     {
         if (_pipeStream != null)
         {
             _pipeStream.EndWrite(result);
         }
     }
     catch (IOException ex)
     {
         _pipeBrokenFlag = true;
         WeGameHelper.WriteDebugString("SendCallback Exception, {0}", ex.Message);
     }
 }
Esempio n. 30
0
        private bool AcceptAnUserSession(RailID local_peer, RailID remote_peer)
        {
            bool flag = false;

            // ISSUE: explicit non-virtual call
            // ISSUE: explicit non-virtual call
            WeGameHelper.WriteDebugString("AcceptAnUserSession server:" + (((RailComparableID)local_peer).id_.ToString()) + " remote:" + (((RailComparableID)remote_peer).id_.ToString()));
            IRailNetwork irailNetwork = rail_api.RailFactory().RailNetworkHelper();

            if (irailNetwork != null)
            {
                flag = irailNetwork.AcceptSessionRequest(local_peer, remote_peer) == 0;
            }
            return(flag);
        }