public bool DoConnect(string strURL, int iPort) { unsafe { bool flag; SteamClient.Needed(); NetCull.config.timeoutDelay = 60f; if (ClientConnect.Steam_GetSteamID() == 0) { LoadingScreen.Update("connection failed (no steam detected)"); UnityEngine.Object.Destroy(base.gameObject); return(false); } byte[] numArray = new byte[1024]; IntPtr intPtr = Marshal.AllocHGlobal(1024); uint num = ClientConnect.SteamClient_GetAuth(intPtr, 1024); byte[] numArray1 = new byte[num]; Marshal.Copy(intPtr, numArray1, 0, (int)num); Marshal.FreeHGlobal(intPtr); uLink.BitStream bitStream = new uLink.BitStream(false); bitStream.WriteInt32(1069); bitStream.WriteByte(2); bitStream.WriteUInt64(ClientConnect.Steam_GetSteamID()); bitStream.WriteString(Marshal.PtrToStringAnsi(ClientConnect.Steam_GetDisplayname())); bitStream.WriteBytes(numArray1); try { NetError netError = NetCull.Connect(strURL, iPort, string.Empty, new object[] { bitStream }); if (netError == NetError.NoError) { SteamClient.SteamClient_OnJoinServer(strURL, iPort); return(true); } else { LoadingScreen.Update(string.Concat("connection failed (", netError, ")")); UnityEngine.Object.Destroy(base.gameObject); flag = false; } } catch (Exception exception) { UnityEngine.Debug.LogException(exception); UnityEngine.Object.Destroy(base.gameObject); flag = false; } return(flag); } }
public bool DoConnect(string strURL, int iPort) { SteamClient.Needed(); NetCull.config.timeoutDelay = 60f; if (Steam_GetSteamID() == 0) { LoadingScreen.Update("connection failed (no steam detected)"); Object.Destroy(base.gameObject); return(false); } byte[] buffer = new byte[0x400]; IntPtr pData = Marshal.AllocHGlobal(0x400); uint num2 = SteamClient_GetAuth(pData, 0x400); byte[] destination = new byte[num2]; Marshal.Copy(pData, destination, 0, (int)num2); Marshal.FreeHGlobal(pData); BitStream stream = new BitStream(false); stream.WriteInt32(0x42d); stream.WriteByte(2); stream.WriteUInt64(Steam_GetSteamID()); stream.WriteString(Marshal.PtrToStringAnsi(Steam_GetDisplayname())); stream.WriteBytes(destination); try { object[] loginData = new object[] { stream }; NetError error = NetCull.Connect(strURL, iPort, string.Empty, loginData); if (error != NetError.NoError) { LoadingScreen.Update("connection failed (" + error + ")"); Object.Destroy(base.gameObject); return(false); } } catch (Exception exception) { Debug.LogException(exception); Object.Destroy(base.gameObject); return(false); } FeedbackLog.Start(FeedbackLog.TYPE.StartConnect); FeedbackLog.Writer.Write(strURL); FeedbackLog.Writer.Write(iPort); FeedbackLog.End(FeedbackLog.TYPE.StartConnect); SteamClient.SteamClient_OnJoinServer(strURL, iPort); return(true); }