Esempio n. 1
0
 private void Connect()
 {
     if (CoopPeerStarter.Dedicated)
     {
         Debug.LogFormat("connecting to: {0}", new object[]
         {
             SteamClientDSConfig.serverAddress
         });
         int num = SteamUser.InitiateGameConnection(SteamClientDSConfig.steamClientBlob, 2048, SteamClientDSConfig.Server.m_steamID, SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port, SteamClientDSConfig.Server.m_bSecure);
         CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = new CoopJoinDedicatedServerToken();
         coopJoinDedicatedServerToken.AdminPassword  = SteamClientDSConfig.adminPassword;
         coopJoinDedicatedServerToken.ServerPassword = SteamClientDSConfig.password;
         if (num > 0)
         {
             coopJoinDedicatedServerToken.steamBlobToken = new byte[num];
             for (int i = 0; i < num; i++)
             {
                 coopJoinDedicatedServerToken.steamBlobToken[i] = SteamClientDSConfig.steamClientBlob[i];
             }
         }
         BoltNetwork.Connect(SteamClientDSConfig.EndPoint, coopJoinDedicatedServerToken);
     }
     else
     {
         BoltNetwork.Connect(CoopLobby.Instance.Info.ServerId.ToEndPoint());
     }
 }
Esempio n. 2
0
 public override void Connected(BoltConnection connection)
 {
     connection.SetCanReceiveEntities(false);
     if (CoopPeerStarter.DedicatedHost)
     {
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.ServerPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken != null && coopJoinDedicatedServerToken.ServerPassword != CoopDedicatedServerStarter.ServerPassword)
             {
                 connection.Disconnect(new CoopJoinDedicatedServerFailed
                 {
                     Error = "Incorrect server password"
                 });
                 return;
             }
         }
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.AdminPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken2 = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken2 != null && coopJoinDedicatedServerToken2.AdminPassword == CoopDedicatedServerStarter.AdminPassword)
             {
                 AdminAuthed adminAuthed = AdminAuthed.Create(connection);
                 adminAuthed.IsAdmin = true;
                 adminAuthed.Send();
             }
         }
     }
 }
Esempio n. 3
0
    public static bool IsDedicatedServerAdmin(this BoltConnection connection)
    {
        if (connection == null)
        {
            return(false);
        }
        CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = connection.ConnectToken as CoopJoinDedicatedServerToken;

        return(coopJoinDedicatedServerToken != null && !string.IsNullOrEmpty(coopJoinDedicatedServerToken.AdminPassword) && !string.IsNullOrEmpty(SteamDSConfig.ServerAdminPassword) && coopJoinDedicatedServerToken.AdminPassword == SteamDSConfig.ServerAdminPassword);
    }