Files
2026-06-04 11:42:34 +02:00

1000 lines
27 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using ExitGames.Client.Photon.EncryptorManaged;
namespace ExitGames.Client.Photon
{
// Token: 0x02000010 RID: 16
public class PhotonPeer
{
// Token: 0x17000010 RID: 16
// (get) Token: 0x060000A1 RID: 161 RVA: 0x00007B64 File Offset: 0x00005D64
protected internal byte ClientSdkIdShifted
{
get
{
byte b = 0;
return (byte)(((int)this.ClientSdkId << 1) | (int)b);
}
}
// Token: 0x17000011 RID: 17
// (get) Token: 0x060000A2 RID: 162 RVA: 0x00007B84 File Offset: 0x00005D84
public string ClientVersion
{
get
{
bool flag = string.IsNullOrEmpty(this.clientVersion);
if (flag)
{
this.clientVersion = string.Format("{0}.{1}.{2}.{3}", new object[]
{
Version.clientVersion[0],
Version.clientVersion[1],
Version.clientVersion[2],
Version.clientVersion[3]
});
}
return this.clientVersion;
}
}
// Token: 0x17000012 RID: 18
// (get) Token: 0x060000A3 RID: 163 RVA: 0x00007BFF File Offset: 0x00005DFF
// (set) Token: 0x060000A4 RID: 164 RVA: 0x00007C07 File Offset: 0x00005E07
public SerializationProtocol SerializationProtocolType { get; set; }
// Token: 0x17000013 RID: 19
// (get) Token: 0x060000A5 RID: 165 RVA: 0x00007C10 File Offset: 0x00005E10
// (set) Token: 0x060000A6 RID: 166 RVA: 0x00007C18 File Offset: 0x00005E18
public Type SocketImplementation { get; internal set; }
// Token: 0x17000014 RID: 20
// (get) Token: 0x060000A7 RID: 167 RVA: 0x00007C21 File Offset: 0x00005E21
// (set) Token: 0x060000A8 RID: 168 RVA: 0x00007C29 File Offset: 0x00005E29
public IPhotonPeerListener Listener { get; protected set; }
// Token: 0x17000015 RID: 21
// (get) Token: 0x060000A9 RID: 169 RVA: 0x00007C34 File Offset: 0x00005E34
public long BytesIn
{
get
{
return this.peerBase.BytesIn;
}
}
// Token: 0x17000016 RID: 22
// (get) Token: 0x060000AA RID: 170 RVA: 0x00007C54 File Offset: 0x00005E54
public long BytesOut
{
get
{
return this.peerBase.BytesOut;
}
}
// Token: 0x17000017 RID: 23
// (get) Token: 0x060000AB RID: 171 RVA: 0x00007C74 File Offset: 0x00005E74
public int ByteCountCurrentDispatch
{
get
{
return this.peerBase.ByteCountCurrentDispatch;
}
}
// Token: 0x17000018 RID: 24
// (get) Token: 0x060000AC RID: 172 RVA: 0x00007C94 File Offset: 0x00005E94
public string CommandInfoCurrentDispatch
{
get
{
return (this.peerBase.CommandInCurrentDispatch != null) ? this.peerBase.CommandInCurrentDispatch.ToString() : string.Empty;
}
}
// Token: 0x17000019 RID: 25
// (get) Token: 0x060000AD RID: 173 RVA: 0x00007CCC File Offset: 0x00005ECC
public int ByteCountLastOperation
{
get
{
return this.peerBase.ByteCountLastOperation;
}
}
// Token: 0x1700001A RID: 26
// (get) Token: 0x060000AE RID: 174 RVA: 0x00007CE9 File Offset: 0x00005EE9
// (set) Token: 0x060000AF RID: 175 RVA: 0x00007CF1 File Offset: 0x00005EF1
public TrafficStats TrafficStatsIncoming { get; internal set; }
// Token: 0x1700001B RID: 27
// (get) Token: 0x060000B0 RID: 176 RVA: 0x00007CFA File Offset: 0x00005EFA
// (set) Token: 0x060000B1 RID: 177 RVA: 0x00007D02 File Offset: 0x00005F02
public TrafficStats TrafficStatsOutgoing { get; internal set; }
// Token: 0x1700001C RID: 28
// (get) Token: 0x060000B2 RID: 178 RVA: 0x00007D0B File Offset: 0x00005F0B
// (set) Token: 0x060000B3 RID: 179 RVA: 0x00007D13 File Offset: 0x00005F13
public TrafficStatsGameLevel TrafficStatsGameLevel { get; internal set; }
// Token: 0x1700001D RID: 29
// (get) Token: 0x060000B4 RID: 180 RVA: 0x00007D1C File Offset: 0x00005F1C
public long TrafficStatsElapsedMs
{
get
{
return (this.trafficStatsStopwatch != null) ? this.trafficStatsStopwatch.ElapsedMilliseconds : 0L;
}
}
// Token: 0x1700001E RID: 30
// (get) Token: 0x060000B5 RID: 181 RVA: 0x00007D48 File Offset: 0x00005F48
// (set) Token: 0x060000B6 RID: 182 RVA: 0x00007D60 File Offset: 0x00005F60
public bool TrafficStatsEnabled
{
get
{
return this.trafficStatsEnabled;
}
set
{
bool flag = this.trafficStatsEnabled == value;
if (!flag)
{
this.trafficStatsEnabled = value;
if (value)
{
bool flag2 = this.trafficStatsStopwatch == null;
if (flag2)
{
this.InitializeTrafficStats();
}
this.trafficStatsStopwatch.Start();
}
else
{
bool flag3 = this.trafficStatsStopwatch != null;
if (flag3)
{
this.trafficStatsStopwatch.Stop();
}
}
}
}
}
// Token: 0x060000B7 RID: 183 RVA: 0x00007DCB File Offset: 0x00005FCB
public void TrafficStatsReset()
{
this.TrafficStatsEnabled = false;
this.InitializeTrafficStats();
this.TrafficStatsEnabled = true;
}
// Token: 0x060000B8 RID: 184 RVA: 0x00007DE8 File Offset: 0x00005FE8
internal void InitializeTrafficStats()
{
this.TrafficStatsIncoming = new TrafficStats(this.peerBase.TrafficPackageHeaderSize);
this.TrafficStatsOutgoing = new TrafficStats(this.peerBase.TrafficPackageHeaderSize);
this.TrafficStatsGameLevel = new TrafficStatsGameLevel();
this.trafficStatsStopwatch = new Stopwatch();
}
// Token: 0x1700001F RID: 31
// (get) Token: 0x060000B9 RID: 185 RVA: 0x00007E3C File Offset: 0x0000603C
// (set) Token: 0x060000BA RID: 186 RVA: 0x00007E54 File Offset: 0x00006054
public int CommandLogSize
{
get
{
return this.commandLogSize;
}
set
{
this.commandLogSize = value;
this.peerBase.CommandLogResize();
}
}
// Token: 0x060000BB RID: 187 RVA: 0x00007E6C File Offset: 0x0000606C
public string CommandLogToString()
{
return this.peerBase.CommandLogToString();
}
// Token: 0x17000020 RID: 32
// (get) Token: 0x060000BC RID: 188 RVA: 0x00007E89 File Offset: 0x00006089
// (set) Token: 0x060000BD RID: 189 RVA: 0x00007E91 File Offset: 0x00006091
public bool EnableServerTracing { get; set; }
// Token: 0x17000021 RID: 33
// (get) Token: 0x060000BE RID: 190 RVA: 0x00007E9C File Offset: 0x0000609C
// (set) Token: 0x060000BF RID: 191 RVA: 0x00007EB4 File Offset: 0x000060B4
public byte QuickResendAttempts
{
get
{
return this.quickResendAttempts;
}
set
{
this.quickResendAttempts = value;
bool flag = this.quickResendAttempts > 4;
if (flag)
{
this.quickResendAttempts = 4;
}
}
}
// Token: 0x17000022 RID: 34
// (get) Token: 0x060000C0 RID: 192 RVA: 0x00007EE0 File Offset: 0x000060E0
public PeerStateValue PeerState
{
get
{
bool flag = this.peerBase.peerConnectionState == PeerBase.ConnectionStateValue.Connected && !this.peerBase.ApplicationIsInitialized;
PeerStateValue peerStateValue;
if (flag)
{
peerStateValue = PeerStateValue.InitializingApplication;
}
else
{
peerStateValue = (PeerStateValue)this.peerBase.peerConnectionState;
}
return peerStateValue;
}
}
// Token: 0x17000023 RID: 35
// (get) Token: 0x060000C1 RID: 193 RVA: 0x00007F28 File Offset: 0x00006128
public string PeerID
{
get
{
return this.peerBase.PeerID;
}
}
// Token: 0x17000024 RID: 36
// (get) Token: 0x060000C2 RID: 194 RVA: 0x00007F48 File Offset: 0x00006148
public int CommandBufferSize
{
get
{
return this.peerBase.commandBufferSize;
}
}
// Token: 0x17000025 RID: 37
// (get) Token: 0x060000C3 RID: 195 RVA: 0x00007F65 File Offset: 0x00006165
// (set) Token: 0x060000C4 RID: 196 RVA: 0x00007F6D File Offset: 0x0000616D
public int LimitOfUnreliableCommands { get; set; }
// Token: 0x17000026 RID: 38
// (get) Token: 0x060000C5 RID: 197 RVA: 0x00007F78 File Offset: 0x00006178
public int QueuedIncomingCommands
{
get
{
return this.peerBase.QueuedIncomingCommandsCount;
}
}
// Token: 0x17000027 RID: 39
// (get) Token: 0x060000C6 RID: 198 RVA: 0x00007F98 File Offset: 0x00006198
public int QueuedOutgoingCommands
{
get
{
return this.peerBase.QueuedOutgoingCommandsCount;
}
}
// Token: 0x17000028 RID: 40
// (get) Token: 0x060000C7 RID: 199 RVA: 0x00007FB8 File Offset: 0x000061B8
// (set) Token: 0x060000C8 RID: 200 RVA: 0x00007FD0 File Offset: 0x000061D0
public bool CrcEnabled
{
get
{
return this.crcEnabled;
}
set
{
bool flag = this.crcEnabled == value;
if (!flag)
{
bool flag2 = this.peerBase.peerConnectionState > PeerBase.ConnectionStateValue.Disconnected;
if (flag2)
{
throw new Exception("CrcEnabled can only be set while disconnected.");
}
this.crcEnabled = value;
}
}
}
// Token: 0x17000029 RID: 41
// (get) Token: 0x060000C9 RID: 201 RVA: 0x00008014 File Offset: 0x00006214
public int PacketLossByCrc
{
get
{
return this.peerBase.packetLossByCrc;
}
}
// Token: 0x1700002A RID: 42
// (get) Token: 0x060000CA RID: 202 RVA: 0x00008034 File Offset: 0x00006234
public int PacketLossByChallenge
{
get
{
return this.peerBase.packetLossByChallenge;
}
}
// Token: 0x1700002B RID: 43
// (get) Token: 0x060000CB RID: 203 RVA: 0x00008054 File Offset: 0x00006254
public int ResentReliableCommands
{
get
{
return (this.UsedProtocol != ConnectionProtocol.Udp) ? 0 : ((EnetPeer)this.peerBase).reliableCommandsRepeated;
}
}
// Token: 0x1700002C RID: 44
// (get) Token: 0x060000CC RID: 204 RVA: 0x00008084 File Offset: 0x00006284
public int ServerTimeInMilliSeconds
{
get
{
return this.peerBase.serverTimeOffsetIsAvailable ? (this.peerBase.serverTimeOffset + SupportClass.GetTickCount()) : 0;
}
}
// Token: 0x1700002D RID: 45
// (get) Token: 0x060000CD RID: 205 RVA: 0x000080B8 File Offset: 0x000062B8
public int ConnectionTime
{
get
{
return this.peerBase.timeInt;
}
}
// Token: 0x1700002E RID: 46
// (get) Token: 0x060000CE RID: 206 RVA: 0x000080D8 File Offset: 0x000062D8
public int LastSendAckTime
{
get
{
return this.peerBase.timeLastSendAck;
}
}
// Token: 0x1700002F RID: 47
// (get) Token: 0x060000CF RID: 207 RVA: 0x000080F8 File Offset: 0x000062F8
public int LastSendOutgoingTime
{
get
{
return this.peerBase.timeLastSendOutgoing;
}
}
// Token: 0x17000030 RID: 48
// (get) Token: 0x060000D0 RID: 208 RVA: 0x00008118 File Offset: 0x00006318
[Obsolete("Should be replaced by: SupportClass.GetTickCount(). Internally this is used, too.")]
public int LocalTimeInMilliSeconds
{
get
{
return SupportClass.GetTickCount();
}
}
// Token: 0x17000031 RID: 49
// (set) Token: 0x060000D1 RID: 209 RVA: 0x00008130 File Offset: 0x00006330
public SupportClass.IntegerMillisecondsDelegate LocalMsTimestampDelegate
{
set
{
bool flag = this.PeerState > PeerStateValue.Disconnected;
if (flag)
{
throw new Exception("LocalMsTimestampDelegate only settable while disconnected. State: " + this.PeerState);
}
SupportClass.IntegerMilliseconds = value;
}
}
// Token: 0x17000032 RID: 50
// (get) Token: 0x060000D2 RID: 210 RVA: 0x00008170 File Offset: 0x00006370
public int RoundTripTime
{
get
{
return this.peerBase.roundTripTime;
}
}
// Token: 0x17000033 RID: 51
// (get) Token: 0x060000D3 RID: 211 RVA: 0x00008190 File Offset: 0x00006390
public int RoundTripTimeVariance
{
get
{
return this.peerBase.roundTripTimeVariance;
}
}
// Token: 0x17000034 RID: 52
// (get) Token: 0x060000D4 RID: 212 RVA: 0x000081B0 File Offset: 0x000063B0
public int TimestampOfLastSocketReceive
{
get
{
return this.peerBase.timestampOfLastReceive;
}
}
// Token: 0x17000035 RID: 53
// (get) Token: 0x060000D5 RID: 213 RVA: 0x000081D0 File Offset: 0x000063D0
// (set) Token: 0x060000D6 RID: 214 RVA: 0x000081F0 File Offset: 0x000063F0
public string ServerAddress
{
get
{
return this.peerBase.ServerAddress;
}
set
{
bool flag = this.DebugOut >= DebugLevel.ERROR;
if (flag)
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Failed to set ServerAddress. Can be set only when using HTTP.");
}
}
}
// Token: 0x17000036 RID: 54
// (get) Token: 0x060000D7 RID: 215 RVA: 0x00008224 File Offset: 0x00006424
public ConnectionProtocol UsedProtocol
{
get
{
return this.peerBase.usedProtocol;
}
}
// Token: 0x17000037 RID: 55
// (get) Token: 0x060000D8 RID: 216 RVA: 0x00008241 File Offset: 0x00006441
// (set) Token: 0x060000D9 RID: 217 RVA: 0x00008249 File Offset: 0x00006449
public ConnectionProtocol TransportProtocol { get; set; }
// Token: 0x17000038 RID: 56
// (get) Token: 0x060000DA RID: 218 RVA: 0x00008254 File Offset: 0x00006454
// (set) Token: 0x060000DB RID: 219 RVA: 0x00008274 File Offset: 0x00006474
public virtual bool IsSimulationEnabled
{
get
{
return this.NetworkSimulationSettings.IsSimulationEnabled;
}
set
{
bool flag = value == this.NetworkSimulationSettings.IsSimulationEnabled;
if (!flag)
{
object sendOutgoingLockObject = this.SendOutgoingLockObject;
lock (sendOutgoingLockObject)
{
this.NetworkSimulationSettings.IsSimulationEnabled = value;
}
}
}
}
// Token: 0x17000039 RID: 57
// (get) Token: 0x060000DC RID: 220 RVA: 0x000082D0 File Offset: 0x000064D0
public NetworkSimulationSet NetworkSimulationSettings
{
get
{
return this.peerBase.NetworkSimulationSettings;
}
}
// Token: 0x1700003A RID: 58
// (get) Token: 0x060000DD RID: 221 RVA: 0x000082F0 File Offset: 0x000064F0
// (set) Token: 0x060000DE RID: 222 RVA: 0x00008308 File Offset: 0x00006508
public int MaximumTransferUnit
{
get
{
return this.mtu;
}
set
{
bool flag = this.PeerState > PeerStateValue.Disconnected;
if (flag)
{
throw new Exception("MaximumTransferUnit is only settable while disconnected. State: " + this.PeerState);
}
bool flag2 = value < 576;
if (flag2)
{
value = 576;
}
this.mtu = value;
}
}
// Token: 0x1700003B RID: 59
// (get) Token: 0x060000DF RID: 223 RVA: 0x0000835C File Offset: 0x0000655C
public bool IsEncryptionAvailable
{
get
{
return this.peerBase.isEncryptionAvailable;
}
}
// Token: 0x1700003C RID: 60
// (get) Token: 0x060000E0 RID: 224 RVA: 0x00008379 File Offset: 0x00006579
// (set) Token: 0x060000E1 RID: 225 RVA: 0x00008381 File Offset: 0x00006581
public bool IsSendingOnlyAcks { get; set; }
// Token: 0x060000E2 RID: 226 RVA: 0x0000838C File Offset: 0x0000658C
public PhotonPeer(ConnectionProtocol protocolType)
{
this.TransportProtocol = protocolType;
this.CreatePeerBase();
}
// Token: 0x060000E3 RID: 227 RVA: 0x00008424 File Offset: 0x00006624
public PhotonPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType)
: this(protocolType)
{
this.Listener = listener;
}
// Token: 0x060000E4 RID: 228 RVA: 0x00008438 File Offset: 0x00006638
public virtual bool Connect(string serverAddress, string applicationName)
{
return this.Connect(serverAddress, applicationName, null);
}
// Token: 0x060000E5 RID: 229 RVA: 0x00008454 File Offset: 0x00006654
public virtual bool Connect(string serverAddress, string applicationName, object custom)
{
object dispatchLockObject = this.DispatchLockObject;
bool flag2;
lock (dispatchLockObject)
{
object sendOutgoingLockObject = this.SendOutgoingLockObject;
lock (sendOutgoingLockObject)
{
this.CreatePeerBase();
bool flag = this.peerBase == null;
if (flag)
{
flag2 = false;
}
else
{
bool flag3 = this.peerBase.SocketImplementation == null;
if (flag3)
{
this.peerBase.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[]
{
"Connect failed. SocketImplementationConfig is null for protocol ",
this.TransportProtocol,
": ",
SupportClass.DictionaryToString(this.SocketImplementationConfig)
}));
flag2 = false;
}
else
{
this.peerBase.CustomInitData = custom;
this.peerBase.AppId = applicationName;
flag2 = this.peerBase.Connect(serverAddress, applicationName, custom);
}
}
}
}
return flag2;
}
// Token: 0x060000E6 RID: 230 RVA: 0x00008550 File Offset: 0x00006750
private void CreatePeerBase()
{
bool flag = this.SocketImplementationConfig == null;
if (flag)
{
this.SocketImplementationConfig = new Dictionary<ConnectionProtocol, Type>(5);
this.SocketImplementationConfig.Add(ConnectionProtocol.Udp, typeof(SocketUdp));
this.SocketImplementationConfig.Add(ConnectionProtocol.Tcp, typeof(SocketTcp));
}
switch (this.TransportProtocol)
{
case ConnectionProtocol.Tcp:
this.peerBase = new TPeer();
goto IL_9D;
case ConnectionProtocol.WebSocket:
case ConnectionProtocol.WebSocketSecure:
this.peerBase = new TPeer
{
DoFraming = false
};
goto IL_9D;
}
this.peerBase = new EnetPeer();
IL_9D:
bool flag2 = this.peerBase == null;
if (flag2)
{
throw new Exception("No PeerBase");
}
this.peerBase.ppeer = this;
this.peerBase.usedProtocol = this.TransportProtocol;
Type type = null;
this.SocketImplementationConfig.TryGetValue(this.TransportProtocol, out type);
this.SocketImplementation = type;
}
// Token: 0x060000E7 RID: 231 RVA: 0x00008650 File Offset: 0x00006850
public virtual void Disconnect()
{
object dispatchLockObject = this.DispatchLockObject;
lock (dispatchLockObject)
{
object sendOutgoingLockObject = this.SendOutgoingLockObject;
lock (sendOutgoingLockObject)
{
this.peerBase.Disconnect();
}
}
}
// Token: 0x060000E8 RID: 232 RVA: 0x000086BC File Offset: 0x000068BC
public virtual void StopThread()
{
object dispatchLockObject = this.DispatchLockObject;
lock (dispatchLockObject)
{
object sendOutgoingLockObject = this.SendOutgoingLockObject;
lock (sendOutgoingLockObject)
{
this.peerBase.StopConnection();
}
}
}
// Token: 0x060000E9 RID: 233 RVA: 0x00008728 File Offset: 0x00006928
public virtual void FetchServerTimestamp()
{
this.peerBase.FetchServerTimestamp();
}
// Token: 0x060000EA RID: 234 RVA: 0x00008738 File Offset: 0x00006938
public bool EstablishEncryption()
{
bool asyncKeyExchange = PhotonPeer.AsyncKeyExchange;
bool flag;
if (asyncKeyExchange)
{
SupportClass.CallInBackground(delegate
{
this.peerBase.ExchangeKeysForEncryption(this.SendOutgoingLockObject);
return false;
}, 100, "");
flag = true;
}
else
{
flag = this.peerBase.ExchangeKeysForEncryption(this.SendOutgoingLockObject);
}
return flag;
}
// Token: 0x060000EB RID: 235 RVA: 0x00008784 File Offset: 0x00006984
public bool InitDatagramEncryption(byte[] encryptionSecret, byte[] hmacSecret)
{
bool flag;
try
{
this.encryptor = new Encryptor();
this.encryptor.Init(encryptionSecret, hmacSecret);
this.decryptor = new Decryptor();
this.decryptor.Init(encryptionSecret, hmacSecret);
flag = true;
}
catch (Exception)
{
flag = false;
}
return flag;
}
// Token: 0x060000EC RID: 236 RVA: 0x000087E0 File Offset: 0x000069E0
public void InitPayloadEncryption(byte[] secret)
{
this.PayloadEncryptionSecret = secret;
}
// Token: 0x060000ED RID: 237 RVA: 0x000087EC File Offset: 0x000069EC
public virtual void Service()
{
while (this.DispatchIncomingCommands())
{
}
while (this.SendOutgoingCommands())
{
}
}
// Token: 0x060000EE RID: 238 RVA: 0x00008818 File Offset: 0x00006A18
public virtual bool SendOutgoingCommands()
{
bool flag = this.TrafficStatsEnabled;
if (flag)
{
this.TrafficStatsGameLevel.SendOutgoingCommandsCalled();
}
object sendOutgoingLockObject = this.SendOutgoingLockObject;
bool flag2;
lock (sendOutgoingLockObject)
{
flag2 = this.peerBase.SendOutgoingCommands();
}
return flag2;
}
// Token: 0x060000EF RID: 239 RVA: 0x00008874 File Offset: 0x00006A74
public virtual bool SendAcksOnly()
{
bool flag = this.TrafficStatsEnabled;
if (flag)
{
this.TrafficStatsGameLevel.SendOutgoingCommandsCalled();
}
object sendOutgoingLockObject = this.SendOutgoingLockObject;
bool flag2;
lock (sendOutgoingLockObject)
{
flag2 = this.peerBase.SendAcksOnly();
}
return flag2;
}
// Token: 0x060000F0 RID: 240 RVA: 0x000088D0 File Offset: 0x00006AD0
public virtual bool DispatchIncomingCommands()
{
bool flag = this.TrafficStatsEnabled;
if (flag)
{
this.TrafficStatsGameLevel.DispatchIncomingCommandsCalled();
}
object dispatchLockObject = this.DispatchLockObject;
bool flag2;
lock (dispatchLockObject)
{
this.peerBase.ByteCountCurrentDispatch = 0;
flag2 = this.peerBase.DispatchIncomingCommands();
}
return flag2;
}
// Token: 0x060000F1 RID: 241 RVA: 0x00008938 File Offset: 0x00006B38
public string VitalStatsToString(bool all)
{
bool flag = this.TrafficStatsGameLevel == null;
string text;
if (flag)
{
text = "Stats not available. Use PhotonPeer.TrafficStatsEnabled.";
}
else
{
bool flag2 = !all;
if (flag2)
{
text = string.Format("Rtt(variance): {0}({1}). Ms since last receive: {2}. Stats elapsed: {4}sec.\n{3}", new object[]
{
this.RoundTripTime,
this.RoundTripTimeVariance,
SupportClass.GetTickCount() - this.TimestampOfLastSocketReceive,
this.TrafficStatsGameLevel.ToStringVitalStats(),
this.TrafficStatsElapsedMs / 1000L
});
}
else
{
text = string.Format("Rtt(variance): {0}({1}). Ms since last receive: {2}. Stats elapsed: {6}sec.\n{3}\n{4}\n{5}", new object[]
{
this.RoundTripTime,
this.RoundTripTimeVariance,
SupportClass.GetTickCount() - this.TimestampOfLastSocketReceive,
this.TrafficStatsGameLevel.ToStringVitalStats(),
this.TrafficStatsIncoming.ToString(),
this.TrafficStatsOutgoing.ToString(),
this.TrafficStatsElapsedMs / 1000L
});
}
}
return text;
}
// Token: 0x060000F2 RID: 242 RVA: 0x00008A54 File Offset: 0x00006C54
public virtual bool OpCustom(byte customOpCode, Dictionary<byte, object> customOpParameters, bool sendReliable)
{
return this.OpCustom(customOpCode, customOpParameters, sendReliable, 0);
}
// Token: 0x060000F3 RID: 243 RVA: 0x00008A70 File Offset: 0x00006C70
public virtual bool OpCustom(byte customOpCode, Dictionary<byte, object> customOpParameters, bool sendReliable, byte channelId)
{
object enqueueLock = this.EnqueueLock;
bool flag;
lock (enqueueLock)
{
flag = this.peerBase.EnqueueOperation(customOpParameters, customOpCode, sendReliable, channelId, false);
}
return flag;
}
// Token: 0x060000F4 RID: 244 RVA: 0x00008ABC File Offset: 0x00006CBC
public virtual bool OpCustom(byte customOpCode, Dictionary<byte, object> customOpParameters, bool sendReliable, byte channelId, bool encrypt)
{
bool flag = this.peerBase.usedProtocol == ConnectionProtocol.WebSocketSecure;
if (flag)
{
encrypt = false;
}
bool flag2 = encrypt && !this.IsEncryptionAvailable;
if (flag2)
{
throw new ArgumentException("Can't use encryption yet. Exchange keys first.");
}
object enqueueLock = this.EnqueueLock;
bool flag3;
lock (enqueueLock)
{
flag3 = this.peerBase.EnqueueOperation(customOpParameters, customOpCode, sendReliable, channelId, encrypt);
}
return flag3;
}
// Token: 0x060000F5 RID: 245 RVA: 0x00008B3C File Offset: 0x00006D3C
public virtual bool OpCustom(OperationRequest operationRequest, bool sendReliable, byte channelId, bool encrypt)
{
bool flag = this.peerBase.usedProtocol == ConnectionProtocol.WebSocketSecure;
if (flag)
{
encrypt = false;
}
bool flag2 = encrypt && !this.IsEncryptionAvailable;
if (flag2)
{
throw new ArgumentException("Can't use encryption yet. Exchange keys first.");
}
object enqueueLock = this.EnqueueLock;
bool flag3;
lock (enqueueLock)
{
flag3 = this.peerBase.EnqueueOperation(operationRequest.Parameters, operationRequest.OperationCode, sendReliable, channelId, encrypt);
}
return flag3;
}
// Token: 0x060000F6 RID: 246 RVA: 0x00008BC8 File Offset: 0x00006DC8
public static bool RegisterType(Type customType, byte code, SerializeMethod serializeMethod, DeserializeMethod constructor)
{
return Protocol.TryRegisterType(customType, code, serializeMethod, constructor);
}
// Token: 0x060000F7 RID: 247 RVA: 0x00008BE4 File Offset: 0x00006DE4
public static bool RegisterType(Type customType, byte code, SerializeStreamMethod serializeMethod, DeserializeStreamMethod constructor)
{
return Protocol.TryRegisterType(customType, code, serializeMethod, constructor);
}
// Token: 0x0400003C RID: 60
public const bool NoSocket = false;
// Token: 0x0400003D RID: 61
public const bool NativeDatagramEncrypt = false;
// Token: 0x0400003E RID: 62
public const bool DebugBuild = true;
// Token: 0x0400003F RID: 63
protected internal byte ClientSdkId = 15;
// Token: 0x04000040 RID: 64
public static bool AsyncKeyExchange = false;
// Token: 0x04000041 RID: 65
private string clientVersion;
// Token: 0x04000043 RID: 67
public Dictionary<ConnectionProtocol, Type> SocketImplementationConfig;
// Token: 0x04000045 RID: 69
public DebugLevel DebugOut = DebugLevel.ERROR;
// Token: 0x0400004A RID: 74
private Stopwatch trafficStatsStopwatch;
// Token: 0x0400004B RID: 75
private bool trafficStatsEnabled = false;
// Token: 0x0400004C RID: 76
private int commandLogSize;
// Token: 0x0400004E RID: 78
private byte quickResendAttempts;
// Token: 0x0400004F RID: 79
public int RhttpMinConnections = 2;
// Token: 0x04000050 RID: 80
public int RhttpMaxConnections = 6;
// Token: 0x04000052 RID: 82
public byte ChannelCount = 2;
// Token: 0x04000053 RID: 83
private bool crcEnabled;
// Token: 0x04000054 RID: 84
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
public int WarningSize;
// Token: 0x04000055 RID: 85
public int SentCountAllowance = 7;
// Token: 0x04000056 RID: 86
public int TimePingInterval = 1000;
// Token: 0x04000057 RID: 87
public int DisconnectTimeout = 10000;
// Token: 0x04000059 RID: 89
public static int OutgoingStreamBufferSize = 1200;
// Token: 0x0400005A RID: 90
private int mtu = 1200;
// Token: 0x0400005C RID: 92
internal PeerBase peerBase;
// Token: 0x0400005D RID: 93
private readonly object SendOutgoingLockObject = new object();
// Token: 0x0400005E RID: 94
private readonly object DispatchLockObject = new object();
// Token: 0x0400005F RID: 95
private readonly object EnqueueLock = new object();
// Token: 0x04000060 RID: 96
protected internal byte[] PayloadEncryptionSecret;
// Token: 0x04000061 RID: 97
internal Encryptor encryptor;
// Token: 0x04000062 RID: 98
internal Decryptor decryptor;
}
}