scripts
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000013 RID: 19
|
||||
internal class CmdLogItem
|
||||
{
|
||||
// Token: 0x06000141 RID: 321 RVA: 0x0000A635 File Offset: 0x00008835
|
||||
public CmdLogItem()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000142 RID: 322 RVA: 0x0000A63F File Offset: 0x0000883F
|
||||
public CmdLogItem(NCommand command, int timeInt, int rtt, int variance)
|
||||
{
|
||||
this.Channel = (int)command.commandChannelID;
|
||||
this.SequenceNumber = command.reliableSequenceNumber;
|
||||
this.TimeInt = timeInt;
|
||||
this.Rtt = rtt;
|
||||
this.Variance = variance;
|
||||
}
|
||||
|
||||
// Token: 0x06000143 RID: 323 RVA: 0x0000A678 File Offset: 0x00008878
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("NOW: {0,5} CH: {1,3} SQ: {2,4} RTT: {3,4} VAR: {4,3}", new object[] { this.TimeInt, this.Channel, this.SequenceNumber, this.Rtt, this.Variance });
|
||||
}
|
||||
|
||||
// Token: 0x0400009D RID: 157
|
||||
public int TimeInt;
|
||||
|
||||
// Token: 0x0400009E RID: 158
|
||||
public int Channel;
|
||||
|
||||
// Token: 0x0400009F RID: 159
|
||||
public int SequenceNumber;
|
||||
|
||||
// Token: 0x040000A0 RID: 160
|
||||
public int Rtt;
|
||||
|
||||
// Token: 0x040000A1 RID: 161
|
||||
public int Variance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000015 RID: 21
|
||||
internal class CmdLogReceivedAck : CmdLogItem
|
||||
{
|
||||
// Token: 0x06000146 RID: 326 RVA: 0x0000A738 File Offset: 0x00008938
|
||||
public CmdLogReceivedAck(NCommand command, int timeInt, int rtt, int variance)
|
||||
{
|
||||
this.TimeInt = timeInt;
|
||||
this.Channel = (int)command.commandChannelID;
|
||||
this.SequenceNumber = command.ackReceivedReliableSequenceNumber;
|
||||
this.Rtt = rtt;
|
||||
this.Variance = variance;
|
||||
this.ReceivedSentTime = command.ackReceivedSentTime;
|
||||
}
|
||||
|
||||
// Token: 0x06000147 RID: 327 RVA: 0x0000A788 File Offset: 0x00008988
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("ACK NOW: {0,5} CH: {1,3} SQ: {2,4} RTT: {3,4} VAR: {4,3} Sent: {5,5} Diff: {6,4}", new object[]
|
||||
{
|
||||
this.TimeInt,
|
||||
this.Channel,
|
||||
this.SequenceNumber,
|
||||
this.Rtt,
|
||||
this.Variance,
|
||||
this.ReceivedSentTime,
|
||||
this.TimeInt - this.ReceivedSentTime
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x040000A4 RID: 164
|
||||
public int ReceivedSentTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000014 RID: 20
|
||||
internal class CmdLogReceivedReliable : CmdLogItem
|
||||
{
|
||||
// Token: 0x06000144 RID: 324 RVA: 0x0000A6E0 File Offset: 0x000088E0
|
||||
public CmdLogReceivedReliable(NCommand command, int timeInt, int rtt, int variance, int timeSinceLastSend, int timeSinceLastSendAck)
|
||||
: base(command, timeInt, rtt, variance)
|
||||
{
|
||||
this.TimeSinceLastSend = timeSinceLastSend;
|
||||
this.TimeSinceLastSendAck = timeSinceLastSendAck;
|
||||
}
|
||||
|
||||
// Token: 0x06000145 RID: 325 RVA: 0x0000A700 File Offset: 0x00008900
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Read reliable. {0} TimeSinceLastSend: {1} TimeSinceLastSendAcks: {2}", base.ToString(), this.TimeSinceLastSend, this.TimeSinceLastSendAck);
|
||||
}
|
||||
|
||||
// Token: 0x040000A2 RID: 162
|
||||
public int TimeSinceLastSend;
|
||||
|
||||
// Token: 0x040000A3 RID: 163
|
||||
public int TimeSinceLastSendAck;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000016 RID: 22
|
||||
internal class CmdLogSentReliable : CmdLogItem
|
||||
{
|
||||
// Token: 0x06000148 RID: 328 RVA: 0x0000A814 File Offset: 0x00008A14
|
||||
public CmdLogSentReliable(NCommand command, int timeInt, int rtt, int variance, bool triggeredTimeout = false)
|
||||
{
|
||||
this.TimeInt = timeInt;
|
||||
this.Channel = (int)command.commandChannelID;
|
||||
this.SequenceNumber = command.reliableSequenceNumber;
|
||||
this.Rtt = rtt;
|
||||
this.Variance = variance;
|
||||
this.Resend = (int)command.commandSentCount;
|
||||
this.RoundtripTimeout = command.roundTripTimeout;
|
||||
this.Timeout = command.timeoutTime;
|
||||
this.TriggeredTimeout = triggeredTimeout;
|
||||
}
|
||||
|
||||
// Token: 0x06000149 RID: 329 RVA: 0x0000A884 File Offset: 0x00008A84
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("SND NOW: {0,5} CH: {1,3} SQ: {2,4} RTT: {3,4} VAR: {4,3} Resend#: {5,2} ResendIn: {7} Timeout: {6,5} {8}", new object[]
|
||||
{
|
||||
this.TimeInt,
|
||||
this.Channel,
|
||||
this.SequenceNumber,
|
||||
this.Rtt,
|
||||
this.Variance,
|
||||
this.Resend,
|
||||
this.Timeout,
|
||||
this.RoundtripTimeout,
|
||||
this.TriggeredTimeout ? "< TIMEOUT" : ""
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x040000A5 RID: 165
|
||||
public int Resend;
|
||||
|
||||
// Token: 0x040000A6 RID: 166
|
||||
public int RoundtripTimeout;
|
||||
|
||||
// Token: 0x040000A7 RID: 167
|
||||
public int Timeout;
|
||||
|
||||
// Token: 0x040000A8 RID: 168
|
||||
public bool TriggeredTimeout;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000E RID: 14
|
||||
public enum ConnectionProtocol : byte
|
||||
{
|
||||
// Token: 0x04000032 RID: 50
|
||||
Udp,
|
||||
// Token: 0x04000033 RID: 51
|
||||
Tcp,
|
||||
// Token: 0x04000034 RID: 52
|
||||
WebSocket = 4,
|
||||
// Token: 0x04000035 RID: 53
|
||||
WebSocketSecure
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000026 RID: 38
|
||||
internal class CustomType
|
||||
{
|
||||
// Token: 0x060001C9 RID: 457 RVA: 0x0000F332 File Offset: 0x0000D532
|
||||
public CustomType(Type type, byte code, SerializeMethod serializeFunction, DeserializeMethod deserializeFunction)
|
||||
{
|
||||
this.Type = type;
|
||||
this.Code = code;
|
||||
this.SerializeFunction = serializeFunction;
|
||||
this.DeserializeFunction = deserializeFunction;
|
||||
}
|
||||
|
||||
// Token: 0x060001CA RID: 458 RVA: 0x0000F359 File Offset: 0x0000D559
|
||||
public CustomType(Type type, byte code, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
|
||||
{
|
||||
this.Type = type;
|
||||
this.Code = code;
|
||||
this.SerializeStreamFunction = serializeFunction;
|
||||
this.DeserializeStreamFunction = deserializeFunction;
|
||||
}
|
||||
|
||||
// Token: 0x04000115 RID: 277
|
||||
public readonly byte Code;
|
||||
|
||||
// Token: 0x04000116 RID: 278
|
||||
public readonly Type Type;
|
||||
|
||||
// Token: 0x04000117 RID: 279
|
||||
public readonly SerializeMethod SerializeFunction;
|
||||
|
||||
// Token: 0x04000118 RID: 280
|
||||
public readonly DeserializeMethod DeserializeFunction;
|
||||
|
||||
// Token: 0x04000119 RID: 281
|
||||
public readonly SerializeStreamMethod SerializeStreamFunction;
|
||||
|
||||
// Token: 0x0400011A RID: 282
|
||||
public readonly DeserializeStreamMethod DeserializeStreamFunction;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000F RID: 15
|
||||
public enum DebugLevel : byte
|
||||
{
|
||||
// Token: 0x04000037 RID: 55
|
||||
OFF,
|
||||
// Token: 0x04000038 RID: 56
|
||||
ERROR,
|
||||
// Token: 0x04000039 RID: 57
|
||||
WARNING,
|
||||
// Token: 0x0400003A RID: 58
|
||||
INFO,
|
||||
// Token: 0x0400003B RID: 59
|
||||
ALL = 5
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000024 RID: 36
|
||||
// (Invoke) Token: 0x060001C2 RID: 450
|
||||
public delegate object DeserializeMethod(byte[] serializedCustomObject);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000025 RID: 37
|
||||
// (Invoke) Token: 0x060001C6 RID: 454
|
||||
public delegate object DeserializeStreamMethod(StreamBuffer inStream, short length);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000008 RID: 8
|
||||
public class DictionaryEntryEnumerator : IEnumerator<DictionaryEntry>, IEnumerator, IDisposable
|
||||
{
|
||||
// Token: 0x0600006B RID: 107 RVA: 0x00006DC4 File Offset: 0x00004FC4
|
||||
public DictionaryEntryEnumerator(IDictionaryEnumerator original)
|
||||
{
|
||||
this.enumerator = original;
|
||||
}
|
||||
|
||||
// Token: 0x0600006C RID: 108 RVA: 0x00006DD8 File Offset: 0x00004FD8
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this.enumerator.MoveNext();
|
||||
}
|
||||
|
||||
// Token: 0x0600006D RID: 109 RVA: 0x00006DF5 File Offset: 0x00004FF5
|
||||
public void Reset()
|
||||
{
|
||||
this.enumerator.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x17000006 RID: 6
|
||||
// (get) Token: 0x0600006E RID: 110 RVA: 0x00006E04 File Offset: 0x00005004
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DictionaryEntry)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000007 RID: 7
|
||||
// (get) Token: 0x0600006F RID: 111 RVA: 0x00006E2C File Offset: 0x0000502C
|
||||
public DictionaryEntry Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DictionaryEntry)this.enumerator.Current;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000008 RID: 8
|
||||
// (get) Token: 0x06000070 RID: 112 RVA: 0x00006E50 File Offset: 0x00005050
|
||||
public object Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Key;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000009 RID: 9
|
||||
// (get) Token: 0x06000071 RID: 113 RVA: 0x00006E70 File Offset: 0x00005070
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000A RID: 10
|
||||
// (get) Token: 0x06000072 RID: 114 RVA: 0x00006E90 File Offset: 0x00005090
|
||||
public DictionaryEntry Entry
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.enumerator.Entry;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000073 RID: 115 RVA: 0x00006EAD File Offset: 0x000050AD
|
||||
public void Dispose()
|
||||
{
|
||||
this.enumerator = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000010 RID: 16
|
||||
private IDictionaryEnumerator enumerator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ExitGames.Client.Photon.EncryptorManaged
|
||||
{
|
||||
// Token: 0x0200003A RID: 58
|
||||
public class CryptoBase : IDisposable
|
||||
{
|
||||
// Token: 0x060002B8 RID: 696 RVA: 0x00013CD8 File Offset: 0x00011ED8
|
||||
~CryptoBase()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
// Token: 0x060002B9 RID: 697 RVA: 0x00013D0C File Offset: 0x00011F0C
|
||||
public void Init(byte[] encryptionSecret, byte[] hmacSecret)
|
||||
{
|
||||
this.encryptor = new AesManaged
|
||||
{
|
||||
Key = encryptionSecret
|
||||
};
|
||||
this.encryptor.GenerateIV();
|
||||
this.hmacsha256 = new HMACSHA256(hmacSecret);
|
||||
}
|
||||
|
||||
// Token: 0x060002BA RID: 698 RVA: 0x00013D3A File Offset: 0x00011F3A
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Token: 0x060002BB RID: 699 RVA: 0x00013D4C File Offset: 0x00011F4C
|
||||
private void Dispose(bool dispose)
|
||||
{
|
||||
bool flag = this.encryptor != null;
|
||||
if (flag)
|
||||
{
|
||||
this.encryptor.Clear();
|
||||
this.encryptor = null;
|
||||
}
|
||||
bool flag2 = this.hmacsha256 != null;
|
||||
if (flag2)
|
||||
{
|
||||
this.hmacsha256.Clear();
|
||||
this.hmacsha256 = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400017E RID: 382
|
||||
public const int BLOCK_SIZE = 16;
|
||||
|
||||
// Token: 0x0400017F RID: 383
|
||||
public const int IV_SIZE = 16;
|
||||
|
||||
// Token: 0x04000180 RID: 384
|
||||
public const int HMAC_SIZE = 32;
|
||||
|
||||
// Token: 0x04000181 RID: 385
|
||||
protected Aes encryptor;
|
||||
|
||||
// Token: 0x04000182 RID: 386
|
||||
protected HMACSHA256 hmacsha256;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ExitGames.Client.Photon.EncryptorManaged
|
||||
{
|
||||
// Token: 0x0200003C RID: 60
|
||||
public class Decryptor : CryptoBase
|
||||
{
|
||||
// Token: 0x060002C3 RID: 707 RVA: 0x00013F10 File Offset: 0x00012110
|
||||
public byte[] DecryptBufferWithIV(byte[] data, int offset, int len, out int outLen)
|
||||
{
|
||||
Buffer.BlockCopy(data, offset, this.IV, 0, 16);
|
||||
this.encryptor.IV = this.IV;
|
||||
byte[] array;
|
||||
using (ICryptoTransform cryptoTransform = this.encryptor.CreateDecryptor())
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(data, offset + 16, len - 16))
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Read))
|
||||
{
|
||||
using (MemoryStream memoryStream2 = new MemoryStream(len - 16))
|
||||
{
|
||||
int num;
|
||||
do
|
||||
{
|
||||
num = cryptoStream.Read(this.readBuffer, 0, 16);
|
||||
bool flag = num != 0;
|
||||
if (flag)
|
||||
{
|
||||
memoryStream2.Write(this.readBuffer, 0, num);
|
||||
}
|
||||
}
|
||||
while (num != 0);
|
||||
outLen = (int)memoryStream2.Length;
|
||||
array = memoryStream2.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060002C4 RID: 708 RVA: 0x00014024 File Offset: 0x00012224
|
||||
public bool CheckHMAC(byte[] data, int len)
|
||||
{
|
||||
this.hmacsha256.ComputeHash(data, 0, len - 32);
|
||||
byte[] hash = this.hmacsha256.Hash;
|
||||
bool flag = true;
|
||||
int num = 0;
|
||||
while (num < 4 && flag)
|
||||
{
|
||||
int num2 = len - 32 + num * 8;
|
||||
int num3 = num * 8;
|
||||
flag = data[num2] == hash[num3] && data[num2 + 1] == hash[num3 + 1] && data[num2 + 2] == hash[num3 + 2] && data[num2 + 3] == hash[num3 + 3] && data[num2 + 4] == hash[num3 + 4] && data[num2 + 5] == hash[num3 + 5] && data[num2 + 6] == hash[num3 + 6] && data[num2 + 7] == hash[num3 + 7];
|
||||
num++;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x04000184 RID: 388
|
||||
private readonly byte[] IV = new byte[16];
|
||||
|
||||
// Token: 0x04000185 RID: 389
|
||||
private readonly byte[] readBuffer = new byte[16];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ExitGames.Client.Photon.EncryptorManaged
|
||||
{
|
||||
// Token: 0x0200003B RID: 59
|
||||
public class Encryptor : CryptoBase
|
||||
{
|
||||
// Token: 0x060002BD RID: 701 RVA: 0x00013DA0 File Offset: 0x00011FA0
|
||||
public void Encrypt(byte[] data, int len, byte[] output, ref int offset)
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = this.encryptor.CreateEncryptor())
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(output, offset, output.Length - offset))
|
||||
{
|
||||
byte[] iv = this.encryptor.IV;
|
||||
memoryStream.Write(iv, 0, iv.Length);
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(data, 0, len);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
this.encryptor.GenerateIV();
|
||||
offset += (int)memoryStream.Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002BE RID: 702 RVA: 0x00013E6C File Offset: 0x0001206C
|
||||
public void HMAC(byte[] data, int offset, int count)
|
||||
{
|
||||
this.hmacsha256.TransformBlock(data, offset, count, data, offset);
|
||||
}
|
||||
|
||||
// Token: 0x060002BF RID: 703 RVA: 0x00013E80 File Offset: 0x00012080
|
||||
public byte[] FinishHMAC()
|
||||
{
|
||||
this.hmacsha256.TransformFinalBlock(Encryptor.zeroBytes, 0, 0);
|
||||
byte[] hash = this.hmacsha256.Hash;
|
||||
this.hmacsha256.Initialize();
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Token: 0x060002C0 RID: 704 RVA: 0x00013EC0 File Offset: 0x000120C0
|
||||
public byte[] FinishHMAC(byte[] data, int offset, int count)
|
||||
{
|
||||
this.hmacsha256.TransformFinalBlock(data, offset, count);
|
||||
byte[] hash = this.hmacsha256.Hash;
|
||||
this.hmacsha256.Initialize();
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Token: 0x04000183 RID: 387
|
||||
private static readonly byte[] zeroBytes = new byte[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000018 RID: 24
|
||||
internal class EnetChannel
|
||||
{
|
||||
// Token: 0x06000170 RID: 368 RVA: 0x0000D914 File Offset: 0x0000BB14
|
||||
public EnetChannel(byte channelNumber, int commandBufferSize)
|
||||
{
|
||||
this.ChannelNumber = channelNumber;
|
||||
this.incomingReliableCommandsList = new Dictionary<int, NCommand>(commandBufferSize);
|
||||
this.incomingUnreliableCommandsList = new Dictionary<int, NCommand>(commandBufferSize);
|
||||
this.outgoingReliableCommandsList = new Queue<NCommand>(commandBufferSize);
|
||||
this.outgoingUnreliableCommandsList = new Queue<NCommand>(commandBufferSize);
|
||||
}
|
||||
|
||||
// Token: 0x06000171 RID: 369 RVA: 0x0000D960 File Offset: 0x0000BB60
|
||||
public bool ContainsUnreliableSequenceNumber(int unreliableSequenceNumber)
|
||||
{
|
||||
return this.incomingUnreliableCommandsList.ContainsKey(unreliableSequenceNumber);
|
||||
}
|
||||
|
||||
// Token: 0x06000172 RID: 370 RVA: 0x0000D980 File Offset: 0x0000BB80
|
||||
public NCommand FetchUnreliableSequenceNumber(int unreliableSequenceNumber)
|
||||
{
|
||||
return this.incomingUnreliableCommandsList[unreliableSequenceNumber];
|
||||
}
|
||||
|
||||
// Token: 0x06000173 RID: 371 RVA: 0x0000D9A0 File Offset: 0x0000BBA0
|
||||
public bool ContainsReliableSequenceNumber(int reliableSequenceNumber)
|
||||
{
|
||||
return this.incomingReliableCommandsList.ContainsKey(reliableSequenceNumber);
|
||||
}
|
||||
|
||||
// Token: 0x06000174 RID: 372 RVA: 0x0000D9C0 File Offset: 0x0000BBC0
|
||||
public NCommand FetchReliableSequenceNumber(int reliableSequenceNumber)
|
||||
{
|
||||
return this.incomingReliableCommandsList[reliableSequenceNumber];
|
||||
}
|
||||
|
||||
// Token: 0x06000175 RID: 373 RVA: 0x0000D9E0 File Offset: 0x0000BBE0
|
||||
public void clearAll()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.incomingReliableCommandsList.Clear();
|
||||
this.incomingUnreliableCommandsList.Clear();
|
||||
this.outgoingReliableCommandsList.Clear();
|
||||
this.outgoingUnreliableCommandsList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000C4 RID: 196
|
||||
internal byte ChannelNumber;
|
||||
|
||||
// Token: 0x040000C5 RID: 197
|
||||
internal Dictionary<int, NCommand> incomingReliableCommandsList;
|
||||
|
||||
// Token: 0x040000C6 RID: 198
|
||||
internal Dictionary<int, NCommand> incomingUnreliableCommandsList;
|
||||
|
||||
// Token: 0x040000C7 RID: 199
|
||||
internal Queue<NCommand> outgoingReliableCommandsList;
|
||||
|
||||
// Token: 0x040000C8 RID: 200
|
||||
internal Queue<NCommand> outgoingUnreliableCommandsList;
|
||||
|
||||
// Token: 0x040000C9 RID: 201
|
||||
internal int incomingReliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000CA RID: 202
|
||||
internal int incomingUnreliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000CB RID: 203
|
||||
internal int outgoingReliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000CC RID: 204
|
||||
internal int outgoingUnreliableSequenceNumber;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1755 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using ExitGames.Client.Photon.EncryptorManaged;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000017 RID: 23
|
||||
internal class EnetPeer : PeerBase
|
||||
{
|
||||
// Token: 0x1700005C RID: 92
|
||||
// (get) Token: 0x0600014A RID: 330 RVA: 0x0000A930 File Offset: 0x00008B30
|
||||
internal override int QueuedIncomingCommandsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int num = 0;
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
for (int i = 0; i < this.channelArray.Length; i++)
|
||||
{
|
||||
EnetChannel enetChannel = this.channelArray[i];
|
||||
num += enetChannel.incomingReliableCommandsList.Count;
|
||||
num += enetChannel.incomingUnreliableCommandsList.Count;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005D RID: 93
|
||||
// (get) Token: 0x0600014B RID: 331 RVA: 0x0000A9B4 File Offset: 0x00008BB4
|
||||
internal override int QueuedOutgoingCommandsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int num = 0;
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
for (int i = 0; i < this.channelArray.Length; i++)
|
||||
{
|
||||
EnetChannel enetChannel = this.channelArray[i];
|
||||
num += enetChannel.outgoingReliableCommandsList.Count;
|
||||
num += enetChannel.outgoingUnreliableCommandsList.Count;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005E RID: 94
|
||||
// (get) Token: 0x0600014C RID: 332 RVA: 0x0000AA38 File Offset: 0x00008C38
|
||||
private Encryptor encryptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.encryptor;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005F RID: 95
|
||||
// (get) Token: 0x0600014D RID: 333 RVA: 0x0000AA58 File Offset: 0x00008C58
|
||||
private Decryptor decryptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.decryptor;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600014E RID: 334 RVA: 0x0000AA78 File Offset: 0x00008C78
|
||||
internal EnetPeer()
|
||||
{
|
||||
PeerBase.peerCount += 1;
|
||||
base.InitOnce();
|
||||
this.TrafficPackageHeaderSize = 12;
|
||||
}
|
||||
|
||||
// Token: 0x0600014F RID: 335 RVA: 0x0000AAE4 File Offset: 0x00008CE4
|
||||
internal override void InitPeerBase()
|
||||
{
|
||||
base.InitPeerBase();
|
||||
bool flag = this.ppeer.PayloadEncryptionSecret != null && this.usedProtocol == ConnectionProtocol.Udp;
|
||||
if (flag)
|
||||
{
|
||||
this.InitEncryption(this.ppeer.PayloadEncryptionSecret);
|
||||
}
|
||||
bool flag2 = this.encryptor != null && this.decryptor != null;
|
||||
if (flag2)
|
||||
{
|
||||
this.isEncryptionAvailable = true;
|
||||
}
|
||||
this.peerID = (this.ppeer.EnableServerTracing ? -2 : -1);
|
||||
this.challenge = SupportClass.ThreadSafeRandom.Next();
|
||||
bool flag3 = this.udpBuffer == null || this.udpBuffer.Length != base.mtu;
|
||||
if (flag3)
|
||||
{
|
||||
this.udpBuffer = new byte[base.mtu];
|
||||
}
|
||||
this.reliableCommandsSent = 0;
|
||||
this.reliableCommandsRepeated = 0;
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
EnetChannel[] array2 = this.channelArray;
|
||||
bool flag4 = array2.Length != (int)(base.ChannelCount + 1);
|
||||
if (flag4)
|
||||
{
|
||||
array2 = new EnetChannel[(int)(base.ChannelCount + 1)];
|
||||
}
|
||||
for (byte b = 0; b < base.ChannelCount; b += 1)
|
||||
{
|
||||
array2[(int)b] = new EnetChannel(b, this.commandBufferSize);
|
||||
}
|
||||
array2[(int)base.ChannelCount] = new EnetChannel(byte.MaxValue, this.commandBufferSize);
|
||||
this.channelArray = array2;
|
||||
}
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
this.sentReliableCommands = new List<NCommand>(this.commandBufferSize);
|
||||
}
|
||||
this.outgoingAcknowledgementsPool = new StreamBuffer(0);
|
||||
base.CommandLogInit();
|
||||
}
|
||||
|
||||
// Token: 0x06000150 RID: 336 RVA: 0x0000ACAC File Offset: 0x00008EAC
|
||||
internal override bool Connect(string ipport, string appID, object custom = null)
|
||||
{
|
||||
bool flag = this.peerConnectionState > PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.WARNING, "Connect() can't be called if peer is not Disconnected. Not connecting. peerConnectionState: " + this.peerConnectionState);
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = base.debugOut >= DebugLevel.ALL;
|
||||
if (flag3)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "Connect()");
|
||||
}
|
||||
base.ServerAddress = ipport;
|
||||
this.InitPeerBase();
|
||||
bool flag4 = base.SocketImplementation != null;
|
||||
if (flag4)
|
||||
{
|
||||
this.rt = (IPhotonSocket)Activator.CreateInstance(base.SocketImplementation, new object[] { this });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rt = new SocketUdp(this);
|
||||
}
|
||||
bool flag5 = this.rt == null;
|
||||
if (flag5)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Connect() failed, because SocketImplementation or socket was null. Set PhotonPeer.SocketImplementation before Connect().");
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = this.rt.Connect();
|
||||
if (flag6)
|
||||
{
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsOutgoing.ControlCommandBytes += 44;
|
||||
base.TrafficStatsOutgoing.ControlCommandCount++;
|
||||
}
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Connecting;
|
||||
flag2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x06000151 RID: 337 RVA: 0x0000ADE2 File Offset: 0x00008FE2
|
||||
public override void OnConnect()
|
||||
{
|
||||
this.QueueOutgoingReliableCommand(new NCommand(this, 2, null, byte.MaxValue));
|
||||
}
|
||||
|
||||
// Token: 0x06000152 RID: 338 RVA: 0x0000ADFC File Offset: 0x00008FFC
|
||||
internal override void Disconnect()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnected || this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnecting;
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = this.sentReliableCommands != null;
|
||||
if (flag2)
|
||||
{
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
this.sentReliableCommands.Clear();
|
||||
}
|
||||
}
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
foreach (EnetChannel enetChannel in this.channelArray)
|
||||
{
|
||||
enetChannel.clearAll();
|
||||
}
|
||||
}
|
||||
bool isSimulationEnabled = base.NetworkSimulationSettings.IsSimulationEnabled;
|
||||
base.NetworkSimulationSettings.IsSimulationEnabled = false;
|
||||
NCommand ncommand = new NCommand(this, 4, null, byte.MaxValue);
|
||||
this.QueueOutgoingReliableCommand(ncommand);
|
||||
this.SendOutgoingCommands();
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountControlCommand(ncommand.Size);
|
||||
}
|
||||
base.NetworkSimulationSettings.IsSimulationEnabled = isSimulationEnabled;
|
||||
this.rt.Disconnect();
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnected;
|
||||
base.EnqueueStatusCallback(StatusCode.Disconnect);
|
||||
this.datagramEncryptedConnection = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000153 RID: 339 RVA: 0x0000AF50 File Offset: 0x00009150
|
||||
internal override void StopConnection()
|
||||
{
|
||||
bool flag = this.rt != null;
|
||||
if (flag)
|
||||
{
|
||||
this.rt.Disconnect();
|
||||
}
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2 = base.Listener != null;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.OnStatusChanged(StatusCode.Disconnect);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000154 RID: 340 RVA: 0x0000AFA0 File Offset: 0x000091A0
|
||||
internal override void FetchServerTimestamp()
|
||||
{
|
||||
bool flag = this.peerConnectionState != PeerBase.ConnectionStateValue.Connected || !this.ApplicationIsInitialized;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "FetchServerTimestamp() was skipped, as the client is not connected. Current ConnectionState: " + this.peerConnectionState);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CreateAndEnqueueCommand(12, new byte[0], byte.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000155 RID: 341 RVA: 0x0000B010 File Offset: 0x00009210
|
||||
internal override bool DispatchIncomingCommands()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Queue<PeerBase.MyAction> actionQueue = this.ActionQueue;
|
||||
PeerBase.MyAction myAction;
|
||||
lock (actionQueue)
|
||||
{
|
||||
bool flag = this.ActionQueue.Count <= 0;
|
||||
if (flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
myAction = this.ActionQueue.Dequeue();
|
||||
}
|
||||
myAction();
|
||||
}
|
||||
NCommand ncommand = null;
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
for (int i = 0; i < this.channelArray.Length; i++)
|
||||
{
|
||||
EnetChannel enetChannel = this.channelArray[i];
|
||||
bool flag2 = enetChannel.incomingUnreliableCommandsList.Count > 0;
|
||||
if (flag2)
|
||||
{
|
||||
int num = int.MaxValue;
|
||||
foreach (int num2 in enetChannel.incomingUnreliableCommandsList.Keys)
|
||||
{
|
||||
NCommand ncommand2 = enetChannel.incomingUnreliableCommandsList[num2];
|
||||
bool flag3 = num2 < enetChannel.incomingUnreliableSequenceNumber || ncommand2.reliableSequenceNumber < enetChannel.incomingReliableSequenceNumber;
|
||||
if (flag3)
|
||||
{
|
||||
this.commandsToRemove.Enqueue(num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = base.limitOfUnreliableCommands > 0 && enetChannel.incomingUnreliableCommandsList.Count > base.limitOfUnreliableCommands;
|
||||
if (flag4)
|
||||
{
|
||||
this.commandsToRemove.Enqueue(num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = num2 < num;
|
||||
if (flag5)
|
||||
{
|
||||
bool flag6 = ncommand2.reliableSequenceNumber > enetChannel.incomingReliableSequenceNumber;
|
||||
if (!flag6)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (this.commandsToRemove.Count > 0)
|
||||
{
|
||||
enetChannel.incomingUnreliableCommandsList.Remove(this.commandsToRemove.Dequeue());
|
||||
}
|
||||
bool flag7 = num < int.MaxValue;
|
||||
if (flag7)
|
||||
{
|
||||
ncommand = enetChannel.incomingUnreliableCommandsList[num];
|
||||
}
|
||||
bool flag8 = ncommand != null;
|
||||
if (flag8)
|
||||
{
|
||||
enetChannel.incomingUnreliableCommandsList.Remove(ncommand.unreliableSequenceNumber);
|
||||
enetChannel.incomingUnreliableSequenceNumber = ncommand.unreliableSequenceNumber;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool flag9 = ncommand == null && enetChannel.incomingReliableCommandsList.Count > 0;
|
||||
if (flag9)
|
||||
{
|
||||
enetChannel.incomingReliableCommandsList.TryGetValue(enetChannel.incomingReliableSequenceNumber + 1, out ncommand);
|
||||
bool flag10 = ncommand == null;
|
||||
if (!flag10)
|
||||
{
|
||||
bool flag11 = ncommand.commandType != 8;
|
||||
if (flag11)
|
||||
{
|
||||
enetChannel.incomingReliableSequenceNumber = ncommand.reliableSequenceNumber;
|
||||
enetChannel.incomingReliableCommandsList.Remove(ncommand.reliableSequenceNumber);
|
||||
break;
|
||||
}
|
||||
bool flag12 = ncommand.fragmentsRemaining > 0;
|
||||
if (flag12)
|
||||
{
|
||||
ncommand = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array2 = new byte[ncommand.totalLength];
|
||||
for (int j = ncommand.startSequenceNumber; j < ncommand.startSequenceNumber + ncommand.fragmentCount; j++)
|
||||
{
|
||||
bool flag13 = enetChannel.ContainsReliableSequenceNumber(j);
|
||||
if (!flag13)
|
||||
{
|
||||
throw new Exception("command.fragmentsRemaining was 0, but not all fragments are found to be combined!");
|
||||
}
|
||||
NCommand ncommand3 = enetChannel.FetchReliableSequenceNumber(j);
|
||||
Buffer.BlockCopy(ncommand3.Payload, 0, array2, ncommand3.fragmentOffset, ncommand3.Payload.Length);
|
||||
enetChannel.incomingReliableCommandsList.Remove(ncommand3.reliableSequenceNumber);
|
||||
}
|
||||
bool flag14 = base.debugOut >= DebugLevel.ALL;
|
||||
if (flag14)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "assembled fragmented payload from " + ncommand.fragmentCount + " parts. Dispatching now.");
|
||||
}
|
||||
ncommand.Payload = array2;
|
||||
ncommand.Size = 12 * ncommand.fragmentCount + ncommand.totalLength;
|
||||
enetChannel.incomingReliableSequenceNumber = ncommand.reliableSequenceNumber + ncommand.fragmentCount - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool flag15 = ncommand != null && ncommand.Payload != null;
|
||||
if (flag15)
|
||||
{
|
||||
this.ByteCountCurrentDispatch = ncommand.Size;
|
||||
this.CommandInCurrentDispatch = ncommand;
|
||||
bool flag16 = this.DeserializeMessageAndCallback(ncommand.Payload);
|
||||
if (flag16)
|
||||
{
|
||||
this.CommandInCurrentDispatch = null;
|
||||
return true;
|
||||
}
|
||||
this.CommandInCurrentDispatch = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000156 RID: 342 RVA: 0x0000B488 File Offset: 0x00009688
|
||||
private int GetFragmentLength()
|
||||
{
|
||||
int num = base.mtu;
|
||||
bool flag = this.datagramEncryptedConnection;
|
||||
int num2;
|
||||
if (flag)
|
||||
{
|
||||
num = num - 7 - EnetPeer.HMAC_SIZE - EnetPeer.IV_SIZE;
|
||||
num = num / EnetPeer.BLOCK_SIZE * EnetPeer.BLOCK_SIZE;
|
||||
num = num - 5 - 36;
|
||||
num2 = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = num - 12 - 36;
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000157 RID: 343 RVA: 0x0000B4DC File Offset: 0x000096DC
|
||||
private int CalculateBufferLen()
|
||||
{
|
||||
int num = base.mtu;
|
||||
bool flag = this.datagramEncryptedConnection;
|
||||
int num2;
|
||||
if (flag)
|
||||
{
|
||||
num = num - 7 - EnetPeer.HMAC_SIZE - EnetPeer.IV_SIZE;
|
||||
num = num / EnetPeer.BLOCK_SIZE * EnetPeer.BLOCK_SIZE;
|
||||
num--;
|
||||
num2 = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = num;
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000158 RID: 344 RVA: 0x0000B528 File Offset: 0x00009728
|
||||
private int CalculateInitialOffset()
|
||||
{
|
||||
bool flag = this.datagramEncryptedConnection;
|
||||
int num;
|
||||
if (flag)
|
||||
{
|
||||
num = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = 12;
|
||||
bool crcEnabled = base.crcEnabled;
|
||||
if (crcEnabled)
|
||||
{
|
||||
num2 += 4;
|
||||
}
|
||||
num = num2;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000159 RID: 345 RVA: 0x0000B560 File Offset: 0x00009760
|
||||
internal override bool SendAcksOnly()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = this.rt == null || !this.rt.Connected;
|
||||
if (flag3)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = this.udpBuffer;
|
||||
lock (array)
|
||||
{
|
||||
int num = 0;
|
||||
this.udpBufferIndex = this.CalculateInitialOffset();
|
||||
this.udpBufferLength = this.CalculateBufferLen();
|
||||
this.udpCommandCount = 0;
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
StreamBuffer streamBuffer = this.outgoingAcknowledgementsPool;
|
||||
lock (streamBuffer)
|
||||
{
|
||||
num = this.SerializeAckToBuffer();
|
||||
this.timeLastSendAck = this.timeInt;
|
||||
}
|
||||
bool flag4 = this.timeInt > this.timeoutInt && this.sentReliableCommands.Count > 0;
|
||||
if (flag4)
|
||||
{
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
foreach (NCommand ncommand in this.sentReliableCommands)
|
||||
{
|
||||
bool flag5 = ncommand != null && ncommand.roundTripTimeout != 0 && this.timeInt - ncommand.commandSentTime > ncommand.roundTripTimeout;
|
||||
if (flag5)
|
||||
{
|
||||
ncommand.commandSentCount = 1;
|
||||
ncommand.roundTripTimeout = 0;
|
||||
ncommand.timeoutTime = int.MaxValue;
|
||||
ncommand.commandSentTime = this.timeInt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool flag6 = this.udpCommandCount <= 0;
|
||||
if (flag6)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
TrafficStats trafficStatsOutgoing = base.TrafficStatsOutgoing;
|
||||
int totalPacketCount = trafficStatsOutgoing.TotalPacketCount;
|
||||
trafficStatsOutgoing.TotalPacketCount = totalPacketCount + 1;
|
||||
base.TrafficStatsOutgoing.TotalCommandsInPackets += (int)this.udpCommandCount;
|
||||
}
|
||||
this.SendData(this.udpBuffer, this.udpBufferIndex);
|
||||
flag2 = num > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600015A RID: 346 RVA: 0x0000B7D0 File Offset: 0x000099D0
|
||||
internal override bool SendOutgoingCommands()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = !this.rt.Connected;
|
||||
if (flag3)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = this.udpBuffer;
|
||||
lock (array)
|
||||
{
|
||||
int num = 0;
|
||||
this.udpBufferIndex = this.CalculateInitialOffset();
|
||||
this.udpBufferLength = this.CalculateBufferLen();
|
||||
this.udpCommandCount = 0;
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
this.timeLastSendOutgoing = this.timeInt;
|
||||
StreamBuffer streamBuffer = this.outgoingAcknowledgementsPool;
|
||||
lock (streamBuffer)
|
||||
{
|
||||
bool flag4 = this.outgoingAcknowledgementsPool.Length > 0L;
|
||||
if (flag4)
|
||||
{
|
||||
num = this.SerializeAckToBuffer();
|
||||
this.timeLastSendAck = this.timeInt;
|
||||
}
|
||||
}
|
||||
bool flag5 = !base.IsSendingOnlyAcks && this.timeInt > this.timeoutInt && this.sentReliableCommands.Count > 0;
|
||||
if (flag5)
|
||||
{
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
this.commandsToResend.Clear();
|
||||
foreach (NCommand ncommand in this.sentReliableCommands)
|
||||
{
|
||||
bool flag6 = ncommand != null && this.timeInt - ncommand.commandSentTime > ncommand.roundTripTimeout;
|
||||
if (flag6)
|
||||
{
|
||||
bool flag7 = (int)ncommand.commandSentCount > base.sentCountAllowance || this.timeInt > ncommand.timeoutTime;
|
||||
if (flag7)
|
||||
{
|
||||
bool flag8 = base.debugOut >= DebugLevel.WARNING;
|
||||
if (flag8)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.WARNING, string.Concat(new object[]
|
||||
{
|
||||
"Timeout-disconnect! Command: ",
|
||||
ncommand,
|
||||
" now: ",
|
||||
this.timeInt,
|
||||
" challenge: ",
|
||||
Convert.ToString(this.challenge, 16)
|
||||
}));
|
||||
}
|
||||
bool flag9 = this.CommandLog != null;
|
||||
if (flag9)
|
||||
{
|
||||
this.CommandLog.Enqueue(new CmdLogSentReliable(ncommand, this.timeInt, this.roundTripTime, this.roundTripTimeVariance, true));
|
||||
base.CommandLogResize();
|
||||
}
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Zombie;
|
||||
base.Listener.OnStatusChanged(StatusCode.TimeoutDisconnect);
|
||||
this.Disconnect();
|
||||
return false;
|
||||
}
|
||||
this.commandsToResend.Enqueue(ncommand);
|
||||
}
|
||||
}
|
||||
while (this.commandsToResend.Count > 0)
|
||||
{
|
||||
NCommand ncommand2 = this.commandsToResend.Dequeue();
|
||||
this.QueueOutgoingReliableCommand(ncommand2);
|
||||
this.sentReliableCommands.Remove(ncommand2);
|
||||
this.reliableCommandsRepeated++;
|
||||
bool flag10 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag10)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Format("Resending: {0}. times out after: {1} sent: {3} now: {2} rtt/var: {4}/{5} last recv: {6}", new object[]
|
||||
{
|
||||
ncommand2,
|
||||
ncommand2.roundTripTimeout,
|
||||
this.timeInt,
|
||||
ncommand2.commandSentTime,
|
||||
this.roundTripTime,
|
||||
this.roundTripTimeVariance,
|
||||
SupportClass.GetTickCount() - this.timestampOfLastReceive
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool flag11 = !base.IsSendingOnlyAcks && this.peerConnectionState == PeerBase.ConnectionStateValue.Connected && base.timePingInterval > 0 && this.sentReliableCommands.Count == 0 && this.timeInt - this.timeLastAckReceive > base.timePingInterval && !this.AreReliableCommandsInTransit() && this.udpBufferIndex + 12 < this.udpBufferLength;
|
||||
if (flag11)
|
||||
{
|
||||
NCommand ncommand3 = new NCommand(this, 5, null, byte.MaxValue);
|
||||
this.QueueOutgoingReliableCommand(ncommand3);
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountControlCommand(ncommand3.Size);
|
||||
}
|
||||
}
|
||||
bool flag12 = !base.IsSendingOnlyAcks;
|
||||
if (flag12)
|
||||
{
|
||||
EnetChannel[] array2 = this.channelArray;
|
||||
lock (array2)
|
||||
{
|
||||
for (int i = 0; i < this.channelArray.Length; i++)
|
||||
{
|
||||
EnetChannel enetChannel = this.channelArray[i];
|
||||
num += this.SerializeToBuffer(enetChannel.outgoingReliableCommandsList);
|
||||
num += this.SerializeToBuffer(enetChannel.outgoingUnreliableCommandsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
bool flag13 = this.udpCommandCount <= 0;
|
||||
if (flag13)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool trafficStatsEnabled2 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled2)
|
||||
{
|
||||
TrafficStats trafficStatsOutgoing = base.TrafficStatsOutgoing;
|
||||
int totalPacketCount = trafficStatsOutgoing.TotalPacketCount;
|
||||
trafficStatsOutgoing.TotalPacketCount = totalPacketCount + 1;
|
||||
base.TrafficStatsOutgoing.TotalCommandsInPackets += (int)this.udpCommandCount;
|
||||
}
|
||||
this.SendData(this.udpBuffer, this.udpBufferIndex);
|
||||
flag2 = num > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600015B RID: 347 RVA: 0x0000BD58 File Offset: 0x00009F58
|
||||
private bool AreReliableCommandsInTransit()
|
||||
{
|
||||
EnetChannel[] array = this.channelArray;
|
||||
lock (array)
|
||||
{
|
||||
for (int i = 0; i < this.channelArray.Length; i++)
|
||||
{
|
||||
EnetChannel enetChannel = this.channelArray[i];
|
||||
bool flag = enetChannel.outgoingReliableCommandsList.Count > 0;
|
||||
if (flag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600015C RID: 348 RVA: 0x0000BDD4 File Offset: 0x00009FD4
|
||||
internal override bool EnqueueOperation(Dictionary<byte, object> parameters, byte opCode, bool sendReliable, byte channelId, bool encrypt, PeerBase.EgMessageType messageType)
|
||||
{
|
||||
bool flag = this.peerConnectionState != PeerBase.ConnectionStateValue.Connected;
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Cannot send op: ", opCode, " Not connected. PeerState: ", this.peerConnectionState }));
|
||||
}
|
||||
base.Listener.OnStatusChanged(StatusCode.SendError);
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = channelId >= base.ChannelCount;
|
||||
if (flag4)
|
||||
{
|
||||
bool flag5 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag5)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Cannot send op: Selected channel (", channelId, ")>= channelCount (", base.ChannelCount, ")." }));
|
||||
}
|
||||
base.Listener.OnStatusChanged(StatusCode.SendError);
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = this.SerializeOperationToMessage(opCode, parameters, messageType, encrypt);
|
||||
flag3 = this.CreateAndEnqueueCommand(sendReliable ? 6 : 7, array, channelId);
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600015D RID: 349 RVA: 0x0000BF04 File Offset: 0x0000A104
|
||||
private EnetChannel GetChannel(byte channelNumber)
|
||||
{
|
||||
return (channelNumber == byte.MaxValue) ? this.channelArray[this.channelArray.Length - 1] : this.channelArray[(int)channelNumber];
|
||||
}
|
||||
|
||||
// Token: 0x0600015E RID: 350 RVA: 0x0000BF3C File Offset: 0x0000A13C
|
||||
internal bool CreateAndEnqueueCommand(byte commandType, byte[] payload, byte channelNumber)
|
||||
{
|
||||
bool flag = payload == null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
EnetChannel channel = this.GetChannel(channelNumber);
|
||||
this.ByteCountLastOperation = 0;
|
||||
int num = this.GetFragmentLength();
|
||||
bool flag3 = payload.Length > num;
|
||||
if (flag3)
|
||||
{
|
||||
int num2 = (payload.Length + num - 1) / num;
|
||||
int num3 = channel.outgoingReliableSequenceNumber + 1;
|
||||
int num4 = 0;
|
||||
for (int i = 0; i < payload.Length; i += num)
|
||||
{
|
||||
bool flag4 = payload.Length - i < num;
|
||||
if (flag4)
|
||||
{
|
||||
num = payload.Length - i;
|
||||
}
|
||||
byte[] array = new byte[num];
|
||||
Buffer.BlockCopy(payload, i, array, 0, num);
|
||||
NCommand ncommand = new NCommand(this, 8, array, channel.ChannelNumber);
|
||||
ncommand.fragmentNumber = num4;
|
||||
ncommand.startSequenceNumber = num3;
|
||||
ncommand.fragmentCount = num2;
|
||||
ncommand.totalLength = payload.Length;
|
||||
ncommand.fragmentOffset = i;
|
||||
this.QueueOutgoingReliableCommand(ncommand);
|
||||
this.ByteCountLastOperation += ncommand.Size;
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountFragmentOpCommand(ncommand.Size);
|
||||
base.TrafficStatsGameLevel.CountOperation(ncommand.Size);
|
||||
}
|
||||
num4++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NCommand ncommand2 = new NCommand(this, commandType, payload, channel.ChannelNumber);
|
||||
bool flag5 = ncommand2.commandFlags == 1;
|
||||
if (flag5)
|
||||
{
|
||||
this.QueueOutgoingReliableCommand(ncommand2);
|
||||
this.ByteCountLastOperation = ncommand2.Size;
|
||||
bool trafficStatsEnabled2 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled2)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountReliableOpCommand(ncommand2.Size);
|
||||
base.TrafficStatsGameLevel.CountOperation(ncommand2.Size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.QueueOutgoingUnreliableCommand(ncommand2);
|
||||
this.ByteCountLastOperation = ncommand2.Size;
|
||||
bool trafficStatsEnabled3 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled3)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountUnreliableOpCommand(ncommand2.Size);
|
||||
base.TrafficStatsGameLevel.CountOperation(ncommand2.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600015F RID: 351 RVA: 0x0000C144 File Offset: 0x0000A344
|
||||
internal override byte[] SerializeOperationToMessage(byte opCode, Dictionary<byte, object> parameters, PeerBase.EgMessageType messageType, bool encrypt)
|
||||
{
|
||||
encrypt = encrypt && !this.datagramEncryptedConnection;
|
||||
StreamBuffer serializeMemStream = this.SerializeMemStream;
|
||||
byte[] array2;
|
||||
lock (serializeMemStream)
|
||||
{
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
bool flag = !encrypt;
|
||||
if (flag)
|
||||
{
|
||||
this.SerializeMemStream.Write(EnetPeer.messageHeader, 0, EnetPeer.messageHeader.Length);
|
||||
}
|
||||
this.protocol.SerializeOperationRequest(this.SerializeMemStream, opCode, parameters, false);
|
||||
bool flag2 = encrypt;
|
||||
if (flag2)
|
||||
{
|
||||
byte[] array = this.CryptoProvider.Encrypt(this.SerializeMemStream.GetBuffer(), 0, (int)this.SerializeMemStream.Length);
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
this.SerializeMemStream.Write(EnetPeer.messageHeader, 0, EnetPeer.messageHeader.Length);
|
||||
this.SerializeMemStream.Write(array, 0, array.Length);
|
||||
}
|
||||
array2 = this.SerializeMemStream.ToArray();
|
||||
}
|
||||
bool flag3 = messageType != PeerBase.EgMessageType.Operation;
|
||||
if (flag3)
|
||||
{
|
||||
array2[EnetPeer.messageHeader.Length - 1] = (byte)messageType;
|
||||
}
|
||||
bool flag4 = encrypt;
|
||||
if (flag4)
|
||||
{
|
||||
array2[EnetPeer.messageHeader.Length - 1] = array2[EnetPeer.messageHeader.Length - 1] | 128;
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
// Token: 0x06000160 RID: 352 RVA: 0x0000C294 File Offset: 0x0000A494
|
||||
internal int SerializeAckToBuffer()
|
||||
{
|
||||
this.outgoingAcknowledgementsPool.Seek(0L, SeekOrigin.Begin);
|
||||
while (this.outgoingAcknowledgementsPool.Position + 20L <= this.outgoingAcknowledgementsPool.Length)
|
||||
{
|
||||
bool flag = this.udpBufferIndex + 20 > this.udpBufferLength;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[]
|
||||
{
|
||||
"UDP package is full. Commands in Package: ",
|
||||
this.udpCommandCount,
|
||||
". bytes left in queue: ",
|
||||
this.outgoingAcknowledgementsPool.Position
|
||||
}));
|
||||
}
|
||||
break;
|
||||
}
|
||||
int num;
|
||||
byte[] bufferAndAdvance = this.outgoingAcknowledgementsPool.GetBufferAndAdvance(20, out num);
|
||||
Buffer.BlockCopy(bufferAndAdvance, num, this.udpBuffer, this.udpBufferIndex, 20);
|
||||
this.udpBufferIndex += 20;
|
||||
this.udpCommandCount += 1;
|
||||
}
|
||||
this.outgoingAcknowledgementsPool.Compact();
|
||||
this.outgoingAcknowledgementsPool.Position = this.outgoingAcknowledgementsPool.Length;
|
||||
return (int)this.outgoingAcknowledgementsPool.Length / 20;
|
||||
}
|
||||
|
||||
// Token: 0x06000161 RID: 353 RVA: 0x0000C3D0 File Offset: 0x0000A5D0
|
||||
internal int SerializeToBuffer(Queue<NCommand> commandList)
|
||||
{
|
||||
while (commandList.Count > 0)
|
||||
{
|
||||
NCommand ncommand = commandList.Peek();
|
||||
bool flag = ncommand == null;
|
||||
if (flag)
|
||||
{
|
||||
commandList.Dequeue();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.udpBufferIndex + ncommand.Size > this.udpBufferLength;
|
||||
if (flag2)
|
||||
{
|
||||
bool flag3 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag3)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[] { "UDP package is full. Commands in Package: ", this.udpCommandCount, ". Commands left in queue: ", commandList.Count }));
|
||||
}
|
||||
break;
|
||||
}
|
||||
ncommand.SerializeHeader(this.udpBuffer, ref this.udpBufferIndex);
|
||||
bool flag4 = ncommand.SizeOfPayload > 0;
|
||||
if (flag4)
|
||||
{
|
||||
Buffer.BlockCopy(ncommand.Serialize(), 0, this.udpBuffer, this.udpBufferIndex, ncommand.SizeOfPayload);
|
||||
this.udpBufferIndex += ncommand.SizeOfPayload;
|
||||
}
|
||||
this.udpCommandCount += 1;
|
||||
bool flag5 = (ncommand.commandFlags & 1) > 0;
|
||||
if (flag5)
|
||||
{
|
||||
this.QueueSentCommand(ncommand);
|
||||
bool flag6 = this.CommandLog != null;
|
||||
if (flag6)
|
||||
{
|
||||
this.CommandLog.Enqueue(new CmdLogSentReliable(ncommand, this.timeInt, this.roundTripTime, this.roundTripTimeVariance, false));
|
||||
base.CommandLogResize();
|
||||
}
|
||||
}
|
||||
commandList.Dequeue();
|
||||
}
|
||||
}
|
||||
return commandList.Count;
|
||||
}
|
||||
|
||||
// Token: 0x06000162 RID: 354 RVA: 0x0000C558 File Offset: 0x0000A758
|
||||
internal void SendData(byte[] data, int length)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag = this.datagramEncryptedConnection;
|
||||
if (flag)
|
||||
{
|
||||
this.SendDataEncrypted(data, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = 0;
|
||||
Protocol.Serialize(this.peerID, data, ref num);
|
||||
data[2] = (base.crcEnabled ? 204 : 0);
|
||||
data[3] = this.udpCommandCount;
|
||||
num = 4;
|
||||
Protocol.Serialize(this.timeInt, data, ref num);
|
||||
Protocol.Serialize(this.challenge, data, ref num);
|
||||
bool crcEnabled = base.crcEnabled;
|
||||
if (crcEnabled)
|
||||
{
|
||||
Protocol.Serialize(0, data, ref num);
|
||||
uint num2 = SupportClass.CalculateCrc(data, length);
|
||||
num -= 4;
|
||||
Protocol.Serialize((int)num2, data, ref num);
|
||||
}
|
||||
this.bytesOut += (long)length;
|
||||
this.SendToSocket(data, length);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, ex.ToString());
|
||||
}
|
||||
SupportClass.WriteStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000163 RID: 355 RVA: 0x0000C65C File Offset: 0x0000A85C
|
||||
private void SendToSocket(byte[] data, int length)
|
||||
{
|
||||
bool isSimulationEnabled = base.NetworkSimulationSettings.IsSimulationEnabled;
|
||||
if (isSimulationEnabled)
|
||||
{
|
||||
byte[] array = new byte[length];
|
||||
Buffer.BlockCopy(data, 0, array, 0, length);
|
||||
base.SendNetworkSimulated(array);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rt.Send(data, length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000164 RID: 356 RVA: 0x0000C6A8 File Offset: 0x0000A8A8
|
||||
private void SendDataEncrypted(byte[] data, int length)
|
||||
{
|
||||
bool flag = this.bufferForEncryption == null || this.bufferForEncryption.Length != base.mtu;
|
||||
if (flag)
|
||||
{
|
||||
this.bufferForEncryption = new byte[base.mtu];
|
||||
}
|
||||
byte[] array = this.bufferForEncryption;
|
||||
int num = 0;
|
||||
Protocol.Serialize(this.peerID, array, ref num);
|
||||
array[2] = 1;
|
||||
num++;
|
||||
Protocol.Serialize(this.challenge, array, ref num);
|
||||
data[0] = this.udpCommandCount;
|
||||
int num2 = 1;
|
||||
Protocol.Serialize(this.timeInt, data, ref num2);
|
||||
this.encryptor.Encrypt(data, length, array, ref num);
|
||||
Buffer.BlockCopy(this.encryptor.FinishHMAC(array, 0, num), 0, array, num, EnetPeer.HMAC_SIZE);
|
||||
this.SendToSocket(array, num + EnetPeer.HMAC_SIZE);
|
||||
}
|
||||
|
||||
// Token: 0x06000165 RID: 357 RVA: 0x0000C770 File Offset: 0x0000A970
|
||||
internal void QueueSentCommand(NCommand command)
|
||||
{
|
||||
command.commandSentTime = this.timeInt;
|
||||
command.commandSentCount += 1;
|
||||
bool flag = command.roundTripTimeout == 0;
|
||||
if (flag)
|
||||
{
|
||||
command.roundTripTimeout = this.roundTripTime + 4 * this.roundTripTimeVariance;
|
||||
command.timeoutTime = this.timeInt + base.DisconnectTimeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = command.commandSentCount <= base.QuickResendAttempts + 1;
|
||||
if (!flag2)
|
||||
{
|
||||
command.roundTripTimeout *= 2;
|
||||
}
|
||||
}
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
bool flag3 = this.sentReliableCommands.Count == 0;
|
||||
if (flag3)
|
||||
{
|
||||
int num = command.commandSentTime + command.roundTripTimeout;
|
||||
bool flag4 = num < this.timeoutInt;
|
||||
if (flag4)
|
||||
{
|
||||
this.timeoutInt = num;
|
||||
}
|
||||
}
|
||||
this.reliableCommandsSent++;
|
||||
this.sentReliableCommands.Add(command);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000166 RID: 358 RVA: 0x0000C884 File Offset: 0x0000AA84
|
||||
internal void QueueOutgoingReliableCommand(NCommand command)
|
||||
{
|
||||
EnetChannel channel = this.GetChannel(command.commandChannelID);
|
||||
EnetChannel enetChannel = channel;
|
||||
lock (enetChannel)
|
||||
{
|
||||
bool flag = command.reliableSequenceNumber == 0;
|
||||
if (flag)
|
||||
{
|
||||
EnetChannel enetChannel2 = channel;
|
||||
int num = enetChannel2.outgoingReliableSequenceNumber + 1;
|
||||
enetChannel2.outgoingReliableSequenceNumber = num;
|
||||
command.reliableSequenceNumber = num;
|
||||
}
|
||||
channel.outgoingReliableCommandsList.Enqueue(command);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000167 RID: 359 RVA: 0x0000C8F8 File Offset: 0x0000AAF8
|
||||
internal void QueueOutgoingUnreliableCommand(NCommand command)
|
||||
{
|
||||
EnetChannel channel = this.GetChannel(command.commandChannelID);
|
||||
EnetChannel enetChannel = channel;
|
||||
lock (enetChannel)
|
||||
{
|
||||
command.reliableSequenceNumber = channel.outgoingReliableSequenceNumber;
|
||||
EnetChannel enetChannel2 = channel;
|
||||
int num = enetChannel2.outgoingUnreliableSequenceNumber + 1;
|
||||
enetChannel2.outgoingUnreliableSequenceNumber = num;
|
||||
command.unreliableSequenceNumber = num;
|
||||
channel.outgoingUnreliableCommandsList.Enqueue(command);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000168 RID: 360 RVA: 0x0000C968 File Offset: 0x0000AB68
|
||||
internal void QueueOutgoingAcknowledgement(NCommand readCommand, int sendTime)
|
||||
{
|
||||
StreamBuffer streamBuffer = this.outgoingAcknowledgementsPool;
|
||||
lock (streamBuffer)
|
||||
{
|
||||
int num;
|
||||
byte[] bufferAndAdvance = this.outgoingAcknowledgementsPool.GetBufferAndAdvance(20, out num);
|
||||
NCommand.CreateAck(bufferAndAdvance, num, readCommand, sendTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000169 RID: 361 RVA: 0x0000C9BC File Offset: 0x0000ABBC
|
||||
internal override void ReceiveIncomingCommands(byte[] inBuff, int dataLength)
|
||||
{
|
||||
this.timestampOfLastReceive = SupportClass.GetTickCount();
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
short num2;
|
||||
Protocol.Deserialize(out num2, inBuff, ref num);
|
||||
byte b = inBuff[num++];
|
||||
bool flag = b == 1;
|
||||
int num3;
|
||||
byte b2;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.decryptor == null;
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, "Got encrypted packet, but encryption is not set up. Packet ignored");
|
||||
return;
|
||||
}
|
||||
this.datagramEncryptedConnection = true;
|
||||
bool flag3 = !this.decryptor.CheckHMAC(inBuff, dataLength);
|
||||
if (flag3)
|
||||
{
|
||||
this.packetLossByCrc++;
|
||||
bool flag4 = this.peerConnectionState != PeerBase.ConnectionStateValue.Disconnected && base.debugOut >= DebugLevel.INFO;
|
||||
if (flag4)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Ignored package due to wrong HMAC.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
Protocol.Deserialize(out num3, inBuff, ref num);
|
||||
inBuff = this.decryptor.DecryptBufferWithIV(inBuff, num, dataLength - num - EnetPeer.HMAC_SIZE, out dataLength);
|
||||
dataLength = inBuff.Length;
|
||||
num = 0;
|
||||
b2 = inBuff[num++];
|
||||
Protocol.Deserialize(out this.serverSentTime, inBuff, ref num);
|
||||
this.bytesIn += (long)(12 + EnetPeer.IV_SIZE + EnetPeer.HMAC_SIZE + dataLength + (EnetPeer.BLOCK_SIZE - dataLength % EnetPeer.BLOCK_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = this.datagramEncryptedConnection;
|
||||
if (flag5)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.WARNING, "Got not encrypted packet, but expected only encrypted. Packet ignored");
|
||||
return;
|
||||
}
|
||||
b2 = inBuff[num++];
|
||||
Protocol.Deserialize(out this.serverSentTime, inBuff, ref num);
|
||||
Protocol.Deserialize(out num3, inBuff, ref num);
|
||||
bool flag6 = b == 204;
|
||||
if (flag6)
|
||||
{
|
||||
int num4;
|
||||
Protocol.Deserialize(out num4, inBuff, ref num);
|
||||
this.bytesIn += 4L;
|
||||
num -= 4;
|
||||
Protocol.Serialize(0, inBuff, ref num);
|
||||
uint num5 = SupportClass.CalculateCrc(inBuff, dataLength);
|
||||
bool flag7 = num4 != (int)num5;
|
||||
if (flag7)
|
||||
{
|
||||
this.packetLossByCrc++;
|
||||
bool flag8 = this.peerConnectionState != PeerBase.ConnectionStateValue.Disconnected && base.debugOut >= DebugLevel.INFO;
|
||||
if (flag8)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, string.Format("Ignored package due to wrong CRC. Incoming: {0:X} Local: {1:X}", (uint)num4, num5));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.bytesIn += 12L;
|
||||
}
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
TrafficStats trafficStatsIncoming = base.TrafficStatsIncoming;
|
||||
int totalPacketCount = trafficStatsIncoming.TotalPacketCount;
|
||||
trafficStatsIncoming.TotalPacketCount = totalPacketCount + 1;
|
||||
base.TrafficStatsIncoming.TotalCommandsInPackets += (int)b2;
|
||||
}
|
||||
bool flag9 = (int)b2 > this.commandBufferSize || b2 <= 0;
|
||||
if (flag9)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "too many/few incoming commands in package: ", b2, " > ", this.commandBufferSize }));
|
||||
}
|
||||
bool flag10 = num3 != this.challenge;
|
||||
if (flag10)
|
||||
{
|
||||
this.packetLossByChallenge++;
|
||||
bool flag11 = this.peerConnectionState != PeerBase.ConnectionStateValue.Disconnected && base.debugOut >= DebugLevel.ALL;
|
||||
if (flag11)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, string.Concat(new object[] { "Info: Ignoring received package due to wrong challenge. Challenge in-package!=local:", num3, "!=", this.challenge, " Commands in it: ", b2 }));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
for (int i = 0; i < (int)b2; i++)
|
||||
{
|
||||
NCommand readCommand = new NCommand(this, inBuff, ref num);
|
||||
bool flag12 = readCommand.commandType != 1;
|
||||
if (flag12)
|
||||
{
|
||||
base.EnqueueActionForDispatch(delegate
|
||||
{
|
||||
this.ExecuteCommand(readCommand);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ExecuteCommand(readCommand);
|
||||
}
|
||||
bool flag13 = (readCommand.commandFlags & 1) > 0;
|
||||
if (flag13)
|
||||
{
|
||||
bool flag14 = this.InReliableLog != null;
|
||||
if (flag14)
|
||||
{
|
||||
this.InReliableLog.Enqueue(new CmdLogReceivedReliable(readCommand, this.timeInt, this.roundTripTime, this.roundTripTimeVariance, this.timeInt - this.timeLastSendOutgoing, this.timeInt - this.timeLastSendAck));
|
||||
base.CommandLogResize();
|
||||
}
|
||||
this.QueueOutgoingAcknowledgement(readCommand, this.serverSentTime);
|
||||
bool trafficStatsEnabled2 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled2)
|
||||
{
|
||||
base.TrafficStatsIncoming.TimestampOfLastReliableCommand = SupportClass.GetTickCount();
|
||||
base.TrafficStatsOutgoing.CountControlCommand(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag15 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag15)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Format("Exception while reading commands from incoming data: {0}", ex));
|
||||
}
|
||||
SupportClass.WriteStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600016A RID: 362 RVA: 0x0000CEA8 File Offset: 0x0000B0A8
|
||||
internal bool ExecuteCommand(NCommand command)
|
||||
{
|
||||
bool flag = true;
|
||||
switch (command.commandType)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsIncoming.TimestampOfLastAck = SupportClass.GetTickCount();
|
||||
base.TrafficStatsIncoming.CountControlCommand(command.Size);
|
||||
}
|
||||
this.timeLastAckReceive = this.timeInt;
|
||||
this.lastRoundTripTime = this.timeInt - command.ackReceivedSentTime;
|
||||
NCommand ncommand = this.RemoveSentReliableCommand(command.ackReceivedReliableSequenceNumber, (int)command.commandChannelID);
|
||||
bool flag2 = this.CommandLog != null;
|
||||
if (flag2)
|
||||
{
|
||||
this.CommandLog.Enqueue(new CmdLogReceivedAck(command, this.timeInt, this.roundTripTime, this.roundTripTimeVariance));
|
||||
base.CommandLogResize();
|
||||
}
|
||||
bool flag3 = ncommand != null;
|
||||
if (flag3)
|
||||
{
|
||||
bool flag4 = ncommand.commandType == 12;
|
||||
if (flag4)
|
||||
{
|
||||
bool flag5 = this.lastRoundTripTime <= this.roundTripTime;
|
||||
if (flag5)
|
||||
{
|
||||
this.serverTimeOffset = this.serverSentTime + (this.lastRoundTripTime >> 1) - SupportClass.GetTickCount();
|
||||
this.serverTimeOffsetIsAvailable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.FetchServerTimestamp();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.UpdateRoundTripTimeAndVariance(this.lastRoundTripTime);
|
||||
bool flag6 = ncommand.commandType == 4 && this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnecting;
|
||||
if (flag6)
|
||||
{
|
||||
bool flag7 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag7)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Received disconnect ACK by server");
|
||||
}
|
||||
base.EnqueueActionForDispatch(delegate
|
||||
{
|
||||
this.rt.Disconnect();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag8 = ncommand.commandType == 2;
|
||||
if (flag8)
|
||||
{
|
||||
this.roundTripTime = this.lastRoundTripTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 5:
|
||||
{
|
||||
bool trafficStatsEnabled2 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled2)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountControlCommand(command.Size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
bool trafficStatsEnabled3 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled3)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountControlCommand(command.Size);
|
||||
}
|
||||
bool flag9 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connecting;
|
||||
if (flag9)
|
||||
{
|
||||
byte[] array = base.PrepareConnectData(base.ServerAddress, this.AppId, this.CustomInitData);
|
||||
this.CreateAndEnqueueCommand(6, array, 0);
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Connected;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
bool trafficStatsEnabled4 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled4)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountControlCommand(command.Size);
|
||||
}
|
||||
StatusCode statusCode = StatusCode.DisconnectByServer;
|
||||
bool flag10 = command.reservedByte == 1;
|
||||
if (flag10)
|
||||
{
|
||||
statusCode = StatusCode.DisconnectByServerLogic;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag11 = command.reservedByte == 3;
|
||||
if (flag11)
|
||||
{
|
||||
statusCode = StatusCode.DisconnectByServerUserLimit;
|
||||
}
|
||||
}
|
||||
bool flag12 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag12)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[]
|
||||
{
|
||||
"Server ",
|
||||
base.ServerAddress,
|
||||
" sent disconnect. PeerId: ",
|
||||
(ushort)this.peerID,
|
||||
" RTT/Variance:",
|
||||
this.roundTripTime,
|
||||
"/",
|
||||
this.roundTripTimeVariance,
|
||||
" reason byte: ",
|
||||
command.reservedByte
|
||||
}));
|
||||
}
|
||||
PeerBase.ConnectionStateValue peerConnectionState = this.peerConnectionState;
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnecting;
|
||||
base.Listener.OnStatusChanged(statusCode);
|
||||
this.peerConnectionState = peerConnectionState;
|
||||
this.Disconnect();
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
bool trafficStatsEnabled5 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled5)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountReliableOpCommand(command.Size);
|
||||
}
|
||||
bool flag13 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connected;
|
||||
if (flag13)
|
||||
{
|
||||
flag = this.QueueIncomingCommand(command);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
bool trafficStatsEnabled6 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled6)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountUnreliableOpCommand(command.Size);
|
||||
}
|
||||
bool flag14 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connected;
|
||||
if (flag14)
|
||||
{
|
||||
flag = this.QueueIncomingCommand(command);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
bool trafficStatsEnabled7 = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled7)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountFragmentOpCommand(command.Size);
|
||||
}
|
||||
bool flag15 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connected;
|
||||
if (flag15)
|
||||
{
|
||||
bool flag16 = command.fragmentNumber > command.fragmentCount || command.fragmentOffset >= command.totalLength || command.fragmentOffset + command.Payload.Length > command.totalLength;
|
||||
if (flag16)
|
||||
{
|
||||
bool flag17 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag17)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Received fragment has bad size: " + command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = this.QueueIncomingCommand(command);
|
||||
bool flag18 = flag;
|
||||
if (flag18)
|
||||
{
|
||||
EnetChannel channel = this.GetChannel(command.commandChannelID);
|
||||
bool flag19 = command.reliableSequenceNumber == command.startSequenceNumber;
|
||||
if (flag19)
|
||||
{
|
||||
command.fragmentsRemaining--;
|
||||
int num = command.startSequenceNumber + 1;
|
||||
while (command.fragmentsRemaining > 0 && num < command.startSequenceNumber + command.fragmentCount)
|
||||
{
|
||||
bool flag20 = channel.ContainsReliableSequenceNumber(num++);
|
||||
if (flag20)
|
||||
{
|
||||
command.fragmentsRemaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag21 = channel.ContainsReliableSequenceNumber(command.startSequenceNumber);
|
||||
if (flag21)
|
||||
{
|
||||
NCommand ncommand2 = channel.FetchReliableSequenceNumber(command.startSequenceNumber);
|
||||
ncommand2.fragmentsRemaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x0600016B RID: 363 RVA: 0x0000D41C File Offset: 0x0000B61C
|
||||
internal bool QueueIncomingCommand(NCommand command)
|
||||
{
|
||||
EnetChannel channel = this.GetChannel(command.commandChannelID);
|
||||
bool flag = channel == null;
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Received command for non-existing channel: " + command.commandChannelID);
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = base.debugOut >= DebugLevel.ALL;
|
||||
if (flag4)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, string.Concat(new object[] { "queueIncomingCommand() ", command, " channel seq# r/u: ", channel.incomingReliableSequenceNumber, "/", channel.incomingUnreliableSequenceNumber }));
|
||||
}
|
||||
bool flag5 = command.commandFlags == 1;
|
||||
if (flag5)
|
||||
{
|
||||
bool flag6 = command.reliableSequenceNumber <= channel.incomingReliableSequenceNumber;
|
||||
if (flag6)
|
||||
{
|
||||
bool flag7 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag7)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[] { "incoming command ", command, " is old (not saving it). Dispatched incomingReliableSequenceNumber: ", channel.incomingReliableSequenceNumber }));
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag8 = channel.ContainsReliableSequenceNumber(command.reliableSequenceNumber);
|
||||
if (flag8)
|
||||
{
|
||||
bool flag9 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag9)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[]
|
||||
{
|
||||
"Info: command was received before! Old/New: ",
|
||||
channel.FetchReliableSequenceNumber(command.reliableSequenceNumber),
|
||||
"/",
|
||||
command,
|
||||
" inReliableSeq#: ",
|
||||
channel.incomingReliableSequenceNumber
|
||||
}));
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
channel.incomingReliableCommandsList.Add(command.reliableSequenceNumber, command);
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag10 = command.commandFlags == 0;
|
||||
if (flag10)
|
||||
{
|
||||
bool flag11 = command.reliableSequenceNumber < channel.incomingReliableSequenceNumber;
|
||||
if (flag11)
|
||||
{
|
||||
bool flag12 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag12)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, "incoming reliable-seq# < Dispatched-rel-seq#. not saved.");
|
||||
}
|
||||
flag3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag13 = command.unreliableSequenceNumber <= channel.incomingUnreliableSequenceNumber;
|
||||
if (flag13)
|
||||
{
|
||||
bool flag14 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag14)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, "incoming unreliable-seq# < Dispatched-unrel-seq#. not saved.");
|
||||
}
|
||||
flag3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag15 = channel.ContainsUnreliableSequenceNumber(command.unreliableSequenceNumber);
|
||||
if (flag15)
|
||||
{
|
||||
bool flag16 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag16)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, string.Concat(new object[]
|
||||
{
|
||||
"command was received before! Old/New: ",
|
||||
channel.incomingUnreliableCommandsList[command.unreliableSequenceNumber],
|
||||
"/",
|
||||
command
|
||||
}));
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
channel.incomingUnreliableCommandsList.Add(command.unreliableSequenceNumber, command);
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600016C RID: 364 RVA: 0x0000D71C File Offset: 0x0000B91C
|
||||
internal NCommand RemoveSentReliableCommand(int ackReceivedReliableSequenceNumber, int ackReceivedChannel)
|
||||
{
|
||||
NCommand ncommand = null;
|
||||
List<NCommand> list = this.sentReliableCommands;
|
||||
lock (list)
|
||||
{
|
||||
foreach (NCommand ncommand2 in this.sentReliableCommands)
|
||||
{
|
||||
bool flag = ncommand2 != null && ncommand2.reliableSequenceNumber == ackReceivedReliableSequenceNumber && (int)ncommand2.commandChannelID == ackReceivedChannel;
|
||||
if (flag)
|
||||
{
|
||||
ncommand = ncommand2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool flag2 = ncommand != null;
|
||||
if (flag2)
|
||||
{
|
||||
this.sentReliableCommands.Remove(ncommand);
|
||||
bool flag3 = this.sentReliableCommands.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
this.timeoutInt = this.timeInt + 25;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = base.debugOut >= DebugLevel.ALL && this.peerConnectionState != PeerBase.ConnectionStateValue.Connected && this.peerConnectionState != PeerBase.ConnectionStateValue.Disconnecting;
|
||||
if (flag4)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, string.Format("No sent command for ACK (Ch: {0} Sq#: {1}). PeerState: {2}.", ackReceivedReliableSequenceNumber, ackReceivedChannel, this.peerConnectionState));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ncommand;
|
||||
}
|
||||
|
||||
// Token: 0x0600016D RID: 365 RVA: 0x0000D854 File Offset: 0x0000BA54
|
||||
internal string CommandListToString(NCommand[] list)
|
||||
{
|
||||
bool flag = base.debugOut < DebugLevel.ALL;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < list.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(i + "=");
|
||||
stringBuilder.Append(list[i]);
|
||||
stringBuilder.Append(" # ");
|
||||
}
|
||||
text = stringBuilder.ToString();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x040000A9 RID: 169
|
||||
private const int CRC_LENGTH = 4;
|
||||
|
||||
// Token: 0x040000AA RID: 170
|
||||
private static readonly int HMAC_SIZE = 32;
|
||||
|
||||
// Token: 0x040000AB RID: 171
|
||||
private static readonly int BLOCK_SIZE = 16;
|
||||
|
||||
// Token: 0x040000AC RID: 172
|
||||
private static readonly int IV_SIZE = 16;
|
||||
|
||||
// Token: 0x040000AD RID: 173
|
||||
private const int EncryptedDataGramHeaderSize = 7;
|
||||
|
||||
// Token: 0x040000AE RID: 174
|
||||
private const int EncryptedHeaderSize = 5;
|
||||
|
||||
// Token: 0x040000AF RID: 175
|
||||
private List<NCommand> sentReliableCommands = new List<NCommand>();
|
||||
|
||||
// Token: 0x040000B0 RID: 176
|
||||
private StreamBuffer outgoingAcknowledgementsPool;
|
||||
|
||||
// Token: 0x040000B1 RID: 177
|
||||
internal readonly int windowSize = 128;
|
||||
|
||||
// Token: 0x040000B2 RID: 178
|
||||
private byte udpCommandCount;
|
||||
|
||||
// Token: 0x040000B3 RID: 179
|
||||
private byte[] udpBuffer;
|
||||
|
||||
// Token: 0x040000B4 RID: 180
|
||||
private int udpBufferIndex;
|
||||
|
||||
// Token: 0x040000B5 RID: 181
|
||||
private int udpBufferLength;
|
||||
|
||||
// Token: 0x040000B6 RID: 182
|
||||
private byte[] bufferForEncryption;
|
||||
|
||||
// Token: 0x040000B7 RID: 183
|
||||
internal int challenge;
|
||||
|
||||
// Token: 0x040000B8 RID: 184
|
||||
internal int reliableCommandsRepeated;
|
||||
|
||||
// Token: 0x040000B9 RID: 185
|
||||
internal int reliableCommandsSent;
|
||||
|
||||
// Token: 0x040000BA RID: 186
|
||||
internal int serverSentTime;
|
||||
|
||||
// Token: 0x040000BB RID: 187
|
||||
internal static readonly byte[] udpHeader0xF3 = new byte[] { 243, 2 };
|
||||
|
||||
// Token: 0x040000BC RID: 188
|
||||
internal static readonly byte[] messageHeader = EnetPeer.udpHeader0xF3;
|
||||
|
||||
// Token: 0x040000BD RID: 189
|
||||
protected bool datagramEncryptedConnection;
|
||||
|
||||
// Token: 0x040000BE RID: 190
|
||||
private EnetChannel[] channelArray = new EnetChannel[0];
|
||||
|
||||
// Token: 0x040000BF RID: 191
|
||||
private const byte ControlChannelNumber = 255;
|
||||
|
||||
// Token: 0x040000C0 RID: 192
|
||||
protected internal const short PeerIdForConnect = -1;
|
||||
|
||||
// Token: 0x040000C1 RID: 193
|
||||
protected internal const short PeerIdForConnectTrace = -2;
|
||||
|
||||
// Token: 0x040000C2 RID: 194
|
||||
private Queue<int> commandsToRemove = new Queue<int>();
|
||||
|
||||
// Token: 0x040000C3 RID: 195
|
||||
private Queue<NCommand> commandsToResend = new Queue<NCommand>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000021 RID: 33
|
||||
public class EventData
|
||||
{
|
||||
// Token: 0x17000068 RID: 104
|
||||
public object this[byte key]
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj;
|
||||
this.Parameters.TryGetValue(key, out obj);
|
||||
return obj;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Parameters[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001B6 RID: 438 RVA: 0x0000F2D8 File Offset: 0x0000D4D8
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Event {0}.", this.Code.ToString());
|
||||
}
|
||||
|
||||
// Token: 0x060001B7 RID: 439 RVA: 0x0000F300 File Offset: 0x0000D500
|
||||
public string ToStringFull()
|
||||
{
|
||||
return string.Format("Event {0}: {1}", this.Code, SupportClass.DictionaryToString(this.Parameters));
|
||||
}
|
||||
|
||||
// Token: 0x04000113 RID: 275
|
||||
public byte Code;
|
||||
|
||||
// Token: 0x04000114 RID: 276
|
||||
public Dictionary<byte, object> Parameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000007 RID: 7
|
||||
public class Hashtable : Dictionary<object, object>
|
||||
{
|
||||
// Token: 0x06000064 RID: 100 RVA: 0x00006C48 File Offset: 0x00004E48
|
||||
public Hashtable()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000065 RID: 101 RVA: 0x00006C52 File Offset: 0x00004E52
|
||||
public Hashtable(int x)
|
||||
: base(x)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000005 RID: 5
|
||||
public object this[object key]
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = null;
|
||||
base.TryGetValue(key, out obj);
|
||||
return obj;
|
||||
}
|
||||
set
|
||||
{
|
||||
base[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000068 RID: 104 RVA: 0x00006C8C File Offset: 0x00004E8C
|
||||
public new IEnumerator<DictionaryEntry> GetEnumerator()
|
||||
{
|
||||
return new DictionaryEntryEnumerator(((IDictionary)this).GetEnumerator());
|
||||
}
|
||||
|
||||
// Token: 0x06000069 RID: 105 RVA: 0x00006CAC File Offset: 0x00004EAC
|
||||
public override string ToString()
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (object obj in base.Keys)
|
||||
{
|
||||
bool flag = obj == null || this[obj] == null;
|
||||
if (flag)
|
||||
{
|
||||
list.Add(obj + "=" + this[obj]);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(string.Concat(new object[]
|
||||
{
|
||||
"(",
|
||||
obj.GetType(),
|
||||
")",
|
||||
obj,
|
||||
"=(",
|
||||
this[obj].GetType(),
|
||||
")",
|
||||
this[obj]
|
||||
}));
|
||||
}
|
||||
}
|
||||
return string.Join(", ", list.ToArray());
|
||||
}
|
||||
|
||||
// Token: 0x0600006A RID: 106 RVA: 0x00006DAC File Offset: 0x00004FAC
|
||||
public object Clone()
|
||||
{
|
||||
return new Dictionary<object, object>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000B RID: 11
|
||||
public interface IPhotonPeerListener
|
||||
{
|
||||
// Token: 0x06000083 RID: 131
|
||||
void DebugReturn(DebugLevel level, string message);
|
||||
|
||||
// Token: 0x06000084 RID: 132
|
||||
void OnOperationResponse(OperationResponse operationResponse);
|
||||
|
||||
// Token: 0x06000085 RID: 133
|
||||
void OnStatusChanged(StatusCode statusCode);
|
||||
|
||||
// Token: 0x06000086 RID: 134
|
||||
void OnEvent(EventData eventData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000031 RID: 49
|
||||
public abstract class IPhotonSocket
|
||||
{
|
||||
// Token: 0x1700006B RID: 107
|
||||
// (get) Token: 0x0600021B RID: 539 RVA: 0x00011B04 File Offset: 0x0000FD04
|
||||
protected IPhotonPeerListener Listener
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.peerBase.Listener;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006C RID: 108
|
||||
// (get) Token: 0x0600021C RID: 540 RVA: 0x00011B24 File Offset: 0x0000FD24
|
||||
protected internal int MTU
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.peerBase.mtu;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006D RID: 109
|
||||
// (get) Token: 0x0600021D RID: 541 RVA: 0x00011B41 File Offset: 0x0000FD41
|
||||
// (set) Token: 0x0600021E RID: 542 RVA: 0x00011B49 File Offset: 0x0000FD49
|
||||
public PhotonSocketState State { get; protected set; }
|
||||
|
||||
// Token: 0x1700006E RID: 110
|
||||
// (get) Token: 0x0600021F RID: 543 RVA: 0x00011B54 File Offset: 0x0000FD54
|
||||
public bool Connected
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.State == PhotonSocketState.Connected;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006F RID: 111
|
||||
// (get) Token: 0x06000220 RID: 544 RVA: 0x00011B70 File Offset: 0x0000FD70
|
||||
public string ConnectAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.peerBase.ServerAddress;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000070 RID: 112
|
||||
// (get) Token: 0x06000221 RID: 545 RVA: 0x00011B8D File Offset: 0x0000FD8D
|
||||
// (set) Token: 0x06000222 RID: 546 RVA: 0x00011B95 File Offset: 0x0000FD95
|
||||
public string ServerAddress { get; protected set; }
|
||||
|
||||
// Token: 0x17000071 RID: 113
|
||||
// (get) Token: 0x06000223 RID: 547 RVA: 0x00011B9E File Offset: 0x0000FD9E
|
||||
// (set) Token: 0x06000224 RID: 548 RVA: 0x00011BA6 File Offset: 0x0000FDA6
|
||||
public int ServerPort { get; protected set; }
|
||||
|
||||
// Token: 0x17000072 RID: 114
|
||||
// (get) Token: 0x06000225 RID: 549 RVA: 0x00011BAF File Offset: 0x0000FDAF
|
||||
// (set) Token: 0x06000226 RID: 550 RVA: 0x00011BB7 File Offset: 0x0000FDB7
|
||||
public bool AddressResolvedAsIpv6 { get; protected internal set; }
|
||||
|
||||
// Token: 0x17000073 RID: 115
|
||||
// (get) Token: 0x06000227 RID: 551 RVA: 0x00011BC0 File Offset: 0x0000FDC0
|
||||
// (set) Token: 0x06000228 RID: 552 RVA: 0x00011BC8 File Offset: 0x0000FDC8
|
||||
public string UrlProtocol { get; protected set; }
|
||||
|
||||
// Token: 0x17000074 RID: 116
|
||||
// (get) Token: 0x06000229 RID: 553 RVA: 0x00011BD1 File Offset: 0x0000FDD1
|
||||
// (set) Token: 0x0600022A RID: 554 RVA: 0x00011BD9 File Offset: 0x0000FDD9
|
||||
public string UrlPath { get; protected set; }
|
||||
|
||||
// Token: 0x0600022B RID: 555 RVA: 0x00011BE4 File Offset: 0x0000FDE4
|
||||
public IPhotonSocket(PeerBase peerBase)
|
||||
{
|
||||
bool flag = peerBase == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new Exception("Can't init without peer");
|
||||
}
|
||||
this.Protocol = peerBase.usedProtocol;
|
||||
this.peerBase = peerBase;
|
||||
}
|
||||
|
||||
// Token: 0x0600022C RID: 556 RVA: 0x00011C20 File Offset: 0x0000FE20
|
||||
public virtual bool Connect()
|
||||
{
|
||||
bool flag = this.State > PhotonSocketState.Disconnected;
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.peerBase.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
this.peerBase.Listener.DebugReturn(DebugLevel.ERROR, "Connect() failed: connection in State: " + this.State);
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = this.peerBase == null || this.Protocol != this.peerBase.usedProtocol;
|
||||
if (flag4)
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
string text;
|
||||
ushort num;
|
||||
string text2;
|
||||
string text3;
|
||||
bool flag5 = !this.TryParseAddress(this.peerBase.ServerAddress, out text, out num, out text2, out text3);
|
||||
if (flag5)
|
||||
{
|
||||
bool flag6 = this.peerBase.debugOut >= DebugLevel.ERROR;
|
||||
if (flag6)
|
||||
{
|
||||
this.peerBase.Listener.DebugReturn(DebugLevel.ERROR, "Failed parsing address: " + this.peerBase.ServerAddress);
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ServerAddress = text;
|
||||
this.ServerPort = (int)num;
|
||||
this.UrlProtocol = text2;
|
||||
this.UrlPath = text3;
|
||||
bool flag7 = this.peerBase.debugOut >= DebugLevel.ALL;
|
||||
if (flag7)
|
||||
{
|
||||
this.Listener.DebugReturn(DebugLevel.ALL, string.Concat(new object[] { "IPhotonSocket.Connect() ", this.ServerAddress, ":", this.ServerPort, " this.Protocol: ", this.Protocol }));
|
||||
}
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600022D RID: 557
|
||||
public abstract bool Disconnect();
|
||||
|
||||
// Token: 0x0600022E RID: 558
|
||||
public abstract PhotonSocketError Send(byte[] data, int length);
|
||||
|
||||
// Token: 0x0600022F RID: 559
|
||||
public abstract PhotonSocketError Receive(out byte[] data);
|
||||
|
||||
// Token: 0x06000230 RID: 560 RVA: 0x00011DB8 File Offset: 0x0000FFB8
|
||||
public void HandleReceivedDatagram(byte[] inBuffer, int length, bool willBeReused)
|
||||
{
|
||||
bool isSimulationEnabled = this.peerBase.NetworkSimulationSettings.IsSimulationEnabled;
|
||||
if (isSimulationEnabled)
|
||||
{
|
||||
if (willBeReused)
|
||||
{
|
||||
byte[] array = new byte[length];
|
||||
Buffer.BlockCopy(inBuffer, 0, array, 0, length);
|
||||
this.peerBase.ReceiveNetworkSimulated(array);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.peerBase.ReceiveNetworkSimulated(inBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.peerBase.ReceiveIncomingCommands(inBuffer, length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000231 RID: 561 RVA: 0x00011E28 File Offset: 0x00010028
|
||||
public bool ReportDebugOfLevel(DebugLevel levelOfMessage)
|
||||
{
|
||||
return this.peerBase.debugOut >= levelOfMessage;
|
||||
}
|
||||
|
||||
// Token: 0x06000232 RID: 562 RVA: 0x00011E4B File Offset: 0x0001004B
|
||||
public void EnqueueDebugReturn(DebugLevel debugLevel, string message)
|
||||
{
|
||||
this.peerBase.EnqueueDebugReturn(debugLevel, message);
|
||||
}
|
||||
|
||||
// Token: 0x06000233 RID: 563 RVA: 0x00011E5C File Offset: 0x0001005C
|
||||
protected internal void HandleException(StatusCode statusCode)
|
||||
{
|
||||
this.State = PhotonSocketState.Disconnecting;
|
||||
this.peerBase.EnqueueStatusCallback(statusCode);
|
||||
this.peerBase.EnqueueActionForDispatch(delegate
|
||||
{
|
||||
this.peerBase.Disconnect();
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x06000234 RID: 564 RVA: 0x00011E8C File Offset: 0x0001008C
|
||||
protected internal bool TryParseAddress(string url, out string address, out ushort port, out string urlProtocol, out string urlPath)
|
||||
{
|
||||
address = string.Empty;
|
||||
port = 0;
|
||||
urlProtocol = string.Empty;
|
||||
urlPath = string.Empty;
|
||||
string text = url;
|
||||
bool flag = string.IsNullOrEmpty(text);
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = text.IndexOf("://");
|
||||
bool flag3 = num >= 0;
|
||||
if (flag3)
|
||||
{
|
||||
urlProtocol = text.Substring(0, num);
|
||||
text = text.Substring(num + 3);
|
||||
}
|
||||
num = text.IndexOf("/");
|
||||
bool flag4 = num >= 0;
|
||||
if (flag4)
|
||||
{
|
||||
urlPath = text.Substring(num);
|
||||
text = text.Substring(0, num);
|
||||
}
|
||||
num = text.LastIndexOf(':');
|
||||
bool flag5 = num < 0;
|
||||
if (flag5)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = text.IndexOf(':') != num && (!text.Contains("[") || !text.Contains("]"));
|
||||
if (flag6)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
address = text.Substring(0, num);
|
||||
string text2 = text.Substring(num + 1);
|
||||
bool flag7 = ushort.TryParse(text2, out port);
|
||||
flag2 = flag7;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x06000235 RID: 565 RVA: 0x00011FA0 File Offset: 0x000101A0
|
||||
protected internal bool IsIpv6SimpleCheck(IPAddress address)
|
||||
{
|
||||
return address != null && address.ToString().Contains(":");
|
||||
}
|
||||
|
||||
// Token: 0x06000236 RID: 566 RVA: 0x00011FC8 File Offset: 0x000101C8
|
||||
protected internal static IPAddress GetIpAddress(string address)
|
||||
{
|
||||
IPAddress ipaddress = null;
|
||||
bool flag = IPAddress.TryParse(address, out ipaddress);
|
||||
IPAddress ipaddress2;
|
||||
if (flag)
|
||||
{
|
||||
ipaddress2 = ipaddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPHostEntry hostEntry = Dns.GetHostEntry(address);
|
||||
IPAddress[] addressList = hostEntry.AddressList;
|
||||
foreach (IPAddress ipaddress3 in addressList)
|
||||
{
|
||||
bool flag2 = ipaddress3.AddressFamily == AddressFamily.InterNetworkV6;
|
||||
if (flag2)
|
||||
{
|
||||
return ipaddress3;
|
||||
}
|
||||
bool flag3 = ipaddress == null && ipaddress3.AddressFamily == AddressFamily.InterNetwork;
|
||||
if (flag3)
|
||||
{
|
||||
ipaddress = ipaddress3;
|
||||
}
|
||||
}
|
||||
ipaddress2 = ipaddress;
|
||||
}
|
||||
return ipaddress2;
|
||||
}
|
||||
|
||||
// Token: 0x04000144 RID: 324
|
||||
protected internal PeerBase peerBase;
|
||||
|
||||
// Token: 0x04000145 RID: 325
|
||||
protected readonly ConnectionProtocol Protocol;
|
||||
|
||||
// Token: 0x04000146 RID: 326
|
||||
public bool PollReceive;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001E RID: 30
|
||||
public abstract class IProtocol
|
||||
{
|
||||
// Token: 0x17000065 RID: 101
|
||||
// (get) Token: 0x0600019A RID: 410
|
||||
internal abstract string protocolType { get; }
|
||||
|
||||
// Token: 0x17000066 RID: 102
|
||||
// (get) Token: 0x0600019B RID: 411
|
||||
internal abstract byte[] VersionBytes { get; }
|
||||
|
||||
// Token: 0x0600019C RID: 412
|
||||
public abstract void Serialize(StreamBuffer dout, object serObject, bool setType);
|
||||
|
||||
// Token: 0x0600019D RID: 413
|
||||
public abstract void SerializeShort(StreamBuffer dout, short serObject, bool setType);
|
||||
|
||||
// Token: 0x0600019E RID: 414
|
||||
public abstract void SerializeString(StreamBuffer dout, string serObject, bool setType);
|
||||
|
||||
// Token: 0x0600019F RID: 415
|
||||
public abstract void SerializeEventData(StreamBuffer stream, EventData serObject, bool setType);
|
||||
|
||||
// Token: 0x060001A0 RID: 416
|
||||
public abstract void SerializeOperationRequest(StreamBuffer stream, byte operationCode, Dictionary<byte, object> parameters, bool setType);
|
||||
|
||||
// Token: 0x060001A1 RID: 417
|
||||
public abstract void SerializeOperationResponse(StreamBuffer stream, OperationResponse serObject, bool setType);
|
||||
|
||||
// Token: 0x060001A2 RID: 418
|
||||
public abstract object Deserialize(StreamBuffer din, byte type);
|
||||
|
||||
// Token: 0x060001A3 RID: 419
|
||||
public abstract short DeserializeShort(StreamBuffer din);
|
||||
|
||||
// Token: 0x060001A4 RID: 420
|
||||
public abstract byte DeserializeByte(StreamBuffer din);
|
||||
|
||||
// Token: 0x060001A5 RID: 421
|
||||
public abstract EventData DeserializeEventData(StreamBuffer din);
|
||||
|
||||
// Token: 0x060001A6 RID: 422
|
||||
public abstract OperationRequest DeserializeOperationRequest(StreamBuffer din);
|
||||
|
||||
// Token: 0x060001A7 RID: 423
|
||||
public abstract OperationResponse DeserializeOperationResponse(StreamBuffer stream);
|
||||
|
||||
// Token: 0x060001A8 RID: 424 RVA: 0x0000F140 File Offset: 0x0000D340
|
||||
public byte[] Serialize(object obj)
|
||||
{
|
||||
StreamBuffer streamBuffer = new StreamBuffer(64);
|
||||
this.Serialize(streamBuffer, obj, true);
|
||||
return streamBuffer.ToArray();
|
||||
}
|
||||
|
||||
// Token: 0x060001A9 RID: 425 RVA: 0x0000F16C File Offset: 0x0000D36C
|
||||
public object Deserialize(StreamBuffer stream)
|
||||
{
|
||||
return this.Deserialize(stream, (byte)stream.ReadByte());
|
||||
}
|
||||
|
||||
// Token: 0x060001AA RID: 426 RVA: 0x0000F18C File Offset: 0x0000D38C
|
||||
public object Deserialize(byte[] serializedData)
|
||||
{
|
||||
StreamBuffer streamBuffer = new StreamBuffer(serializedData);
|
||||
return this.Deserialize(streamBuffer, (byte)streamBuffer.ReadByte());
|
||||
}
|
||||
|
||||
// Token: 0x060001AB RID: 427 RVA: 0x0000F1B4 File Offset: 0x0000D3B4
|
||||
public object DeserializeMessage(StreamBuffer stream)
|
||||
{
|
||||
return this.Deserialize(stream, (byte)stream.ReadByte());
|
||||
}
|
||||
|
||||
// Token: 0x060001AC RID: 428 RVA: 0x0000F1D4 File Offset: 0x0000D3D4
|
||||
internal void SerializeMessage(StreamBuffer ms, object msg)
|
||||
{
|
||||
this.Serialize(ms, msg, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001B RID: 27
|
||||
internal class InvocationCache
|
||||
{
|
||||
// Token: 0x17000063 RID: 99
|
||||
// (get) Token: 0x06000194 RID: 404 RVA: 0x0000EEF0 File Offset: 0x0000D0F0
|
||||
public int NextInvocationId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.nextInvocationId;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000064 RID: 100
|
||||
// (get) Token: 0x06000195 RID: 405 RVA: 0x0000EF08 File Offset: 0x0000D108
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cache.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000196 RID: 406 RVA: 0x0000EF28 File Offset: 0x0000D128
|
||||
public void Reset()
|
||||
{
|
||||
LinkedList<InvocationCache.CachedOperation> linkedList = this.cache;
|
||||
lock (linkedList)
|
||||
{
|
||||
this.nextInvocationId = 1;
|
||||
this.cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000197 RID: 407 RVA: 0x0000EF74 File Offset: 0x0000D174
|
||||
public void Invoke(int invocationId, Action action)
|
||||
{
|
||||
LinkedList<InvocationCache.CachedOperation> linkedList = this.cache;
|
||||
lock (linkedList)
|
||||
{
|
||||
bool flag = invocationId < this.nextInvocationId;
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = invocationId == this.nextInvocationId;
|
||||
if (flag2)
|
||||
{
|
||||
this.nextInvocationId++;
|
||||
action();
|
||||
bool flag3 = this.cache.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
LinkedListNode<InvocationCache.CachedOperation> linkedListNode = this.cache.First;
|
||||
while (linkedListNode != null && linkedListNode.Value.InvocationId == this.nextInvocationId)
|
||||
{
|
||||
this.nextInvocationId++;
|
||||
linkedListNode.Value.Action();
|
||||
linkedListNode = linkedListNode.Next;
|
||||
this.cache.RemoveFirst();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InvocationCache.CachedOperation cachedOperation = new InvocationCache.CachedOperation
|
||||
{
|
||||
InvocationId = invocationId,
|
||||
Action = action
|
||||
};
|
||||
bool flag4 = this.cache.Count == 0;
|
||||
if (flag4)
|
||||
{
|
||||
this.cache.AddLast(cachedOperation);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (LinkedListNode<InvocationCache.CachedOperation> linkedListNode2 = this.cache.First; linkedListNode2 != null; linkedListNode2 = linkedListNode2.Next)
|
||||
{
|
||||
bool flag5 = linkedListNode2.Value.InvocationId > invocationId;
|
||||
if (flag5)
|
||||
{
|
||||
this.cache.AddBefore(linkedListNode2, cachedOperation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.cache.AddLast(cachedOperation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000109 RID: 265
|
||||
private readonly LinkedList<InvocationCache.CachedOperation> cache = new LinkedList<InvocationCache.CachedOperation>();
|
||||
|
||||
// Token: 0x0400010A RID: 266
|
||||
private int nextInvocationId = 1;
|
||||
|
||||
// Token: 0x02000048 RID: 72
|
||||
private class CachedOperation
|
||||
{
|
||||
// Token: 0x170000A4 RID: 164
|
||||
// (get) Token: 0x060002DC RID: 732 RVA: 0x000141EB File Offset: 0x000123EB
|
||||
// (set) Token: 0x060002DD RID: 733 RVA: 0x000141F3 File Offset: 0x000123F3
|
||||
public int InvocationId { get; set; }
|
||||
|
||||
// Token: 0x170000A5 RID: 165
|
||||
// (get) Token: 0x060002DE RID: 734 RVA: 0x000141FC File Offset: 0x000123FC
|
||||
// (set) Token: 0x060002DF RID: 735 RVA: 0x00014204 File Offset: 0x00012404
|
||||
public Action Action { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000019 RID: 25
|
||||
internal class NCommand : IComparable<NCommand>
|
||||
{
|
||||
// Token: 0x17000060 RID: 96
|
||||
// (get) Token: 0x06000176 RID: 374 RVA: 0x0000DA44 File Offset: 0x0000BC44
|
||||
protected internal int SizeOfPayload
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.Payload != null) ? this.Payload.Length : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000177 RID: 375 RVA: 0x0000DA6C File Offset: 0x0000BC6C
|
||||
internal NCommand(EnetPeer peer, byte commandType, byte[] payload, byte channel)
|
||||
{
|
||||
this.commandType = commandType;
|
||||
this.commandFlags = 1;
|
||||
this.commandChannelID = channel;
|
||||
this.Payload = payload;
|
||||
this.Size = 12;
|
||||
switch (this.commandType)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
this.Size = 44;
|
||||
this.Payload = new byte[32];
|
||||
this.Payload[0] = 0;
|
||||
this.Payload[1] = 0;
|
||||
int num = 2;
|
||||
Protocol.Serialize((short)peer.mtu, this.Payload, ref num);
|
||||
this.Payload[4] = 0;
|
||||
this.Payload[5] = 0;
|
||||
this.Payload[6] = 128;
|
||||
this.Payload[7] = 0;
|
||||
this.Payload[11] = peer.ChannelCount;
|
||||
this.Payload[15] = 0;
|
||||
this.Payload[19] = 0;
|
||||
this.Payload[22] = 19;
|
||||
this.Payload[23] = 136;
|
||||
this.Payload[27] = 2;
|
||||
this.Payload[31] = 2;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
this.Size = 12;
|
||||
bool flag = peer.peerConnectionState != PeerBase.ConnectionStateValue.Connected;
|
||||
if (flag)
|
||||
{
|
||||
this.commandFlags = 2;
|
||||
bool flag2 = peer.peerConnectionState == PeerBase.ConnectionStateValue.Zombie;
|
||||
if (flag2)
|
||||
{
|
||||
this.reservedByte = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
this.Size = 12 + payload.Length;
|
||||
break;
|
||||
case 7:
|
||||
this.Size = 16 + payload.Length;
|
||||
this.commandFlags = 0;
|
||||
break;
|
||||
case 8:
|
||||
this.Size = 32 + payload.Length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000178 RID: 376 RVA: 0x0000DC00 File Offset: 0x0000BE00
|
||||
internal static void CreateAck(byte[] buffer, int offset, NCommand commandToAck, int sentTime)
|
||||
{
|
||||
buffer[offset++] = 1;
|
||||
buffer[offset++] = commandToAck.commandChannelID;
|
||||
buffer[offset++] = 0;
|
||||
buffer[offset++] = commandToAck.reservedByte;
|
||||
Protocol.Serialize(20, buffer, ref offset);
|
||||
Protocol.Serialize(commandToAck.reliableSequenceNumber, buffer, ref offset);
|
||||
Protocol.Serialize(commandToAck.reliableSequenceNumber, buffer, ref offset);
|
||||
Protocol.Serialize(sentTime, buffer, ref offset);
|
||||
}
|
||||
|
||||
// Token: 0x06000179 RID: 377 RVA: 0x0000DC70 File Offset: 0x0000BE70
|
||||
internal NCommand(EnetPeer peer, byte[] inBuff, ref int readingOffset)
|
||||
{
|
||||
int num = readingOffset;
|
||||
readingOffset = num + 1;
|
||||
this.commandType = inBuff[num];
|
||||
num = readingOffset;
|
||||
readingOffset = num + 1;
|
||||
this.commandChannelID = inBuff[num];
|
||||
num = readingOffset;
|
||||
readingOffset = num + 1;
|
||||
this.commandFlags = inBuff[num];
|
||||
num = readingOffset;
|
||||
readingOffset = num + 1;
|
||||
this.reservedByte = inBuff[num];
|
||||
Protocol.Deserialize(out this.Size, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.reliableSequenceNumber, inBuff, ref readingOffset);
|
||||
peer.bytesIn += (long)this.Size;
|
||||
switch (this.commandType)
|
||||
{
|
||||
case 1:
|
||||
Protocol.Deserialize(out this.ackReceivedReliableSequenceNumber, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.ackReceivedSentTime, inBuff, ref readingOffset);
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
short num2;
|
||||
Protocol.Deserialize(out num2, inBuff, ref readingOffset);
|
||||
readingOffset += 30;
|
||||
bool flag = peer.peerID == -1 || peer.peerID == -2;
|
||||
if (flag)
|
||||
{
|
||||
peer.peerID = num2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
this.Payload = new byte[this.Size - 12];
|
||||
break;
|
||||
case 7:
|
||||
Protocol.Deserialize(out this.unreliableSequenceNumber, inBuff, ref readingOffset);
|
||||
this.Payload = new byte[this.Size - 16];
|
||||
break;
|
||||
case 8:
|
||||
Protocol.Deserialize(out this.startSequenceNumber, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.fragmentCount, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.fragmentNumber, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.totalLength, inBuff, ref readingOffset);
|
||||
Protocol.Deserialize(out this.fragmentOffset, inBuff, ref readingOffset);
|
||||
this.Payload = new byte[this.Size - 32];
|
||||
this.fragmentsRemaining = this.fragmentCount;
|
||||
break;
|
||||
}
|
||||
bool flag2 = this.Payload != null;
|
||||
if (flag2)
|
||||
{
|
||||
Buffer.BlockCopy(inBuff, readingOffset, this.Payload, 0, this.Payload.Length);
|
||||
readingOffset += this.Payload.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600017A RID: 378 RVA: 0x0000DE6C File Offset: 0x0000C06C
|
||||
internal void SerializeHeader(byte[] buffer, ref int bufferIndex)
|
||||
{
|
||||
bool flag = this.commandHeader != null;
|
||||
if (!flag)
|
||||
{
|
||||
this.SizeOfHeader = 12;
|
||||
bool flag2 = this.commandType == 7;
|
||||
if (flag2)
|
||||
{
|
||||
this.SizeOfHeader = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = this.commandType == 8;
|
||||
if (flag3)
|
||||
{
|
||||
this.SizeOfHeader = 32;
|
||||
}
|
||||
}
|
||||
int num = bufferIndex;
|
||||
bufferIndex = num + 1;
|
||||
buffer[num] = this.commandType;
|
||||
num = bufferIndex;
|
||||
bufferIndex = num + 1;
|
||||
buffer[num] = this.commandChannelID;
|
||||
num = bufferIndex;
|
||||
bufferIndex = num + 1;
|
||||
buffer[num] = this.commandFlags;
|
||||
num = bufferIndex;
|
||||
bufferIndex = num + 1;
|
||||
buffer[num] = this.reservedByte;
|
||||
Protocol.Serialize(this.Size, buffer, ref bufferIndex);
|
||||
Protocol.Serialize(this.reliableSequenceNumber, buffer, ref bufferIndex);
|
||||
bool flag4 = this.commandType == 7;
|
||||
if (flag4)
|
||||
{
|
||||
Protocol.Serialize(this.unreliableSequenceNumber, buffer, ref bufferIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = this.commandType == 8;
|
||||
if (flag5)
|
||||
{
|
||||
Protocol.Serialize(this.startSequenceNumber, buffer, ref bufferIndex);
|
||||
Protocol.Serialize(this.fragmentCount, buffer, ref bufferIndex);
|
||||
Protocol.Serialize(this.fragmentNumber, buffer, ref bufferIndex);
|
||||
Protocol.Serialize(this.totalLength, buffer, ref bufferIndex);
|
||||
Protocol.Serialize(this.fragmentOffset, buffer, ref bufferIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600017B RID: 379 RVA: 0x0000DFA0 File Offset: 0x0000C1A0
|
||||
internal byte[] Serialize()
|
||||
{
|
||||
return this.Payload;
|
||||
}
|
||||
|
||||
// Token: 0x0600017C RID: 380 RVA: 0x0000DFB8 File Offset: 0x0000C1B8
|
||||
public int CompareTo(NCommand other)
|
||||
{
|
||||
bool flag = (this.commandFlags & 1) > 0;
|
||||
int num;
|
||||
if (flag)
|
||||
{
|
||||
num = this.reliableSequenceNumber - other.reliableSequenceNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = this.unreliableSequenceNumber - other.unreliableSequenceNumber;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600017D RID: 381 RVA: 0x0000DFF8 File Offset: 0x0000C1F8
|
||||
public override string ToString()
|
||||
{
|
||||
bool flag = this.commandType == 1;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = string.Format("CMD({1} ack for c#:{0} s#/time {2}/{3})", new object[] { this.commandChannelID, this.commandType, this.ackReceivedReliableSequenceNumber, this.ackReceivedSentTime });
|
||||
}
|
||||
else
|
||||
{
|
||||
text = string.Format("CMD({1} c#:{0} r/u: {2}/{3} st/r#/rt:{4}/{5}/{6})", new object[] { this.commandChannelID, this.commandType, this.reliableSequenceNumber, this.unreliableSequenceNumber, this.commandSentTime, this.commandSentCount, this.timeoutTime });
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x040000CD RID: 205
|
||||
internal byte commandFlags;
|
||||
|
||||
// Token: 0x040000CE RID: 206
|
||||
internal const int FLAG_RELIABLE = 1;
|
||||
|
||||
// Token: 0x040000CF RID: 207
|
||||
internal const int FLAG_UNSEQUENCED = 2;
|
||||
|
||||
// Token: 0x040000D0 RID: 208
|
||||
internal const byte FV_UNRELIABLE = 0;
|
||||
|
||||
// Token: 0x040000D1 RID: 209
|
||||
internal const byte FV_RELIABLE = 1;
|
||||
|
||||
// Token: 0x040000D2 RID: 210
|
||||
internal const byte FV_UNRELIBALE_UNSEQUENCED = 2;
|
||||
|
||||
// Token: 0x040000D3 RID: 211
|
||||
internal byte commandType;
|
||||
|
||||
// Token: 0x040000D4 RID: 212
|
||||
internal const byte CT_NONE = 0;
|
||||
|
||||
// Token: 0x040000D5 RID: 213
|
||||
internal const byte CT_ACK = 1;
|
||||
|
||||
// Token: 0x040000D6 RID: 214
|
||||
internal const byte CT_CONNECT = 2;
|
||||
|
||||
// Token: 0x040000D7 RID: 215
|
||||
internal const byte CT_VERIFYCONNECT = 3;
|
||||
|
||||
// Token: 0x040000D8 RID: 216
|
||||
internal const byte CT_DISCONNECT = 4;
|
||||
|
||||
// Token: 0x040000D9 RID: 217
|
||||
internal const byte CT_PING = 5;
|
||||
|
||||
// Token: 0x040000DA RID: 218
|
||||
internal const byte CT_SENDRELIABLE = 6;
|
||||
|
||||
// Token: 0x040000DB RID: 219
|
||||
internal const byte CT_SENDUNRELIABLE = 7;
|
||||
|
||||
// Token: 0x040000DC RID: 220
|
||||
internal const byte CT_SENDFRAGMENT = 8;
|
||||
|
||||
// Token: 0x040000DD RID: 221
|
||||
internal const byte CT_EG_SERVERTIME = 12;
|
||||
|
||||
// Token: 0x040000DE RID: 222
|
||||
internal byte commandChannelID;
|
||||
|
||||
// Token: 0x040000DF RID: 223
|
||||
internal int reliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000E0 RID: 224
|
||||
internal int unreliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000E1 RID: 225
|
||||
internal int unsequencedGroupNumber;
|
||||
|
||||
// Token: 0x040000E2 RID: 226
|
||||
internal byte reservedByte = 4;
|
||||
|
||||
// Token: 0x040000E3 RID: 227
|
||||
internal int startSequenceNumber;
|
||||
|
||||
// Token: 0x040000E4 RID: 228
|
||||
internal int fragmentCount;
|
||||
|
||||
// Token: 0x040000E5 RID: 229
|
||||
internal int fragmentNumber;
|
||||
|
||||
// Token: 0x040000E6 RID: 230
|
||||
internal int totalLength;
|
||||
|
||||
// Token: 0x040000E7 RID: 231
|
||||
internal int fragmentOffset;
|
||||
|
||||
// Token: 0x040000E8 RID: 232
|
||||
internal int fragmentsRemaining;
|
||||
|
||||
// Token: 0x040000E9 RID: 233
|
||||
internal int commandSentTime;
|
||||
|
||||
// Token: 0x040000EA RID: 234
|
||||
internal byte commandSentCount;
|
||||
|
||||
// Token: 0x040000EB RID: 235
|
||||
internal int roundTripTimeout;
|
||||
|
||||
// Token: 0x040000EC RID: 236
|
||||
internal int timeoutTime;
|
||||
|
||||
// Token: 0x040000ED RID: 237
|
||||
internal int ackReceivedReliableSequenceNumber;
|
||||
|
||||
// Token: 0x040000EE RID: 238
|
||||
internal int ackReceivedSentTime;
|
||||
|
||||
// Token: 0x040000EF RID: 239
|
||||
internal const int HEADER_UDP_PACK_LENGTH = 12;
|
||||
|
||||
// Token: 0x040000F0 RID: 240
|
||||
internal const int CmdSizeMinimum = 12;
|
||||
|
||||
// Token: 0x040000F1 RID: 241
|
||||
internal const int CmdSizeAck = 20;
|
||||
|
||||
// Token: 0x040000F2 RID: 242
|
||||
internal const int CmdSizeConnect = 44;
|
||||
|
||||
// Token: 0x040000F3 RID: 243
|
||||
internal const int CmdSizeVerifyConnect = 44;
|
||||
|
||||
// Token: 0x040000F4 RID: 244
|
||||
internal const int CmdSizeDisconnect = 12;
|
||||
|
||||
// Token: 0x040000F5 RID: 245
|
||||
internal const int CmdSizePing = 12;
|
||||
|
||||
// Token: 0x040000F6 RID: 246
|
||||
internal const int CmdSizeReliableHeader = 12;
|
||||
|
||||
// Token: 0x040000F7 RID: 247
|
||||
internal const int CmdSizeUnreliableHeader = 16;
|
||||
|
||||
// Token: 0x040000F8 RID: 248
|
||||
internal const int CmdSizeFragmentHeader = 32;
|
||||
|
||||
// Token: 0x040000F9 RID: 249
|
||||
internal const int CmdSizeMaxHeader = 36;
|
||||
|
||||
// Token: 0x040000FA RID: 250
|
||||
internal int Size;
|
||||
|
||||
// Token: 0x040000FB RID: 251
|
||||
private byte[] commandHeader;
|
||||
|
||||
// Token: 0x040000FC RID: 252
|
||||
internal int SizeOfHeader;
|
||||
|
||||
// Token: 0x040000FD RID: 253
|
||||
internal byte[] Payload;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000037 RID: 55
|
||||
public class NetworkSimulationSet
|
||||
{
|
||||
// Token: 0x17000076 RID: 118
|
||||
// (get) Token: 0x06000253 RID: 595 RVA: 0x00013108 File Offset: 0x00011308
|
||||
// (set) Token: 0x06000254 RID: 596 RVA: 0x00013120 File Offset: 0x00011320
|
||||
protected internal bool IsSimulationEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isSimulationEnabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
ManualResetEvent netSimManualResetEvent = this.NetSimManualResetEvent;
|
||||
lock (netSimManualResetEvent)
|
||||
{
|
||||
bool flag = value == this.isSimulationEnabled;
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = !value;
|
||||
if (flag2)
|
||||
{
|
||||
LinkedList<SimulationItem> netSimListIncoming = this.peerBase.NetSimListIncoming;
|
||||
lock (netSimListIncoming)
|
||||
{
|
||||
bool flag3 = this.peerBase.rt != null && this.peerBase.rt.Connected;
|
||||
if (flag3)
|
||||
{
|
||||
foreach (SimulationItem simulationItem in this.peerBase.NetSimListIncoming)
|
||||
{
|
||||
this.peerBase.ReceiveIncomingCommands(simulationItem.DelayedData, simulationItem.DelayedData.Length);
|
||||
}
|
||||
}
|
||||
this.peerBase.NetSimListIncoming.Clear();
|
||||
}
|
||||
LinkedList<SimulationItem> netSimListOutgoing = this.peerBase.NetSimListOutgoing;
|
||||
lock (netSimListOutgoing)
|
||||
{
|
||||
bool flag4 = this.peerBase.rt != null && this.peerBase.rt.Connected;
|
||||
if (flag4)
|
||||
{
|
||||
foreach (SimulationItem simulationItem2 in this.peerBase.NetSimListOutgoing)
|
||||
{
|
||||
this.peerBase.rt.Send(simulationItem2.DelayedData, simulationItem2.DelayedData.Length);
|
||||
}
|
||||
}
|
||||
this.peerBase.NetSimListOutgoing.Clear();
|
||||
}
|
||||
}
|
||||
this.isSimulationEnabled = value;
|
||||
bool flag5 = this.isSimulationEnabled;
|
||||
if (flag5)
|
||||
{
|
||||
bool flag6 = this.netSimThread == null;
|
||||
if (flag6)
|
||||
{
|
||||
this.netSimThread = new Thread(new ThreadStart(this.peerBase.NetworkSimRun));
|
||||
this.netSimThread.IsBackground = true;
|
||||
this.netSimThread.Name = "netSim" + SupportClass.GetTickCount();
|
||||
this.netSimThread.Start();
|
||||
}
|
||||
this.NetSimManualResetEvent.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NetSimManualResetEvent.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000077 RID: 119
|
||||
// (get) Token: 0x06000255 RID: 597 RVA: 0x000133E0 File Offset: 0x000115E0
|
||||
// (set) Token: 0x06000256 RID: 598 RVA: 0x000133F8 File Offset: 0x000115F8
|
||||
public int OutgoingLag
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outgoingLag;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.outgoingLag = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000078 RID: 120
|
||||
// (get) Token: 0x06000257 RID: 599 RVA: 0x00013404 File Offset: 0x00011604
|
||||
// (set) Token: 0x06000258 RID: 600 RVA: 0x0001341C File Offset: 0x0001161C
|
||||
public int OutgoingJitter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outgoingJitter;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.outgoingJitter = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000079 RID: 121
|
||||
// (get) Token: 0x06000259 RID: 601 RVA: 0x00013428 File Offset: 0x00011628
|
||||
// (set) Token: 0x0600025A RID: 602 RVA: 0x00013440 File Offset: 0x00011640
|
||||
public int OutgoingLossPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outgoingLossPercentage;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.outgoingLossPercentage = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007A RID: 122
|
||||
// (get) Token: 0x0600025B RID: 603 RVA: 0x0001344C File Offset: 0x0001164C
|
||||
// (set) Token: 0x0600025C RID: 604 RVA: 0x00013464 File Offset: 0x00011664
|
||||
public int IncomingLag
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.incomingLag;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.incomingLag = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007B RID: 123
|
||||
// (get) Token: 0x0600025D RID: 605 RVA: 0x00013470 File Offset: 0x00011670
|
||||
// (set) Token: 0x0600025E RID: 606 RVA: 0x00013488 File Offset: 0x00011688
|
||||
public int IncomingJitter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.incomingJitter;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.incomingJitter = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007C RID: 124
|
||||
// (get) Token: 0x0600025F RID: 607 RVA: 0x00013494 File Offset: 0x00011694
|
||||
// (set) Token: 0x06000260 RID: 608 RVA: 0x000134AC File Offset: 0x000116AC
|
||||
public int IncomingLossPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.incomingLossPercentage;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.incomingLossPercentage = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007D RID: 125
|
||||
// (get) Token: 0x06000261 RID: 609 RVA: 0x000134B6 File Offset: 0x000116B6
|
||||
// (set) Token: 0x06000262 RID: 610 RVA: 0x000134BE File Offset: 0x000116BE
|
||||
public int LostPackagesOut { get; internal set; }
|
||||
|
||||
// Token: 0x1700007E RID: 126
|
||||
// (get) Token: 0x06000263 RID: 611 RVA: 0x000134C7 File Offset: 0x000116C7
|
||||
// (set) Token: 0x06000264 RID: 612 RVA: 0x000134CF File Offset: 0x000116CF
|
||||
public int LostPackagesIn { get; internal set; }
|
||||
|
||||
// Token: 0x06000265 RID: 613 RVA: 0x000134D8 File Offset: 0x000116D8
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("NetworkSimulationSet {6}. Lag in={0} out={1}. Jitter in={2} out={3}. Loss in={4} out={5}.", new object[] { this.incomingLag, this.outgoingLag, this.incomingJitter, this.outgoingJitter, this.incomingLossPercentage, this.outgoingLossPercentage, this.IsSimulationEnabled });
|
||||
}
|
||||
|
||||
// Token: 0x04000155 RID: 341
|
||||
private bool isSimulationEnabled = false;
|
||||
|
||||
// Token: 0x04000156 RID: 342
|
||||
private int outgoingLag = 100;
|
||||
|
||||
// Token: 0x04000157 RID: 343
|
||||
private int outgoingJitter = 0;
|
||||
|
||||
// Token: 0x04000158 RID: 344
|
||||
private int outgoingLossPercentage = 1;
|
||||
|
||||
// Token: 0x04000159 RID: 345
|
||||
private int incomingLag = 100;
|
||||
|
||||
// Token: 0x0400015A RID: 346
|
||||
private int incomingJitter = 0;
|
||||
|
||||
// Token: 0x0400015B RID: 347
|
||||
private int incomingLossPercentage = 1;
|
||||
|
||||
// Token: 0x0400015C RID: 348
|
||||
internal PeerBase peerBase;
|
||||
|
||||
// Token: 0x0400015D RID: 349
|
||||
private Thread netSimThread;
|
||||
|
||||
// Token: 0x0400015E RID: 350
|
||||
public readonly ManualResetEvent NetSimManualResetEvent = new ManualResetEvent(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001F RID: 31
|
||||
public class OperationRequest
|
||||
{
|
||||
// Token: 0x0400010D RID: 269
|
||||
public byte OperationCode;
|
||||
|
||||
// Token: 0x0400010E RID: 270
|
||||
public Dictionary<byte, object> Parameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000020 RID: 32
|
||||
public class OperationResponse
|
||||
{
|
||||
// Token: 0x17000067 RID: 103
|
||||
public object this[byte parameterCode]
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj;
|
||||
this.Parameters.TryGetValue(parameterCode, out obj);
|
||||
return obj;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Parameters[parameterCode] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001B1 RID: 433 RVA: 0x0000F218 File Offset: 0x0000D418
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("OperationResponse {0}: ReturnCode: {1}.", this.OperationCode, this.ReturnCode);
|
||||
}
|
||||
|
||||
// Token: 0x060001B2 RID: 434 RVA: 0x0000F24C File Offset: 0x0000D44C
|
||||
public string ToStringFull()
|
||||
{
|
||||
return string.Format("OperationResponse {0}: ReturnCode: {1} ({3}). Parameters: {2}", new object[]
|
||||
{
|
||||
this.OperationCode,
|
||||
this.ReturnCode,
|
||||
SupportClass.DictionaryToString(this.Parameters),
|
||||
this.DebugMessage
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x0400010F RID: 271
|
||||
public byte OperationCode;
|
||||
|
||||
// Token: 0x04000110 RID: 272
|
||||
public short ReturnCode;
|
||||
|
||||
// Token: 0x04000111 RID: 273
|
||||
public string DebugMessage;
|
||||
|
||||
// Token: 0x04000112 RID: 274
|
||||
public Dictionary<byte, object> Parameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1309 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Photon.SocketServer.Security;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000012 RID: 18
|
||||
public abstract class PeerBase
|
||||
{
|
||||
// Token: 0x1700003D RID: 61
|
||||
// (get) Token: 0x060000FB RID: 251 RVA: 0x00008C5C File Offset: 0x00006E5C
|
||||
internal string ClientVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.ClientVersion;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003E RID: 62
|
||||
// (get) Token: 0x060000FC RID: 252 RVA: 0x00008C7C File Offset: 0x00006E7C
|
||||
internal Type SocketImplementation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.SocketImplementation;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003F RID: 63
|
||||
// (get) Token: 0x060000FD RID: 253 RVA: 0x00008C99 File Offset: 0x00006E99
|
||||
// (set) Token: 0x060000FE RID: 254 RVA: 0x00008CA1 File Offset: 0x00006EA1
|
||||
public string ServerAddress { get; internal set; }
|
||||
|
||||
// Token: 0x17000040 RID: 64
|
||||
// (get) Token: 0x060000FF RID: 255 RVA: 0x00008CAA File Offset: 0x00006EAA
|
||||
// (set) Token: 0x06000100 RID: 256 RVA: 0x00008CB2 File Offset: 0x00006EB2
|
||||
internal string HttpUrlParameters { get; set; }
|
||||
|
||||
// Token: 0x17000041 RID: 65
|
||||
// (get) Token: 0x06000101 RID: 257 RVA: 0x00008CBC File Offset: 0x00006EBC
|
||||
internal bool TrafficStatsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.TrafficStatsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000042 RID: 66
|
||||
// (get) Token: 0x06000102 RID: 258 RVA: 0x00008CDC File Offset: 0x00006EDC
|
||||
internal TrafficStats TrafficStatsIncoming
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.TrafficStatsIncoming;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000043 RID: 67
|
||||
// (get) Token: 0x06000103 RID: 259 RVA: 0x00008CFC File Offset: 0x00006EFC
|
||||
internal TrafficStats TrafficStatsOutgoing
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.TrafficStatsOutgoing;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000044 RID: 68
|
||||
// (get) Token: 0x06000104 RID: 260 RVA: 0x00008D1C File Offset: 0x00006F1C
|
||||
internal TrafficStatsGameLevel TrafficStatsGameLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.TrafficStatsGameLevel;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000045 RID: 69
|
||||
// (get) Token: 0x06000105 RID: 261 RVA: 0x00008D3C File Offset: 0x00006F3C
|
||||
internal bool crcEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.CrcEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000046 RID: 70
|
||||
// (get) Token: 0x06000106 RID: 262 RVA: 0x00008D5C File Offset: 0x00006F5C
|
||||
internal IPhotonPeerListener Listener
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.Listener;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000047 RID: 71
|
||||
// (get) Token: 0x06000107 RID: 263 RVA: 0x00008D7C File Offset: 0x00006F7C
|
||||
internal DebugLevel debugOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.DebugOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000048 RID: 72
|
||||
// (get) Token: 0x06000108 RID: 264 RVA: 0x00008D9C File Offset: 0x00006F9C
|
||||
internal int sentCountAllowance
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.SentCountAllowance;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000049 RID: 73
|
||||
// (get) Token: 0x06000109 RID: 265 RVA: 0x00008DBC File Offset: 0x00006FBC
|
||||
internal int DisconnectTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.DisconnectTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004A RID: 74
|
||||
// (get) Token: 0x0600010A RID: 266 RVA: 0x00008DDC File Offset: 0x00006FDC
|
||||
internal int timePingInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.TimePingInterval;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004B RID: 75
|
||||
// (get) Token: 0x0600010B RID: 267 RVA: 0x00008DFC File Offset: 0x00006FFC
|
||||
internal byte ChannelCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.ChannelCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004C RID: 76
|
||||
// (get) Token: 0x0600010C RID: 268 RVA: 0x00008E1C File Offset: 0x0000701C
|
||||
internal int limitOfUnreliableCommands
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.LimitOfUnreliableCommands;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004D RID: 77
|
||||
// (get) Token: 0x0600010D RID: 269 RVA: 0x00008E3C File Offset: 0x0000703C
|
||||
public byte QuickResendAttempts
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.QuickResendAttempts;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004E RID: 78
|
||||
// (get) Token: 0x0600010E RID: 270 RVA: 0x00008E5C File Offset: 0x0000705C
|
||||
public NetworkSimulationSet NetworkSimulationSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.networkSimulationSettings;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004F RID: 79
|
||||
// (get) Token: 0x0600010F RID: 271 RVA: 0x00008E74 File Offset: 0x00007074
|
||||
internal int CommandLogSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.CommandLogSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000110 RID: 272 RVA: 0x00008E94 File Offset: 0x00007094
|
||||
internal void CommandLogResize()
|
||||
{
|
||||
bool flag = this.CommandLogSize <= 0;
|
||||
if (flag)
|
||||
{
|
||||
this.CommandLog = null;
|
||||
this.InReliableLog = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.CommandLog == null || this.InReliableLog == null;
|
||||
if (flag2)
|
||||
{
|
||||
this.CommandLogInit();
|
||||
}
|
||||
while (this.CommandLog.Count > 0 && this.CommandLog.Count > this.CommandLogSize)
|
||||
{
|
||||
this.CommandLog.Dequeue();
|
||||
}
|
||||
while (this.InReliableLog.Count > 0 && this.InReliableLog.Count > this.CommandLogSize)
|
||||
{
|
||||
this.InReliableLog.Dequeue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000111 RID: 273 RVA: 0x00008F58 File Offset: 0x00007158
|
||||
internal void CommandLogInit()
|
||||
{
|
||||
bool flag = this.CommandLogSize <= 0;
|
||||
if (flag)
|
||||
{
|
||||
this.CommandLog = null;
|
||||
this.InReliableLog = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.CommandLog == null || this.InReliableLog == null;
|
||||
if (flag2)
|
||||
{
|
||||
this.CommandLog = new Queue<CmdLogItem>(this.CommandLogSize);
|
||||
this.InReliableLog = new Queue<CmdLogItem>(this.CommandLogSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CommandLog.Clear();
|
||||
this.InReliableLog.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000112 RID: 274 RVA: 0x00008FE0 File Offset: 0x000071E0
|
||||
public string CommandLogToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int num = ((this.usedProtocol != ConnectionProtocol.Udp) ? 0 : ((EnetPeer)this).reliableCommandsRepeated);
|
||||
stringBuilder.AppendFormat("PeerId: {0} Now: {1} Server: {2} State: {3} Total Resends: {4} Received {5}ms ago.\n", new object[]
|
||||
{
|
||||
this.PeerID,
|
||||
this.timeInt,
|
||||
this.ServerAddress,
|
||||
this.peerConnectionState,
|
||||
num,
|
||||
SupportClass.GetTickCount() - this.timestampOfLastReceive
|
||||
});
|
||||
bool flag = this.CommandLog == null;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = stringBuilder.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (CmdLogItem cmdLogItem in this.CommandLog)
|
||||
{
|
||||
stringBuilder.AppendLine(cmdLogItem.ToString());
|
||||
}
|
||||
stringBuilder.AppendLine("Received Reliable Log: ");
|
||||
foreach (CmdLogItem cmdLogItem2 in this.InReliableLog)
|
||||
{
|
||||
stringBuilder.AppendLine(cmdLogItem2.ToString());
|
||||
}
|
||||
text = stringBuilder.ToString();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x17000050 RID: 80
|
||||
// (get) Token: 0x06000113 RID: 275 RVA: 0x0000913C File Offset: 0x0000733C
|
||||
internal long BytesOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytesOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000051 RID: 81
|
||||
// (get) Token: 0x06000114 RID: 276 RVA: 0x00009154 File Offset: 0x00007354
|
||||
internal long BytesIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytesIn;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000052 RID: 82
|
||||
// (get) Token: 0x06000115 RID: 277
|
||||
internal abstract int QueuedIncomingCommandsCount { get; }
|
||||
|
||||
// Token: 0x17000053 RID: 83
|
||||
// (get) Token: 0x06000116 RID: 278
|
||||
internal abstract int QueuedOutgoingCommandsCount { get; }
|
||||
|
||||
// Token: 0x17000054 RID: 84
|
||||
// (get) Token: 0x06000117 RID: 279 RVA: 0x0000916C File Offset: 0x0000736C
|
||||
public virtual string PeerID
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((ushort)this.peerID).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000055 RID: 85
|
||||
// (get) Token: 0x06000118 RID: 280 RVA: 0x0000918D File Offset: 0x0000738D
|
||||
// (set) Token: 0x06000119 RID: 281 RVA: 0x00009195 File Offset: 0x00007395
|
||||
protected internal byte[] TcpConnectionPrefix { get; set; }
|
||||
|
||||
// Token: 0x0600011A RID: 282 RVA: 0x0000919E File Offset: 0x0000739E
|
||||
internal void InitOnce()
|
||||
{
|
||||
this.networkSimulationSettings.peerBase = this;
|
||||
}
|
||||
|
||||
// Token: 0x0600011B RID: 283
|
||||
internal abstract bool Connect(string serverAddress, string appID, object customData = null);
|
||||
|
||||
// Token: 0x0600011C RID: 284
|
||||
public abstract void OnConnect();
|
||||
|
||||
// Token: 0x0600011D RID: 285 RVA: 0x000091B0 File Offset: 0x000073B0
|
||||
private string GetHttpKeyValueString(Dictionary<string, string> dic)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (KeyValuePair<string, string> keyValuePair in dic)
|
||||
{
|
||||
stringBuilder.Append(keyValuePair.Key).Append("=").Append(keyValuePair.Value)
|
||||
.Append("&");
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x17000056 RID: 86
|
||||
// (get) Token: 0x0600011E RID: 286 RVA: 0x0000923C File Offset: 0x0000743C
|
||||
protected internal bool IsIpv6
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.rt != null && this.rt.AddressResolvedAsIpv6;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600011F RID: 287 RVA: 0x00009264 File Offset: 0x00007464
|
||||
[Obsolete("A IPhotonSocket should set AddressResolvedAsIpv6 as soon as the server's address is resolved and before calling OnConnect.")]
|
||||
public virtual void SetInitIPV6Bit(bool isV6)
|
||||
{
|
||||
bool flag = this.debugOut == DebugLevel.ALL;
|
||||
if (flag)
|
||||
{
|
||||
this.Listener.DebugReturn(DebugLevel.ALL, "Setting IPv6 bit " + isV6.ToString());
|
||||
}
|
||||
this.rt.AddressResolvedAsIpv6 = isV6;
|
||||
}
|
||||
|
||||
// Token: 0x06000120 RID: 288 RVA: 0x000092AC File Offset: 0x000074AC
|
||||
internal byte[] PrepareConnectData(string serverAddress, string appID, object custom)
|
||||
{
|
||||
bool flag = this.rt == null || !this.rt.Connected;
|
||||
if (flag)
|
||||
{
|
||||
this.EnqueueDebugReturn(DebugLevel.WARNING, "The peer attempts to prepare an Init-Request but the socket is not connected!?");
|
||||
}
|
||||
bool flag2 = custom == null;
|
||||
byte[] array4;
|
||||
if (flag2)
|
||||
{
|
||||
byte[] array = new byte[41];
|
||||
byte[] clientVersion = Version.clientVersion;
|
||||
array[0] = 243;
|
||||
array[1] = 0;
|
||||
array[2] = this.protocol.VersionBytes[0];
|
||||
array[3] = this.protocol.VersionBytes[1];
|
||||
array[4] = this.ppeer.ClientSdkIdShifted;
|
||||
array[5] = (byte)(clientVersion[0] << 4) | clientVersion[1];
|
||||
array[6] = clientVersion[2];
|
||||
array[7] = clientVersion[3];
|
||||
array[8] = 0;
|
||||
bool flag3 = string.IsNullOrEmpty(appID);
|
||||
if (flag3)
|
||||
{
|
||||
appID = "LoadBalancing";
|
||||
}
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
array[i + 9] = ((i < appID.Length) ? ((byte)appID[i]) : 0);
|
||||
}
|
||||
bool isIpv = this.IsIpv6;
|
||||
if (isIpv)
|
||||
{
|
||||
byte[] array2 = array;
|
||||
int num = 5;
|
||||
array2[num] |= 128;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array3 = array;
|
||||
int num2 = 5;
|
||||
array3[num2] &= 127;
|
||||
}
|
||||
array4 = array;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = custom != null;
|
||||
if (flag4)
|
||||
{
|
||||
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
||||
dictionary["init"] = null;
|
||||
dictionary["app"] = appID;
|
||||
dictionary["clientversion"] = this.ClientVersion;
|
||||
dictionary["protocol"] = this.protocol.protocolType;
|
||||
dictionary["sid"] = this.ppeer.ClientSdkIdShifted.ToString();
|
||||
byte[] array5 = null;
|
||||
int num3 = 0;
|
||||
bool flag5 = custom != null;
|
||||
if (flag5)
|
||||
{
|
||||
array5 = this.protocol.Serialize(custom);
|
||||
num3 += array5.Length;
|
||||
}
|
||||
string text = this.GetHttpKeyValueString(dictionary);
|
||||
bool isIpv2 = this.IsIpv6;
|
||||
if (isIpv2)
|
||||
{
|
||||
text += "&IPv6";
|
||||
}
|
||||
string text2 = string.Format("POST /?{0} HTTP/1.1\r\nHost: {1}\r\nContent-Length: {2}\r\n\r\n", text, serverAddress, num3);
|
||||
byte[] array6 = new byte[text2.Length + num3];
|
||||
bool flag6 = array5 != null;
|
||||
if (flag6)
|
||||
{
|
||||
Buffer.BlockCopy(array5, 0, array6, text2.Length, array5.Length);
|
||||
}
|
||||
Buffer.BlockCopy(Encoding.UTF8.GetBytes(text2), 0, array6, 0, text2.Length);
|
||||
array4 = array6;
|
||||
}
|
||||
else
|
||||
{
|
||||
array4 = null;
|
||||
}
|
||||
}
|
||||
return array4;
|
||||
}
|
||||
|
||||
// Token: 0x06000121 RID: 289 RVA: 0x00009520 File Offset: 0x00007720
|
||||
internal string PepareWebSocketUrl(string serverAddress, string appId, object customData)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(1024);
|
||||
string empty = string.Empty;
|
||||
bool flag = customData != null;
|
||||
if (flag)
|
||||
{
|
||||
byte[] array = this.protocol.Serialize(customData);
|
||||
bool flag2 = array == null;
|
||||
if (flag2)
|
||||
{
|
||||
this.EnqueueDebugReturn(DebugLevel.ERROR, "Can not deserialize custom data");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
stringBuilder.AppendFormat("app={0}&clientver={1}&sid={2}&{3}&initobj={4}", new object[]
|
||||
{
|
||||
appId,
|
||||
this.ClientVersion,
|
||||
this.ppeer.ClientSdkIdShifted,
|
||||
this.IsIpv6 ? "IPv6" : string.Empty,
|
||||
empty
|
||||
});
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06000122 RID: 290
|
||||
internal abstract void Disconnect();
|
||||
|
||||
// Token: 0x06000123 RID: 291
|
||||
internal abstract void StopConnection();
|
||||
|
||||
// Token: 0x06000124 RID: 292
|
||||
internal abstract void FetchServerTimestamp();
|
||||
|
||||
// Token: 0x06000125 RID: 293 RVA: 0x000095CC File Offset: 0x000077CC
|
||||
internal bool EnqueueOperation(Dictionary<byte, object> parameters, byte opCode, bool sendReliable, byte channelId, bool encrypted)
|
||||
{
|
||||
return this.EnqueueOperation(parameters, opCode, sendReliable, channelId, encrypted, PeerBase.EgMessageType.Operation);
|
||||
}
|
||||
|
||||
// Token: 0x06000126 RID: 294
|
||||
internal abstract bool EnqueueOperation(Dictionary<byte, object> parameters, byte opCode, bool sendReliable, byte channelId, bool encrypted, PeerBase.EgMessageType messageType);
|
||||
|
||||
// Token: 0x06000127 RID: 295
|
||||
internal abstract bool DispatchIncomingCommands();
|
||||
|
||||
// Token: 0x06000128 RID: 296
|
||||
internal abstract bool SendOutgoingCommands();
|
||||
|
||||
// Token: 0x06000129 RID: 297 RVA: 0x000095EC File Offset: 0x000077EC
|
||||
internal virtual bool SendAcksOnly()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600012A RID: 298 RVA: 0x00009600 File Offset: 0x00007800
|
||||
internal byte[] SerializeMessageToMessage(object message, bool encrypt, byte[] messageHeader, bool writeLength = true)
|
||||
{
|
||||
StreamBuffer serializeMemStream = this.SerializeMemStream;
|
||||
byte[] array3;
|
||||
lock (serializeMemStream)
|
||||
{
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
bool flag = !encrypt;
|
||||
if (flag)
|
||||
{
|
||||
this.SerializeMemStream.Write(messageHeader, 0, messageHeader.Length);
|
||||
}
|
||||
bool flag2 = message is byte[];
|
||||
bool flag3 = flag2;
|
||||
if (flag3)
|
||||
{
|
||||
byte[] array = message as byte[];
|
||||
this.SerializeMemStream.Write(array, 0, array.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.protocol.SerializeMessage(this.SerializeMemStream, message);
|
||||
}
|
||||
if (encrypt)
|
||||
{
|
||||
byte[] array2 = this.CryptoProvider.Encrypt(this.SerializeMemStream.GetBuffer(), 0, (int)this.SerializeMemStream.Length);
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
this.SerializeMemStream.Write(messageHeader, 0, messageHeader.Length);
|
||||
this.SerializeMemStream.Write(array2, 0, array2.Length);
|
||||
}
|
||||
array3 = this.SerializeMemStream.ToArray();
|
||||
}
|
||||
array3[messageHeader.Length - 1] = ((message is byte[]) ? 9 : 8);
|
||||
if (encrypt)
|
||||
{
|
||||
array3[messageHeader.Length - 1] = array3[messageHeader.Length - 1] | 128;
|
||||
}
|
||||
if (writeLength)
|
||||
{
|
||||
int num = 1;
|
||||
Protocol.Serialize(array3.Length, array3, ref num);
|
||||
}
|
||||
return array3;
|
||||
}
|
||||
|
||||
// Token: 0x0600012B RID: 299
|
||||
internal abstract byte[] SerializeOperationToMessage(byte opCode, Dictionary<byte, object> parameters, PeerBase.EgMessageType messageType, bool encrypt);
|
||||
|
||||
// Token: 0x0600012C RID: 300
|
||||
internal abstract void ReceiveIncomingCommands(byte[] inBuff, int dataLength);
|
||||
|
||||
// Token: 0x0600012D RID: 301 RVA: 0x00009764 File Offset: 0x00007964
|
||||
internal void InitCallback()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Connecting;
|
||||
if (flag)
|
||||
{
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Connected;
|
||||
}
|
||||
this.ApplicationIsInitialized = true;
|
||||
this.FetchServerTimestamp();
|
||||
this.Listener.OnStatusChanged(StatusCode.Connect);
|
||||
}
|
||||
|
||||
// Token: 0x17000057 RID: 87
|
||||
// (get) Token: 0x0600012E RID: 302 RVA: 0x000097A8 File Offset: 0x000079A8
|
||||
internal static int outgoingStreamBufferSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhotonPeer.OutgoingStreamBufferSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000058 RID: 88
|
||||
// (get) Token: 0x0600012F RID: 303 RVA: 0x000097C0 File Offset: 0x000079C0
|
||||
internal bool IsSendingOnlyAcks
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.IsSendingOnlyAcks;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000059 RID: 89
|
||||
// (get) Token: 0x06000130 RID: 304 RVA: 0x000097E0 File Offset: 0x000079E0
|
||||
internal int mtu
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.MaximumTransferUnit;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005A RID: 90
|
||||
// (get) Token: 0x06000131 RID: 305 RVA: 0x00009800 File Offset: 0x00007A00
|
||||
internal int rhttpMinConnections
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.RhttpMinConnections;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005B RID: 91
|
||||
// (get) Token: 0x06000132 RID: 306 RVA: 0x00009820 File Offset: 0x00007A20
|
||||
internal int rhttpMaxConnections
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ppeer.RhttpMaxConnections;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000133 RID: 307 RVA: 0x00009840 File Offset: 0x00007A40
|
||||
internal bool ExchangeKeysForEncryption(object lockObject)
|
||||
{
|
||||
this.isEncryptionAvailable = false;
|
||||
bool flag = this.CryptoProvider != null;
|
||||
if (flag)
|
||||
{
|
||||
this.CryptoProvider.Dispose();
|
||||
this.CryptoProvider = null;
|
||||
}
|
||||
bool flag2 = this.CryptoProvider == null;
|
||||
if (flag2)
|
||||
{
|
||||
this.CryptoProvider = new DiffieHellmanCryptoProvider();
|
||||
}
|
||||
Dictionary<byte, object> dictionary = new Dictionary<byte, object>(1);
|
||||
dictionary[PhotonCodes.ClientKey] = this.CryptoProvider.PublicKey;
|
||||
bool flag3 = lockObject != null;
|
||||
if (flag3)
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
return this.EnqueueOperation(dictionary, PhotonCodes.InitEncryption, true, 0, false, PeerBase.EgMessageType.InternalOperationRequest);
|
||||
}
|
||||
}
|
||||
return this.EnqueueOperation(dictionary, PhotonCodes.InitEncryption, true, 0, false, PeerBase.EgMessageType.InternalOperationRequest);
|
||||
}
|
||||
|
||||
// Token: 0x06000134 RID: 308 RVA: 0x00009908 File Offset: 0x00007B08
|
||||
internal void DeriveSharedKey(OperationResponse operationResponse)
|
||||
{
|
||||
bool flag = operationResponse.ReturnCode != 0;
|
||||
if (flag)
|
||||
{
|
||||
this.EnqueueDebugReturn(DebugLevel.ERROR, "Establishing encryption keys failed. " + operationResponse.ToStringFull());
|
||||
this.EnqueueStatusCallback(StatusCode.EncryptionFailedToEstablish);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = (byte[])operationResponse[PhotonCodes.ServerKey];
|
||||
bool flag2 = array == null || array.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
this.EnqueueDebugReturn(DebugLevel.ERROR, "Establishing encryption keys failed. Server's public key is null or empty. " + operationResponse.ToStringFull());
|
||||
this.EnqueueStatusCallback(StatusCode.EncryptionFailedToEstablish);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CryptoProvider.DeriveSharedKey(array);
|
||||
this.isEncryptionAvailable = true;
|
||||
this.EnqueueStatusCallback(StatusCode.EncryptionEstablished);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000135 RID: 309 RVA: 0x000099B4 File Offset: 0x00007BB4
|
||||
internal void EnqueueActionForDispatch(PeerBase.MyAction action)
|
||||
{
|
||||
Queue<PeerBase.MyAction> actionQueue = this.ActionQueue;
|
||||
lock (actionQueue)
|
||||
{
|
||||
this.ActionQueue.Enqueue(action);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000136 RID: 310 RVA: 0x000099FC File Offset: 0x00007BFC
|
||||
internal void EnqueueDebugReturn(DebugLevel level, string debugReturn)
|
||||
{
|
||||
Queue<PeerBase.MyAction> actionQueue = this.ActionQueue;
|
||||
lock (actionQueue)
|
||||
{
|
||||
this.ActionQueue.Enqueue(delegate
|
||||
{
|
||||
this.Listener.DebugReturn(level, debugReturn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000137 RID: 311 RVA: 0x00009A68 File Offset: 0x00007C68
|
||||
internal void EnqueueStatusCallback(StatusCode statusValue)
|
||||
{
|
||||
Queue<PeerBase.MyAction> actionQueue = this.ActionQueue;
|
||||
lock (actionQueue)
|
||||
{
|
||||
this.ActionQueue.Enqueue(delegate
|
||||
{
|
||||
this.Listener.OnStatusChanged(statusValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000138 RID: 312 RVA: 0x00009ACC File Offset: 0x00007CCC
|
||||
internal virtual void InitPeerBase()
|
||||
{
|
||||
this.protocol = SerializationProtocolFactory.Create(this.ppeer.SerializationProtocolType);
|
||||
this.ppeer.InitializeTrafficStats();
|
||||
this.ByteCountLastOperation = 0;
|
||||
this.ByteCountCurrentDispatch = 0;
|
||||
this.bytesIn = 0L;
|
||||
this.bytesOut = 0L;
|
||||
this.packetLossByCrc = 0;
|
||||
this.packetLossByChallenge = 0;
|
||||
this.networkSimulationSettings.LostPackagesIn = 0;
|
||||
this.networkSimulationSettings.LostPackagesOut = 0;
|
||||
LinkedList<SimulationItem> netSimListOutgoing = this.NetSimListOutgoing;
|
||||
lock (netSimListOutgoing)
|
||||
{
|
||||
this.NetSimListOutgoing.Clear();
|
||||
}
|
||||
LinkedList<SimulationItem> netSimListIncoming = this.NetSimListIncoming;
|
||||
lock (netSimListIncoming)
|
||||
{
|
||||
this.NetSimListIncoming.Clear();
|
||||
}
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnected;
|
||||
this.timeBase = SupportClass.GetTickCount();
|
||||
this.isEncryptionAvailable = false;
|
||||
this.ApplicationIsInitialized = false;
|
||||
this.roundTripTime = 300;
|
||||
this.roundTripTimeVariance = 0;
|
||||
this.packetThrottleInterval = 5000;
|
||||
this.serverTimeOffsetIsAvailable = false;
|
||||
this.serverTimeOffset = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000139 RID: 313 RVA: 0x00009BF8 File Offset: 0x00007DF8
|
||||
internal virtual bool DeserializeMessageAndCallback(byte[] inBuff)
|
||||
{
|
||||
bool flag = inBuff.Length < 2;
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
this.Listener.DebugReturn(DebugLevel.ERROR, "Incoming UDP data too short! " + inBuff.Length);
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = inBuff[0] != 243 && inBuff[0] != 253;
|
||||
if (flag4)
|
||||
{
|
||||
bool flag5 = this.debugOut >= DebugLevel.ERROR;
|
||||
if (flag5)
|
||||
{
|
||||
this.Listener.DebugReturn(DebugLevel.ALL, "No regular operation UDP message: " + inBuff[0]);
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte b = inBuff[1] & 127;
|
||||
bool flag6 = (inBuff[1] & 128) > 0;
|
||||
StreamBuffer streamBuffer = null;
|
||||
bool flag7 = b != 1;
|
||||
if (flag7)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag8 = flag6;
|
||||
if (flag8)
|
||||
{
|
||||
inBuff = this.CryptoProvider.Decrypt(inBuff, 2, inBuff.Length - 2);
|
||||
streamBuffer = new StreamBuffer(inBuff);
|
||||
}
|
||||
else
|
||||
{
|
||||
streamBuffer = new StreamBuffer(inBuff);
|
||||
streamBuffer.Seek(2L, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag9 = this.debugOut >= DebugLevel.ERROR;
|
||||
if (flag9)
|
||||
{
|
||||
this.Listener.DebugReturn(DebugLevel.ERROR, ex.ToString());
|
||||
}
|
||||
SupportClass.WriteStackTrace(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
switch (b)
|
||||
{
|
||||
case 1:
|
||||
this.InitCallback();
|
||||
goto IL_345;
|
||||
case 3:
|
||||
{
|
||||
OperationResponse operationResponse = this.protocol.DeserializeOperationResponse(streamBuffer);
|
||||
bool trafficStatsEnabled = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
this.TrafficStatsGameLevel.CountResult(this.ByteCountCurrentDispatch);
|
||||
num = SupportClass.GetTickCount();
|
||||
}
|
||||
this.Listener.OnOperationResponse(operationResponse);
|
||||
bool trafficStatsEnabled2 = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled2)
|
||||
{
|
||||
this.TrafficStatsGameLevel.TimeForResponseCallback(operationResponse.OperationCode, SupportClass.GetTickCount() - num);
|
||||
}
|
||||
goto IL_345;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
EventData eventData = this.protocol.DeserializeEventData(streamBuffer);
|
||||
bool trafficStatsEnabled3 = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled3)
|
||||
{
|
||||
this.TrafficStatsGameLevel.CountEvent(this.ByteCountCurrentDispatch);
|
||||
num = SupportClass.GetTickCount();
|
||||
}
|
||||
this.Listener.OnEvent(eventData);
|
||||
bool trafficStatsEnabled4 = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled4)
|
||||
{
|
||||
this.TrafficStatsGameLevel.TimeForEventCallback(eventData.Code, SupportClass.GetTickCount() - num);
|
||||
}
|
||||
goto IL_345;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
OperationResponse operationResponse = this.protocol.DeserializeOperationResponse(streamBuffer);
|
||||
bool trafficStatsEnabled5 = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled5)
|
||||
{
|
||||
this.TrafficStatsGameLevel.CountResult(this.ByteCountCurrentDispatch);
|
||||
num = SupportClass.GetTickCount();
|
||||
}
|
||||
bool flag10 = operationResponse.OperationCode == PhotonCodes.InitEncryption;
|
||||
if (flag10)
|
||||
{
|
||||
this.DeriveSharedKey(operationResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag11 = operationResponse.OperationCode == PhotonCodes.Ping;
|
||||
if (flag11)
|
||||
{
|
||||
TPeer tpeer = this as TPeer;
|
||||
bool flag12 = tpeer != null;
|
||||
if (flag12)
|
||||
{
|
||||
tpeer.ReadPingResult(operationResponse);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EnqueueDebugReturn(DebugLevel.ERROR, "Received unknown internal operation. " + operationResponse.ToStringFull());
|
||||
}
|
||||
}
|
||||
bool trafficStatsEnabled6 = this.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled6)
|
||||
{
|
||||
this.TrafficStatsGameLevel.TimeForResponseCallback(operationResponse.OperationCode, SupportClass.GetTickCount() - num);
|
||||
}
|
||||
goto IL_345;
|
||||
}
|
||||
}
|
||||
this.EnqueueDebugReturn(DebugLevel.ERROR, "unexpected msgType " + b);
|
||||
IL_345:
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600013A RID: 314 RVA: 0x00009F64 File Offset: 0x00008164
|
||||
internal void SendNetworkSimulated(byte[] dataToSend)
|
||||
{
|
||||
bool flag = !this.NetworkSimulationSettings.IsSimulationEnabled;
|
||||
if (flag)
|
||||
{
|
||||
throw new NotImplementedException("SendNetworkSimulated was called, despite NetworkSimulationSettings.IsSimulationEnabled == false.");
|
||||
}
|
||||
bool flag2 = this.usedProtocol == ConnectionProtocol.Udp && this.NetworkSimulationSettings.OutgoingLossPercentage > 0 && this.lagRandomizer.Next(101) < this.NetworkSimulationSettings.OutgoingLossPercentage;
|
||||
if (flag2)
|
||||
{
|
||||
NetworkSimulationSet networkSimulationSet = this.networkSimulationSettings;
|
||||
int lostPackagesOut = networkSimulationSet.LostPackagesOut;
|
||||
networkSimulationSet.LostPackagesOut = lostPackagesOut + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = ((this.networkSimulationSettings.OutgoingJitter <= 0) ? 0 : (this.lagRandomizer.Next(this.networkSimulationSettings.OutgoingJitter * 2) - this.networkSimulationSettings.OutgoingJitter));
|
||||
int num2 = this.networkSimulationSettings.OutgoingLag + num;
|
||||
int num3 = SupportClass.GetTickCount() + num2;
|
||||
SimulationItem simulationItem = new SimulationItem
|
||||
{
|
||||
DelayedData = dataToSend,
|
||||
TimeToExecute = num3,
|
||||
Delay = num2
|
||||
};
|
||||
LinkedList<SimulationItem> netSimListOutgoing = this.NetSimListOutgoing;
|
||||
lock (netSimListOutgoing)
|
||||
{
|
||||
bool flag3 = this.NetSimListOutgoing.Count == 0 || this.usedProtocol == ConnectionProtocol.Tcp;
|
||||
if (flag3)
|
||||
{
|
||||
this.NetSimListOutgoing.AddLast(simulationItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkedListNode<SimulationItem> linkedListNode = this.NetSimListOutgoing.First;
|
||||
while (linkedListNode != null && linkedListNode.Value.TimeToExecute < num3)
|
||||
{
|
||||
linkedListNode = linkedListNode.Next;
|
||||
}
|
||||
bool flag4 = linkedListNode == null;
|
||||
if (flag4)
|
||||
{
|
||||
this.NetSimListOutgoing.AddLast(simulationItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NetSimListOutgoing.AddBefore(linkedListNode, simulationItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013B RID: 315 RVA: 0x0000A114 File Offset: 0x00008314
|
||||
internal void ReceiveNetworkSimulated(byte[] dataReceived)
|
||||
{
|
||||
bool flag = !this.networkSimulationSettings.IsSimulationEnabled;
|
||||
if (flag)
|
||||
{
|
||||
throw new NotImplementedException("ReceiveNetworkSimulated was called, despite NetworkSimulationSettings.IsSimulationEnabled == false.");
|
||||
}
|
||||
bool flag2 = this.usedProtocol == ConnectionProtocol.Udp && this.networkSimulationSettings.IncomingLossPercentage > 0 && this.lagRandomizer.Next(101) < this.networkSimulationSettings.IncomingLossPercentage;
|
||||
if (flag2)
|
||||
{
|
||||
NetworkSimulationSet networkSimulationSet = this.networkSimulationSettings;
|
||||
int lostPackagesIn = networkSimulationSet.LostPackagesIn;
|
||||
networkSimulationSet.LostPackagesIn = lostPackagesIn + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = ((this.networkSimulationSettings.IncomingJitter <= 0) ? 0 : (this.lagRandomizer.Next(this.networkSimulationSettings.IncomingJitter * 2) - this.networkSimulationSettings.IncomingJitter));
|
||||
int num2 = this.networkSimulationSettings.IncomingLag + num;
|
||||
int num3 = SupportClass.GetTickCount() + num2;
|
||||
SimulationItem simulationItem = new SimulationItem
|
||||
{
|
||||
DelayedData = dataReceived,
|
||||
TimeToExecute = num3,
|
||||
Delay = num2
|
||||
};
|
||||
LinkedList<SimulationItem> netSimListIncoming = this.NetSimListIncoming;
|
||||
lock (netSimListIncoming)
|
||||
{
|
||||
bool flag3 = this.NetSimListIncoming.Count == 0 || this.usedProtocol == ConnectionProtocol.Tcp;
|
||||
if (flag3)
|
||||
{
|
||||
this.NetSimListIncoming.AddLast(simulationItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkedListNode<SimulationItem> linkedListNode = this.NetSimListIncoming.First;
|
||||
while (linkedListNode != null && linkedListNode.Value.TimeToExecute < num3)
|
||||
{
|
||||
linkedListNode = linkedListNode.Next;
|
||||
}
|
||||
bool flag4 = linkedListNode == null;
|
||||
if (flag4)
|
||||
{
|
||||
this.NetSimListIncoming.AddLast(simulationItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NetSimListIncoming.AddBefore(linkedListNode, simulationItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013C RID: 316 RVA: 0x0000A2C4 File Offset: 0x000084C4
|
||||
protected internal void NetworkSimRun()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
bool flag = false;
|
||||
ManualResetEvent netSimManualResetEvent = this.networkSimulationSettings.NetSimManualResetEvent;
|
||||
lock (netSimManualResetEvent)
|
||||
{
|
||||
flag = this.networkSimulationSettings.IsSimulationEnabled;
|
||||
}
|
||||
bool flag2 = !flag;
|
||||
if (flag2)
|
||||
{
|
||||
this.networkSimulationSettings.NetSimManualResetEvent.WaitOne();
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkedList<SimulationItem> netSimListIncoming = this.NetSimListIncoming;
|
||||
lock (netSimListIncoming)
|
||||
{
|
||||
while (this.NetSimListIncoming.First != null)
|
||||
{
|
||||
SimulationItem value = this.NetSimListIncoming.First.Value;
|
||||
bool flag3 = value.stopw.ElapsedMilliseconds < (long)value.Delay;
|
||||
if (flag3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
bool flag4 = this.rt != null && this.rt.Connected;
|
||||
if (flag4)
|
||||
{
|
||||
this.ReceiveIncomingCommands(value.DelayedData, value.DelayedData.Length);
|
||||
}
|
||||
this.NetSimListIncoming.RemoveFirst();
|
||||
}
|
||||
}
|
||||
LinkedList<SimulationItem> netSimListOutgoing = this.NetSimListOutgoing;
|
||||
lock (netSimListOutgoing)
|
||||
{
|
||||
while (this.NetSimListOutgoing.First != null)
|
||||
{
|
||||
SimulationItem value2 = this.NetSimListOutgoing.First.Value;
|
||||
bool flag5 = value2.stopw.ElapsedMilliseconds < (long)value2.Delay;
|
||||
if (flag5)
|
||||
{
|
||||
break;
|
||||
}
|
||||
bool flag6 = this.rt != null && this.rt.Connected;
|
||||
if (flag6)
|
||||
{
|
||||
this.rt.Send(value2.DelayedData, value2.DelayedData.Length);
|
||||
}
|
||||
this.NetSimListOutgoing.RemoveFirst();
|
||||
}
|
||||
}
|
||||
Thread.Sleep(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013D RID: 317 RVA: 0x0000A4B8 File Offset: 0x000086B8
|
||||
internal void UpdateRoundTripTimeAndVariance(int lastRoundtripTime)
|
||||
{
|
||||
bool flag = lastRoundtripTime < 0;
|
||||
if (!flag)
|
||||
{
|
||||
this.roundTripTimeVariance -= this.roundTripTimeVariance / 4;
|
||||
bool flag2 = lastRoundtripTime >= this.roundTripTime;
|
||||
if (flag2)
|
||||
{
|
||||
this.roundTripTime += (lastRoundtripTime - this.roundTripTime) / 8;
|
||||
this.roundTripTimeVariance += (lastRoundtripTime - this.roundTripTime) / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.roundTripTime += (lastRoundtripTime - this.roundTripTime) / 8;
|
||||
this.roundTripTimeVariance -= (lastRoundtripTime - this.roundTripTime) / 4;
|
||||
}
|
||||
bool flag3 = this.roundTripTime < this.lowestRoundTripTime;
|
||||
if (flag3)
|
||||
{
|
||||
this.lowestRoundTripTime = this.roundTripTime;
|
||||
}
|
||||
bool flag4 = this.roundTripTimeVariance > this.highestRoundTripTimeVariance;
|
||||
if (flag4)
|
||||
{
|
||||
this.highestRoundTripTimeVariance = this.roundTripTimeVariance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013E RID: 318 RVA: 0x0000A59C File Offset: 0x0000879C
|
||||
internal virtual bool InitUdpEncryption(byte[] encryptionSecret, byte[] hmacSecret)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600013F RID: 319 RVA: 0x0000A5AF File Offset: 0x000087AF
|
||||
internal virtual void InitEncryption(byte[] secret)
|
||||
{
|
||||
this.CryptoProvider = new DiffieHellmanCryptoProvider(secret);
|
||||
this.isEncryptionAvailable = true;
|
||||
}
|
||||
|
||||
// Token: 0x04000069 RID: 105
|
||||
internal PhotonPeer ppeer;
|
||||
|
||||
// Token: 0x0400006A RID: 106
|
||||
internal IProtocol protocol;
|
||||
|
||||
// Token: 0x0400006B RID: 107
|
||||
internal ConnectionProtocol usedProtocol;
|
||||
|
||||
// Token: 0x0400006C RID: 108
|
||||
internal IPhotonSocket rt;
|
||||
|
||||
// Token: 0x0400006F RID: 111
|
||||
internal int ByteCountLastOperation;
|
||||
|
||||
// Token: 0x04000070 RID: 112
|
||||
internal int ByteCountCurrentDispatch;
|
||||
|
||||
// Token: 0x04000071 RID: 113
|
||||
internal NCommand CommandInCurrentDispatch;
|
||||
|
||||
// Token: 0x04000072 RID: 114
|
||||
internal int TrafficPackageHeaderSize;
|
||||
|
||||
// Token: 0x04000073 RID: 115
|
||||
internal int packetLossByCrc;
|
||||
|
||||
// Token: 0x04000074 RID: 116
|
||||
internal int packetLossByChallenge;
|
||||
|
||||
// Token: 0x04000075 RID: 117
|
||||
internal readonly Queue<PeerBase.MyAction> ActionQueue = new Queue<PeerBase.MyAction>();
|
||||
|
||||
// Token: 0x04000076 RID: 118
|
||||
internal short peerID = -1;
|
||||
|
||||
// Token: 0x04000077 RID: 119
|
||||
internal PeerBase.ConnectionStateValue peerConnectionState;
|
||||
|
||||
// Token: 0x04000078 RID: 120
|
||||
internal int serverTimeOffset;
|
||||
|
||||
// Token: 0x04000079 RID: 121
|
||||
internal bool serverTimeOffsetIsAvailable;
|
||||
|
||||
// Token: 0x0400007A RID: 122
|
||||
internal int roundTripTime;
|
||||
|
||||
// Token: 0x0400007B RID: 123
|
||||
internal int roundTripTimeVariance;
|
||||
|
||||
// Token: 0x0400007C RID: 124
|
||||
internal int lastRoundTripTime;
|
||||
|
||||
// Token: 0x0400007D RID: 125
|
||||
internal int lowestRoundTripTime;
|
||||
|
||||
// Token: 0x0400007E RID: 126
|
||||
internal int lastRoundTripTimeVariance;
|
||||
|
||||
// Token: 0x0400007F RID: 127
|
||||
internal int highestRoundTripTimeVariance;
|
||||
|
||||
// Token: 0x04000080 RID: 128
|
||||
internal int timestampOfLastReceive;
|
||||
|
||||
// Token: 0x04000081 RID: 129
|
||||
internal int packetThrottleInterval;
|
||||
|
||||
// Token: 0x04000082 RID: 130
|
||||
internal static short peerCount;
|
||||
|
||||
// Token: 0x04000083 RID: 131
|
||||
internal long bytesOut;
|
||||
|
||||
// Token: 0x04000084 RID: 132
|
||||
internal long bytesIn;
|
||||
|
||||
// Token: 0x04000085 RID: 133
|
||||
internal int commandBufferSize = 100;
|
||||
|
||||
// Token: 0x04000086 RID: 134
|
||||
internal ICryptoProvider CryptoProvider;
|
||||
|
||||
// Token: 0x04000087 RID: 135
|
||||
private readonly Random lagRandomizer = new Random();
|
||||
|
||||
// Token: 0x04000088 RID: 136
|
||||
internal readonly LinkedList<SimulationItem> NetSimListOutgoing = new LinkedList<SimulationItem>();
|
||||
|
||||
// Token: 0x04000089 RID: 137
|
||||
internal readonly LinkedList<SimulationItem> NetSimListIncoming = new LinkedList<SimulationItem>();
|
||||
|
||||
// Token: 0x0400008A RID: 138
|
||||
private readonly NetworkSimulationSet networkSimulationSettings = new NetworkSimulationSet();
|
||||
|
||||
// Token: 0x0400008B RID: 139
|
||||
internal Queue<CmdLogItem> CommandLog;
|
||||
|
||||
// Token: 0x0400008C RID: 140
|
||||
internal Queue<CmdLogItem> InReliableLog;
|
||||
|
||||
// Token: 0x0400008D RID: 141
|
||||
internal object CustomInitData;
|
||||
|
||||
// Token: 0x0400008E RID: 142
|
||||
internal string AppId;
|
||||
|
||||
// Token: 0x04000090 RID: 144
|
||||
internal int timeBase;
|
||||
|
||||
// Token: 0x04000091 RID: 145
|
||||
internal int timeInt;
|
||||
|
||||
// Token: 0x04000092 RID: 146
|
||||
internal int timeoutInt;
|
||||
|
||||
// Token: 0x04000093 RID: 147
|
||||
internal int timeLastAckReceive;
|
||||
|
||||
// Token: 0x04000094 RID: 148
|
||||
internal int timeLastSendAck;
|
||||
|
||||
// Token: 0x04000095 RID: 149
|
||||
internal int timeLastSendOutgoing;
|
||||
|
||||
// Token: 0x04000096 RID: 150
|
||||
internal const int ENET_PEER_PACKET_LOSS_SCALE = 65536;
|
||||
|
||||
// Token: 0x04000097 RID: 151
|
||||
internal const int ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 300;
|
||||
|
||||
// Token: 0x04000098 RID: 152
|
||||
internal const int ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000;
|
||||
|
||||
// Token: 0x04000099 RID: 153
|
||||
internal bool ApplicationIsInitialized;
|
||||
|
||||
// Token: 0x0400009A RID: 154
|
||||
internal bool isEncryptionAvailable;
|
||||
|
||||
// Token: 0x0400009B RID: 155
|
||||
internal int outgoingCommandsInStream = 0;
|
||||
|
||||
// Token: 0x0400009C RID: 156
|
||||
protected StreamBuffer SerializeMemStream = new StreamBuffer(0);
|
||||
|
||||
// Token: 0x02000042 RID: 66
|
||||
// (Invoke) Token: 0x060002D3 RID: 723
|
||||
internal delegate void MyAction();
|
||||
|
||||
// Token: 0x02000043 RID: 67
|
||||
public enum ConnectionStateValue : byte
|
||||
{
|
||||
// Token: 0x04000196 RID: 406
|
||||
Disconnected,
|
||||
// Token: 0x04000197 RID: 407
|
||||
Connecting,
|
||||
// Token: 0x04000198 RID: 408
|
||||
Connected = 3,
|
||||
// Token: 0x04000199 RID: 409
|
||||
Disconnecting,
|
||||
// Token: 0x0400019A RID: 410
|
||||
AcknowledgingDisconnect,
|
||||
// Token: 0x0400019B RID: 411
|
||||
Zombie
|
||||
}
|
||||
|
||||
// Token: 0x02000044 RID: 68
|
||||
internal enum EgMessageType : byte
|
||||
{
|
||||
// Token: 0x0400019D RID: 413
|
||||
Init,
|
||||
// Token: 0x0400019E RID: 414
|
||||
InitResponse,
|
||||
// Token: 0x0400019F RID: 415
|
||||
Operation,
|
||||
// Token: 0x040001A0 RID: 416
|
||||
OperationResponse,
|
||||
// Token: 0x040001A1 RID: 417
|
||||
Event,
|
||||
// Token: 0x040001A2 RID: 418
|
||||
InternalOperationRequest = 6,
|
||||
// Token: 0x040001A3 RID: 419
|
||||
InternalOperationResponse,
|
||||
// Token: 0x040001A4 RID: 420
|
||||
Message,
|
||||
// Token: 0x040001A5 RID: 421
|
||||
RawMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000D RID: 13
|
||||
public enum PeerStateValue : byte
|
||||
{
|
||||
// Token: 0x0400002C RID: 44
|
||||
Disconnected,
|
||||
// Token: 0x0400002D RID: 45
|
||||
Connecting,
|
||||
// Token: 0x0400002E RID: 46
|
||||
InitializingApplication = 10,
|
||||
// Token: 0x0400002F RID: 47
|
||||
Connected = 3,
|
||||
// Token: 0x04000030 RID: 48
|
||||
Disconnecting
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000011 RID: 17
|
||||
internal static class PhotonCodes
|
||||
{
|
||||
// Token: 0x04000063 RID: 99
|
||||
internal static byte ClientKey = 1;
|
||||
|
||||
// Token: 0x04000064 RID: 100
|
||||
internal static byte ModeKey = 2;
|
||||
|
||||
// Token: 0x04000065 RID: 101
|
||||
internal static byte ServerKey = 1;
|
||||
|
||||
// Token: 0x04000066 RID: 102
|
||||
internal static byte InitEncryption = 0;
|
||||
|
||||
// Token: 0x04000067 RID: 103
|
||||
internal static byte Ping = 1;
|
||||
|
||||
// Token: 0x04000068 RID: 104
|
||||
public const byte Ok = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002F RID: 47
|
||||
public enum PhotonDisconnectCause
|
||||
{
|
||||
// Token: 0x0400013A RID: 314
|
||||
SecurityExceptionOnConnect,
|
||||
// Token: 0x0400013B RID: 315
|
||||
ExceptionOnConnect,
|
||||
// Token: 0x0400013C RID: 316
|
||||
Exception,
|
||||
// Token: 0x0400013D RID: 317
|
||||
ReadException,
|
||||
// Token: 0x0400013E RID: 318
|
||||
WriteException
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,999 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000029 RID: 41
|
||||
public abstract class PhotonPing : IDisposable
|
||||
{
|
||||
// Token: 0x0600020F RID: 527 RVA: 0x000118A0 File Offset: 0x0000FAA0
|
||||
public virtual bool StartPing(string ip)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000210 RID: 528 RVA: 0x000118A0 File Offset: 0x0000FAA0
|
||||
public virtual bool Done()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000211 RID: 529 RVA: 0x000118A0 File Offset: 0x0000FAA0
|
||||
public virtual void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000212 RID: 530 RVA: 0x000118A8 File Offset: 0x0000FAA8
|
||||
protected internal void Init()
|
||||
{
|
||||
this.GotResult = false;
|
||||
this.Successful = false;
|
||||
this.PingId = (byte)(Environment.TickCount % 255);
|
||||
}
|
||||
|
||||
// Token: 0x0400012D RID: 301
|
||||
public string DebugString = "";
|
||||
|
||||
// Token: 0x0400012E RID: 302
|
||||
public bool Successful;
|
||||
|
||||
// Token: 0x0400012F RID: 303
|
||||
protected internal bool GotResult;
|
||||
|
||||
// Token: 0x04000130 RID: 304
|
||||
protected internal int PingLength = 13;
|
||||
|
||||
// Token: 0x04000131 RID: 305
|
||||
protected internal byte[] PingBytes = new byte[]
|
||||
{
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 0
|
||||
};
|
||||
|
||||
// Token: 0x04000132 RID: 306
|
||||
protected internal byte PingId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000030 RID: 48
|
||||
public enum PhotonSocketError
|
||||
{
|
||||
// Token: 0x04000140 RID: 320
|
||||
Success,
|
||||
// Token: 0x04000141 RID: 321
|
||||
Skipped,
|
||||
// Token: 0x04000142 RID: 322
|
||||
NoData,
|
||||
// Token: 0x04000143 RID: 323
|
||||
Exception
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002E RID: 46
|
||||
public enum PhotonSocketState
|
||||
{
|
||||
// Token: 0x04000135 RID: 309
|
||||
Disconnected,
|
||||
// Token: 0x04000136 RID: 310
|
||||
Connecting,
|
||||
// Token: 0x04000137 RID: 311
|
||||
Connected,
|
||||
// Token: 0x04000138 RID: 312
|
||||
Disconnecting
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002A RID: 42
|
||||
public class PingMono : PhotonPing
|
||||
{
|
||||
// Token: 0x06000214 RID: 532 RVA: 0x00011900 File Offset: 0x0000FB00
|
||||
public override bool StartPing(string ip)
|
||||
{
|
||||
base.Init();
|
||||
try
|
||||
{
|
||||
bool flag = ip.Contains(".");
|
||||
if (flag)
|
||||
{
|
||||
this.sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
|
||||
}
|
||||
this.sock.ReceiveTimeout = 5000;
|
||||
this.sock.Connect(ip, 5055);
|
||||
this.PingBytes[this.PingBytes.Length - 1] = this.PingId;
|
||||
this.sock.Send(this.PingBytes);
|
||||
this.PingBytes[this.PingBytes.Length - 1] = this.PingId - 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.sock = null;
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000215 RID: 533 RVA: 0x000119DC File Offset: 0x0000FBDC
|
||||
public override bool Done()
|
||||
{
|
||||
bool flag = this.GotResult || this.sock == null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = this.sock.Available <= 0;
|
||||
if (flag3)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = this.sock.Receive(this.PingBytes, SocketFlags.None);
|
||||
bool flag4 = this.PingBytes[this.PingBytes.Length - 1] == this.PingId && num == this.PingLength;
|
||||
bool flag5 = !flag4;
|
||||
if (flag5)
|
||||
{
|
||||
this.DebugString += " ReplyMatch is false! ";
|
||||
}
|
||||
this.Successful = num == this.PingBytes.Length && this.PingBytes[this.PingBytes.Length - 1] == this.PingId;
|
||||
this.GotResult = true;
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x06000216 RID: 534 RVA: 0x00011ABC File Offset: 0x0000FCBC
|
||||
public override void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.sock.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
this.sock = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000133 RID: 307
|
||||
private Socket sock;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002D RID: 45
|
||||
public class PingNativeDynamic : PhotonPing
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002C RID: 44
|
||||
public class PingNativeStatic : PhotonPing
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200002B RID: 43
|
||||
public class PingWindowsStore : PhotonPing
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000027 RID: 39
|
||||
public class Protocol
|
||||
{
|
||||
// Token: 0x060001CB RID: 459 RVA: 0x0000F380 File Offset: 0x0000D580
|
||||
public static bool TryRegisterType(Type type, byte typeCode, SerializeMethod serializeFunction, DeserializeMethod deserializeFunction)
|
||||
{
|
||||
bool flag = Protocol.CodeDict.ContainsKey(typeCode) || Protocol.TypeDict.ContainsKey(type);
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomType customType = new CustomType(type, typeCode, serializeFunction, deserializeFunction);
|
||||
Protocol.CodeDict.Add(typeCode, customType);
|
||||
Protocol.TypeDict.Add(type, customType);
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x060001CC RID: 460 RVA: 0x0000F3DC File Offset: 0x0000D5DC
|
||||
public static bool TryRegisterType(Type type, byte typeCode, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
|
||||
{
|
||||
bool flag = Protocol.CodeDict.ContainsKey(typeCode) || Protocol.TypeDict.ContainsKey(type);
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomType customType = new CustomType(type, typeCode, serializeFunction, deserializeFunction);
|
||||
Protocol.CodeDict.Add(typeCode, customType);
|
||||
Protocol.TypeDict.Add(type, customType);
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x060001CD RID: 461 RVA: 0x0000F438 File Offset: 0x0000D638
|
||||
[Obsolete]
|
||||
public static byte[] Serialize(object obj)
|
||||
{
|
||||
bool flag = Protocol.ProtocolDefault == null;
|
||||
if (flag)
|
||||
{
|
||||
Protocol.ProtocolDefault = new Protocol16();
|
||||
}
|
||||
IProtocol protocolDefault = Protocol.ProtocolDefault;
|
||||
byte[] array;
|
||||
lock (protocolDefault)
|
||||
{
|
||||
array = Protocol.ProtocolDefault.Serialize(obj);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060001CE RID: 462 RVA: 0x0000F494 File Offset: 0x0000D694
|
||||
[Obsolete]
|
||||
public static object Deserialize(byte[] serializedData)
|
||||
{
|
||||
bool flag = Protocol.ProtocolDefault == null;
|
||||
if (flag)
|
||||
{
|
||||
Protocol.ProtocolDefault = new Protocol16();
|
||||
}
|
||||
IProtocol protocolDefault = Protocol.ProtocolDefault;
|
||||
object obj;
|
||||
lock (protocolDefault)
|
||||
{
|
||||
obj = Protocol.ProtocolDefault.Deserialize(serializedData);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Token: 0x060001CF RID: 463 RVA: 0x0000F4F0 File Offset: 0x0000D6F0
|
||||
public static void Serialize(short value, byte[] target, ref int targetOffset)
|
||||
{
|
||||
int num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)(value >> 8);
|
||||
num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)value;
|
||||
}
|
||||
|
||||
// Token: 0x060001D0 RID: 464 RVA: 0x0000F51C File Offset: 0x0000D71C
|
||||
public static void Serialize(int value, byte[] target, ref int targetOffset)
|
||||
{
|
||||
int num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)(value >> 24);
|
||||
num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)(value >> 16);
|
||||
num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)(value >> 8);
|
||||
num = targetOffset;
|
||||
targetOffset = num + 1;
|
||||
target[num] = (byte)value;
|
||||
}
|
||||
|
||||
// Token: 0x060001D1 RID: 465 RVA: 0x0000F568 File Offset: 0x0000D768
|
||||
public static void Serialize(float value, byte[] target, ref int targetOffset)
|
||||
{
|
||||
float[] array = Protocol.memFloatBlock;
|
||||
lock (array)
|
||||
{
|
||||
Protocol.memFloatBlock[0] = value;
|
||||
Buffer.BlockCopy(Protocol.memFloatBlock, 0, target, targetOffset, 4);
|
||||
}
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = target[targetOffset];
|
||||
byte b2 = target[targetOffset + 1];
|
||||
target[targetOffset] = target[targetOffset + 3];
|
||||
target[targetOffset + 1] = target[targetOffset + 2];
|
||||
target[targetOffset + 2] = b2;
|
||||
target[targetOffset + 3] = b;
|
||||
}
|
||||
targetOffset += 4;
|
||||
}
|
||||
|
||||
// Token: 0x060001D2 RID: 466 RVA: 0x0000F5F8 File Offset: 0x0000D7F8
|
||||
public static void Deserialize(out int value, byte[] source, ref int offset)
|
||||
{
|
||||
int num = offset;
|
||||
offset = num + 1;
|
||||
int num2 = (int)source[num] << 24;
|
||||
num = offset;
|
||||
offset = num + 1;
|
||||
int num3 = num2 | ((int)source[num] << 16);
|
||||
num = offset;
|
||||
offset = num + 1;
|
||||
int num4 = num3 | ((int)source[num] << 8);
|
||||
num = offset;
|
||||
offset = num + 1;
|
||||
value = num4 | (int)source[num];
|
||||
}
|
||||
|
||||
// Token: 0x060001D3 RID: 467 RVA: 0x0000F640 File Offset: 0x0000D840
|
||||
public static void Deserialize(out short value, byte[] source, ref int offset)
|
||||
{
|
||||
int num = offset;
|
||||
offset = num + 1;
|
||||
byte b = (byte)(source[num] << 8);
|
||||
num = offset;
|
||||
offset = num + 1;
|
||||
value = (short)(b | source[num]);
|
||||
}
|
||||
|
||||
// Token: 0x060001D4 RID: 468 RVA: 0x0000F66C File Offset: 0x0000D86C
|
||||
public static void Deserialize(out float value, byte[] source, ref int offset)
|
||||
{
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte[] array = Protocol.memDeserialize;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = Protocol.memDeserialize;
|
||||
byte[] array3 = array2;
|
||||
int num = 3;
|
||||
int num2 = offset;
|
||||
offset = num2 + 1;
|
||||
array3[num] = source[num2];
|
||||
byte[] array4 = array2;
|
||||
int num3 = 2;
|
||||
num2 = offset;
|
||||
offset = num2 + 1;
|
||||
array4[num3] = source[num2];
|
||||
byte[] array5 = array2;
|
||||
int num4 = 1;
|
||||
num2 = offset;
|
||||
offset = num2 + 1;
|
||||
array5[num4] = source[num2];
|
||||
byte[] array6 = array2;
|
||||
int num5 = 0;
|
||||
num2 = offset;
|
||||
offset = num2 + 1;
|
||||
array6[num5] = source[num2];
|
||||
value = BitConverter.ToSingle(array2, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = BitConverter.ToSingle(source, offset);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400011B RID: 283
|
||||
internal static readonly Dictionary<Type, CustomType> TypeDict = new Dictionary<Type, CustomType>();
|
||||
|
||||
// Token: 0x0400011C RID: 284
|
||||
internal static readonly Dictionary<byte, CustomType> CodeDict = new Dictionary<byte, CustomType>();
|
||||
|
||||
// Token: 0x0400011D RID: 285
|
||||
private static IProtocol ProtocolDefault;
|
||||
|
||||
// Token: 0x0400011E RID: 286
|
||||
private static readonly float[] memFloatBlock = new float[1];
|
||||
|
||||
// Token: 0x0400011F RID: 287
|
||||
private static readonly byte[] memDeserialize = new byte[4];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1444 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000028 RID: 40
|
||||
public class Protocol16 : IProtocol
|
||||
{
|
||||
// Token: 0x17000069 RID: 105
|
||||
// (get) Token: 0x060001D7 RID: 471 RVA: 0x0000F738 File Offset: 0x0000D938
|
||||
internal override string protocolType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "GpBinaryV16";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006A RID: 106
|
||||
// (get) Token: 0x060001D8 RID: 472 RVA: 0x0000F750 File Offset: 0x0000D950
|
||||
internal override byte[] VersionBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.versionBytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001D9 RID: 473 RVA: 0x0000F768 File Offset: 0x0000D968
|
||||
private bool SerializeCustom(StreamBuffer dout, object serObject)
|
||||
{
|
||||
CustomType customType;
|
||||
bool flag = Protocol.TypeDict.TryGetValue(serObject.GetType(), out customType);
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = customType.SerializeStreamFunction == null;
|
||||
if (flag2)
|
||||
{
|
||||
byte[] array = customType.SerializeFunction(serObject);
|
||||
dout.WriteByte(99);
|
||||
dout.WriteByte(customType.Code);
|
||||
this.SerializeShort(dout, (short)array.Length, false);
|
||||
dout.Write(array, 0, array.Length);
|
||||
flag3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dout.WriteByte(99);
|
||||
dout.WriteByte(customType.Code);
|
||||
long position = dout.Position;
|
||||
dout.Position += 2L;
|
||||
short num = customType.SerializeStreamFunction(dout, serObject);
|
||||
long position2 = dout.Position;
|
||||
dout.Position = position;
|
||||
this.SerializeShort(dout, num, false);
|
||||
dout.Position += (long)num;
|
||||
bool flag4 = dout.Position != position2;
|
||||
if (flag4)
|
||||
{
|
||||
throw new Exception(string.Concat(new object[] { "Serialization failed. Stream position corrupted. Should be ", position2, " is now: ", dout.Position, " serializedLength: ", num }));
|
||||
}
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x060001DA RID: 474 RVA: 0x0000F8B8 File Offset: 0x0000DAB8
|
||||
private object DeserializeCustom(StreamBuffer din, byte customTypeCode)
|
||||
{
|
||||
short num = this.DeserializeShort(din);
|
||||
CustomType customType;
|
||||
bool flag = Protocol.CodeDict.TryGetValue(customTypeCode, out customType);
|
||||
object obj;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = customType.DeserializeStreamFunction == null;
|
||||
if (flag2)
|
||||
{
|
||||
byte[] array = new byte[(int)num];
|
||||
din.Read(array, 0, (int)num);
|
||||
obj = customType.DeserializeFunction(array);
|
||||
}
|
||||
else
|
||||
{
|
||||
long position = din.Position;
|
||||
object obj2 = customType.DeserializeStreamFunction(din, num);
|
||||
int num2 = (int)(din.Position - position);
|
||||
bool flag3 = num2 != (int)num;
|
||||
if (flag3)
|
||||
{
|
||||
din.Position = position + (long)num;
|
||||
}
|
||||
obj = obj2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array2 = new byte[(int)num];
|
||||
din.Read(array2, 0, (int)num);
|
||||
obj = array2;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Token: 0x060001DB RID: 475 RVA: 0x0000F974 File Offset: 0x0000DB74
|
||||
private Type GetTypeOfCode(byte typeCode)
|
||||
{
|
||||
if (typeCode <= 42)
|
||||
{
|
||||
if (typeCode == 0 || typeCode == 42)
|
||||
{
|
||||
return typeof(object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeCode == 68)
|
||||
{
|
||||
return typeof(IDictionary);
|
||||
}
|
||||
switch (typeCode)
|
||||
{
|
||||
case 97:
|
||||
return typeof(string[]);
|
||||
case 98:
|
||||
return typeof(byte);
|
||||
case 99:
|
||||
return typeof(CustomType);
|
||||
case 100:
|
||||
return typeof(double);
|
||||
case 101:
|
||||
return typeof(EventData);
|
||||
case 102:
|
||||
return typeof(float);
|
||||
case 104:
|
||||
return typeof(Hashtable);
|
||||
case 105:
|
||||
return typeof(int);
|
||||
case 107:
|
||||
return typeof(short);
|
||||
case 108:
|
||||
return typeof(long);
|
||||
case 110:
|
||||
return typeof(int[]);
|
||||
case 111:
|
||||
return typeof(bool);
|
||||
case 112:
|
||||
return typeof(OperationResponse);
|
||||
case 113:
|
||||
return typeof(OperationRequest);
|
||||
case 115:
|
||||
return typeof(string);
|
||||
case 120:
|
||||
return typeof(byte[]);
|
||||
case 121:
|
||||
return typeof(Array);
|
||||
case 122:
|
||||
return typeof(object[]);
|
||||
}
|
||||
}
|
||||
Debug.WriteLine("missing type: " + typeCode);
|
||||
throw new Exception("deserialize(): " + typeCode);
|
||||
}
|
||||
|
||||
// Token: 0x060001DC RID: 476 RVA: 0x0000FB78 File Offset: 0x0000DD78
|
||||
private Protocol16.GpType GetCodeOfType(Type type)
|
||||
{
|
||||
TypeCode typeCode = Type.GetTypeCode(type);
|
||||
TypeCode typeCode2 = typeCode;
|
||||
switch (typeCode2)
|
||||
{
|
||||
case TypeCode.Boolean:
|
||||
return Protocol16.GpType.Boolean;
|
||||
case TypeCode.Char:
|
||||
case TypeCode.SByte:
|
||||
case TypeCode.UInt16:
|
||||
case TypeCode.UInt32:
|
||||
case TypeCode.UInt64:
|
||||
break;
|
||||
case TypeCode.Byte:
|
||||
return Protocol16.GpType.Byte;
|
||||
case TypeCode.Int16:
|
||||
return Protocol16.GpType.Short;
|
||||
case TypeCode.Int32:
|
||||
return Protocol16.GpType.Integer;
|
||||
case TypeCode.Int64:
|
||||
return Protocol16.GpType.Long;
|
||||
case TypeCode.Single:
|
||||
return Protocol16.GpType.Float;
|
||||
case TypeCode.Double:
|
||||
return Protocol16.GpType.Double;
|
||||
default:
|
||||
if (typeCode2 == TypeCode.String)
|
||||
{
|
||||
return Protocol16.GpType.String;
|
||||
}
|
||||
break;
|
||||
}
|
||||
bool isArray = type.IsArray;
|
||||
Protocol16.GpType gpType;
|
||||
if (isArray)
|
||||
{
|
||||
bool flag = type == typeof(byte[]);
|
||||
if (flag)
|
||||
{
|
||||
gpType = Protocol16.GpType.ByteArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpType = Protocol16.GpType.Array;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = type == typeof(Hashtable);
|
||||
if (flag2)
|
||||
{
|
||||
gpType = Protocol16.GpType.Hashtable;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = type.IsGenericType && typeof(Dictionary<, >) == type.GetGenericTypeDefinition();
|
||||
if (flag3)
|
||||
{
|
||||
gpType = Protocol16.GpType.Dictionary;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = type == typeof(EventData);
|
||||
if (flag4)
|
||||
{
|
||||
gpType = Protocol16.GpType.EventData;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = type == typeof(OperationRequest);
|
||||
if (flag5)
|
||||
{
|
||||
gpType = Protocol16.GpType.OperationRequest;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = type == typeof(OperationResponse);
|
||||
if (flag6)
|
||||
{
|
||||
gpType = Protocol16.GpType.OperationResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpType = Protocol16.GpType.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return gpType;
|
||||
}
|
||||
|
||||
// Token: 0x060001DD RID: 477 RVA: 0x0000FCD4 File Offset: 0x0000DED4
|
||||
private Array CreateArrayByType(byte arrayType, short length)
|
||||
{
|
||||
return Array.CreateInstance(this.GetTypeOfCode(arrayType), (int)length);
|
||||
}
|
||||
|
||||
// Token: 0x060001DE RID: 478 RVA: 0x0000FCF3 File Offset: 0x0000DEF3
|
||||
private void SerializeOperationRequest(StreamBuffer stream, OperationRequest serObject, bool setType)
|
||||
{
|
||||
this.SerializeOperationRequest(stream, serObject.OperationCode, serObject.Parameters, setType);
|
||||
}
|
||||
|
||||
// Token: 0x060001DF RID: 479 RVA: 0x0000FD0C File Offset: 0x0000DF0C
|
||||
public override void SerializeOperationRequest(StreamBuffer stream, byte operationCode, Dictionary<byte, object> parameters, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
stream.WriteByte(113);
|
||||
}
|
||||
stream.WriteByte(operationCode);
|
||||
this.SerializeParameterTable(stream, parameters);
|
||||
}
|
||||
|
||||
// Token: 0x060001E0 RID: 480 RVA: 0x0000FD3C File Offset: 0x0000DF3C
|
||||
public override OperationRequest DeserializeOperationRequest(StreamBuffer din)
|
||||
{
|
||||
return new OperationRequest
|
||||
{
|
||||
OperationCode = this.DeserializeByte(din),
|
||||
Parameters = this.DeserializeParameterTable(din)
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060001E1 RID: 481 RVA: 0x0000FD70 File Offset: 0x0000DF70
|
||||
public override void SerializeOperationResponse(StreamBuffer stream, OperationResponse serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
stream.WriteByte(112);
|
||||
}
|
||||
stream.WriteByte(serObject.OperationCode);
|
||||
this.SerializeShort(stream, serObject.ReturnCode, false);
|
||||
bool flag = string.IsNullOrEmpty(serObject.DebugMessage);
|
||||
if (flag)
|
||||
{
|
||||
stream.WriteByte(42);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SerializeString(stream, serObject.DebugMessage, false);
|
||||
}
|
||||
this.SerializeParameterTable(stream, serObject.Parameters);
|
||||
}
|
||||
|
||||
// Token: 0x060001E2 RID: 482 RVA: 0x0000FDE8 File Offset: 0x0000DFE8
|
||||
public override OperationResponse DeserializeOperationResponse(StreamBuffer stream)
|
||||
{
|
||||
return new OperationResponse
|
||||
{
|
||||
OperationCode = this.DeserializeByte(stream),
|
||||
ReturnCode = this.DeserializeShort(stream),
|
||||
DebugMessage = (this.Deserialize(stream, this.DeserializeByte(stream)) as string),
|
||||
Parameters = this.DeserializeParameterTable(stream)
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060001E3 RID: 483 RVA: 0x0000FE44 File Offset: 0x0000E044
|
||||
public override void SerializeEventData(StreamBuffer stream, EventData serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
stream.WriteByte(101);
|
||||
}
|
||||
stream.WriteByte(serObject.Code);
|
||||
this.SerializeParameterTable(stream, serObject.Parameters);
|
||||
}
|
||||
|
||||
// Token: 0x060001E4 RID: 484 RVA: 0x0000FE80 File Offset: 0x0000E080
|
||||
public override EventData DeserializeEventData(StreamBuffer din)
|
||||
{
|
||||
return new EventData
|
||||
{
|
||||
Code = this.DeserializeByte(din),
|
||||
Parameters = this.DeserializeParameterTable(din)
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060001E5 RID: 485 RVA: 0x0000FEB4 File Offset: 0x0000E0B4
|
||||
private void SerializeParameterTable(StreamBuffer stream, Dictionary<byte, object> parameters)
|
||||
{
|
||||
bool flag = parameters == null || parameters.Count == 0;
|
||||
if (flag)
|
||||
{
|
||||
this.SerializeShort(stream, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SerializeShort(stream, (short)parameters.Count, false);
|
||||
foreach (KeyValuePair<byte, object> keyValuePair in parameters)
|
||||
{
|
||||
stream.WriteByte(keyValuePair.Key);
|
||||
this.Serialize(stream, keyValuePair.Value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001E6 RID: 486 RVA: 0x0000FF50 File Offset: 0x0000E150
|
||||
private Dictionary<byte, object> DeserializeParameterTable(StreamBuffer stream)
|
||||
{
|
||||
short num = this.DeserializeShort(stream);
|
||||
Dictionary<byte, object> dictionary = new Dictionary<byte, object>((int)num);
|
||||
for (int i = 0; i < (int)num; i++)
|
||||
{
|
||||
byte b = (byte)stream.ReadByte();
|
||||
object obj = this.Deserialize(stream, (byte)stream.ReadByte());
|
||||
dictionary[b] = obj;
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
// Token: 0x060001E7 RID: 487 RVA: 0x0000FFAC File Offset: 0x0000E1AC
|
||||
public override void Serialize(StreamBuffer dout, object serObject, bool setType)
|
||||
{
|
||||
bool flag = serObject == null;
|
||||
if (flag)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(42);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Protocol16.GpType codeOfType = this.GetCodeOfType(serObject.GetType());
|
||||
Protocol16.GpType gpType = codeOfType;
|
||||
if (gpType != Protocol16.GpType.Dictionary)
|
||||
{
|
||||
switch (gpType)
|
||||
{
|
||||
case Protocol16.GpType.Byte:
|
||||
this.SerializeByte(dout, (byte)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Double:
|
||||
this.SerializeDouble(dout, (double)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.EventData:
|
||||
this.SerializeEventData(dout, (EventData)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Float:
|
||||
this.SerializeFloat(dout, (float)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Hashtable:
|
||||
this.SerializeHashTable(dout, (Hashtable)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Integer:
|
||||
this.SerializeInteger(dout, (int)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Short:
|
||||
this.SerializeShort(dout, (short)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Long:
|
||||
this.SerializeLong(dout, (long)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Boolean:
|
||||
this.SerializeBoolean(dout, (bool)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.OperationResponse:
|
||||
this.SerializeOperationResponse(dout, (OperationResponse)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.OperationRequest:
|
||||
this.SerializeOperationRequest(dout, (OperationRequest)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.String:
|
||||
this.SerializeString(dout, (string)serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.ByteArray:
|
||||
this.SerializeByteArray(dout, (byte[])serObject, setType);
|
||||
return;
|
||||
case Protocol16.GpType.Array:
|
||||
{
|
||||
bool flag2 = serObject is int[];
|
||||
if (flag2)
|
||||
{
|
||||
this.SerializeIntArrayOptimized(dout, (int[])serObject, setType);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = serObject.GetType().GetElementType() == typeof(object);
|
||||
if (flag3)
|
||||
{
|
||||
this.SerializeObjectArray(dout, serObject as object[], setType);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SerializeArray(dout, (Array)serObject, setType);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
bool flag4 = serObject is ArraySegment<byte>;
|
||||
if (flag4)
|
||||
{
|
||||
ArraySegment<byte> arraySegment = (ArraySegment<byte>)serObject;
|
||||
this.SerializeByteArraySegment(dout, arraySegment.Array, arraySegment.Offset, arraySegment.Count, setType);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = !this.SerializeCustom(dout, serObject);
|
||||
if (flag5)
|
||||
{
|
||||
throw new Exception("cannot serialize(): " + serObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SerializeDictionary(dout, (IDictionary)serObject, setType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001E8 RID: 488 RVA: 0x0001023C File Offset: 0x0000E43C
|
||||
private void SerializeByte(StreamBuffer dout, byte serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(98);
|
||||
}
|
||||
dout.WriteByte(serObject);
|
||||
}
|
||||
|
||||
// Token: 0x060001E9 RID: 489 RVA: 0x00010264 File Offset: 0x0000E464
|
||||
private void SerializeBoolean(StreamBuffer dout, bool serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(111);
|
||||
}
|
||||
dout.WriteByte(serObject ? 1 : 0);
|
||||
}
|
||||
|
||||
// Token: 0x060001EA RID: 490 RVA: 0x00010290 File Offset: 0x0000E490
|
||||
public override void SerializeShort(StreamBuffer dout, short serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(107);
|
||||
}
|
||||
byte[] array = this.memShort;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memShort;
|
||||
array2[0] = (byte)(serObject >> 8);
|
||||
array2[1] = (byte)serObject;
|
||||
dout.Write(array2, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001EB RID: 491 RVA: 0x000102F8 File Offset: 0x0000E4F8
|
||||
private void SerializeInteger(StreamBuffer dout, int serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(105);
|
||||
}
|
||||
byte[] array = this.memInteger;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memInteger;
|
||||
array2[0] = (byte)(serObject >> 24);
|
||||
array2[1] = (byte)(serObject >> 16);
|
||||
array2[2] = (byte)(serObject >> 8);
|
||||
array2[3] = (byte)serObject;
|
||||
dout.Write(array2, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001EC RID: 492 RVA: 0x00010370 File Offset: 0x0000E570
|
||||
private void SerializeLong(StreamBuffer dout, long serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(108);
|
||||
}
|
||||
long[] array = this.memLongBlock;
|
||||
lock (array)
|
||||
{
|
||||
this.memLongBlock[0] = serObject;
|
||||
Buffer.BlockCopy(this.memLongBlock, 0, this.memLongBlockBytes, 0, 8);
|
||||
byte[] array2 = this.memLongBlockBytes;
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = array2[0];
|
||||
byte b2 = array2[1];
|
||||
byte b3 = array2[2];
|
||||
byte b4 = array2[3];
|
||||
array2[0] = array2[7];
|
||||
array2[1] = array2[6];
|
||||
array2[2] = array2[5];
|
||||
array2[3] = array2[4];
|
||||
array2[4] = b4;
|
||||
array2[5] = b3;
|
||||
array2[6] = b2;
|
||||
array2[7] = b;
|
||||
}
|
||||
dout.Write(array2, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001ED RID: 493 RVA: 0x00010434 File Offset: 0x0000E634
|
||||
private void SerializeFloat(StreamBuffer dout, float serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(102);
|
||||
}
|
||||
byte[] array = Protocol16.memFloatBlockBytes;
|
||||
lock (array)
|
||||
{
|
||||
Protocol16.memFloatBlock[0] = serObject;
|
||||
Buffer.BlockCopy(Protocol16.memFloatBlock, 0, Protocol16.memFloatBlockBytes, 0, 4);
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = Protocol16.memFloatBlockBytes[0];
|
||||
byte b2 = Protocol16.memFloatBlockBytes[1];
|
||||
Protocol16.memFloatBlockBytes[0] = Protocol16.memFloatBlockBytes[3];
|
||||
Protocol16.memFloatBlockBytes[1] = Protocol16.memFloatBlockBytes[2];
|
||||
Protocol16.memFloatBlockBytes[2] = b2;
|
||||
Protocol16.memFloatBlockBytes[3] = b;
|
||||
}
|
||||
dout.Write(Protocol16.memFloatBlockBytes, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001EE RID: 494 RVA: 0x000104F0 File Offset: 0x0000E6F0
|
||||
private void SerializeDouble(StreamBuffer dout, double serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(100);
|
||||
}
|
||||
byte[] array = this.memDoubleBlockBytes;
|
||||
lock (array)
|
||||
{
|
||||
this.memDoubleBlock[0] = serObject;
|
||||
Buffer.BlockCopy(this.memDoubleBlock, 0, this.memDoubleBlockBytes, 0, 8);
|
||||
byte[] array2 = this.memDoubleBlockBytes;
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = array2[0];
|
||||
byte b2 = array2[1];
|
||||
byte b3 = array2[2];
|
||||
byte b4 = array2[3];
|
||||
array2[0] = array2[7];
|
||||
array2[1] = array2[6];
|
||||
array2[2] = array2[5];
|
||||
array2[3] = array2[4];
|
||||
array2[4] = b4;
|
||||
array2[5] = b3;
|
||||
array2[6] = b2;
|
||||
array2[7] = b;
|
||||
}
|
||||
dout.Write(array2, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001EF RID: 495 RVA: 0x000105B4 File Offset: 0x0000E7B4
|
||||
public override void SerializeString(StreamBuffer dout, string serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(115);
|
||||
}
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(serObject);
|
||||
bool flag = bytes.Length > 32767;
|
||||
if (flag)
|
||||
{
|
||||
throw new NotSupportedException("Strings that exceed a UTF8-encoded byte-length of 32767 (short.MaxValue) are not supported. Yours is: " + bytes.Length);
|
||||
}
|
||||
this.SerializeShort(dout, (short)bytes.Length, false);
|
||||
dout.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060001F0 RID: 496 RVA: 0x00010620 File Offset: 0x0000E820
|
||||
private void SerializeArray(StreamBuffer dout, Array serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(121);
|
||||
}
|
||||
bool flag = serObject.Length > 32767;
|
||||
if (flag)
|
||||
{
|
||||
throw new NotSupportedException("String[] that exceed 32767 (short.MaxValue) entries are not supported. Yours is: " + serObject.Length);
|
||||
}
|
||||
this.SerializeShort(dout, (short)serObject.Length, false);
|
||||
Type elementType = serObject.GetType().GetElementType();
|
||||
Protocol16.GpType codeOfType = this.GetCodeOfType(elementType);
|
||||
bool flag2 = codeOfType > Protocol16.GpType.Unknown;
|
||||
if (flag2)
|
||||
{
|
||||
dout.WriteByte((byte)codeOfType);
|
||||
bool flag3 = codeOfType == Protocol16.GpType.Dictionary;
|
||||
if (flag3)
|
||||
{
|
||||
bool flag4;
|
||||
bool flag5;
|
||||
this.SerializeDictionaryHeader(dout, serObject, out flag4, out flag5);
|
||||
for (int i = 0; i < serObject.Length; i++)
|
||||
{
|
||||
object value = serObject.GetValue(i);
|
||||
this.SerializeDictionaryElements(dout, value, flag4, flag5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < serObject.Length; j++)
|
||||
{
|
||||
object value2 = serObject.GetValue(j);
|
||||
this.Serialize(dout, value2, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomType customType;
|
||||
bool flag6 = Protocol.TypeDict.TryGetValue(elementType, out customType);
|
||||
if (!flag6)
|
||||
{
|
||||
throw new NotSupportedException("cannot serialize array of type " + elementType);
|
||||
}
|
||||
dout.WriteByte(99);
|
||||
dout.WriteByte(customType.Code);
|
||||
for (int k = 0; k < serObject.Length; k++)
|
||||
{
|
||||
object value3 = serObject.GetValue(k);
|
||||
bool flag7 = customType.SerializeStreamFunction == null;
|
||||
if (flag7)
|
||||
{
|
||||
byte[] array = customType.SerializeFunction(value3);
|
||||
this.SerializeShort(dout, (short)array.Length, false);
|
||||
dout.Write(array, 0, array.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
long position = dout.Position;
|
||||
dout.Position += 2L;
|
||||
short num = customType.SerializeStreamFunction(dout, value3);
|
||||
long position2 = dout.Position;
|
||||
dout.Position = position;
|
||||
this.SerializeShort(dout, num, false);
|
||||
dout.Position += (long)num;
|
||||
bool flag8 = dout.Position != position2;
|
||||
if (flag8)
|
||||
{
|
||||
throw new Exception(string.Concat(new object[] { "Serialization failed. Stream position corrupted. Should be ", position2, " is now: ", dout.Position, " serializedLength: ", num }));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001F1 RID: 497 RVA: 0x0001089C File Offset: 0x0000EA9C
|
||||
private void SerializeByteArray(StreamBuffer dout, byte[] serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(120);
|
||||
}
|
||||
this.SerializeInteger(dout, serObject.Length, false);
|
||||
dout.Write(serObject, 0, serObject.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060001F2 RID: 498 RVA: 0x000108D4 File Offset: 0x0000EAD4
|
||||
private void SerializeByteArraySegment(StreamBuffer dout, byte[] serObject, int offset, int count, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(120);
|
||||
}
|
||||
this.SerializeInteger(dout, count, false);
|
||||
dout.Write(serObject, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060001F3 RID: 499 RVA: 0x0001090C File Offset: 0x0000EB0C
|
||||
private void SerializeIntArrayOptimized(StreamBuffer inWriter, int[] serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
inWriter.WriteByte(121);
|
||||
}
|
||||
this.SerializeShort(inWriter, (short)serObject.Length, false);
|
||||
inWriter.WriteByte(105);
|
||||
byte[] array = new byte[serObject.Length * 4];
|
||||
int num = 0;
|
||||
for (int i = 0; i < serObject.Length; i++)
|
||||
{
|
||||
array[num++] = (byte)(serObject[i] >> 24);
|
||||
array[num++] = (byte)(serObject[i] >> 16);
|
||||
array[num++] = (byte)(serObject[i] >> 8);
|
||||
array[num++] = (byte)serObject[i];
|
||||
}
|
||||
inWriter.Write(array, 0, array.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060001F4 RID: 500 RVA: 0x000109A4 File Offset: 0x0000EBA4
|
||||
private void SerializeStringArray(StreamBuffer dout, string[] serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(97);
|
||||
}
|
||||
this.SerializeShort(dout, (short)serObject.Length, false);
|
||||
for (int i = 0; i < serObject.Length; i++)
|
||||
{
|
||||
this.SerializeString(dout, serObject[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001F5 RID: 501 RVA: 0x000109F0 File Offset: 0x0000EBF0
|
||||
private void SerializeObjectArray(StreamBuffer dout, object[] objects, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(122);
|
||||
}
|
||||
this.SerializeShort(dout, (short)objects.Length, false);
|
||||
foreach (object obj in objects)
|
||||
{
|
||||
this.Serialize(dout, obj, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001F6 RID: 502 RVA: 0x00010A40 File Offset: 0x0000EC40
|
||||
private void SerializeHashTable(StreamBuffer dout, Hashtable serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(104);
|
||||
}
|
||||
this.SerializeShort(dout, (short)serObject.Count, false);
|
||||
Dictionary<object, object>.KeyCollection keys = serObject.Keys;
|
||||
foreach (object obj in keys)
|
||||
{
|
||||
this.Serialize(dout, obj, true);
|
||||
this.Serialize(dout, serObject[obj], true);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001F7 RID: 503 RVA: 0x00010AD0 File Offset: 0x0000ECD0
|
||||
private void SerializeDictionary(StreamBuffer dout, IDictionary serObject, bool setType)
|
||||
{
|
||||
if (setType)
|
||||
{
|
||||
dout.WriteByte(68);
|
||||
}
|
||||
bool flag;
|
||||
bool flag2;
|
||||
this.SerializeDictionaryHeader(dout, serObject, out flag, out flag2);
|
||||
this.SerializeDictionaryElements(dout, serObject, flag, flag2);
|
||||
}
|
||||
|
||||
// Token: 0x060001F8 RID: 504 RVA: 0x00010B08 File Offset: 0x0000ED08
|
||||
private void SerializeDictionaryHeader(StreamBuffer writer, Type dictType)
|
||||
{
|
||||
bool flag;
|
||||
bool flag2;
|
||||
this.SerializeDictionaryHeader(writer, dictType, out flag, out flag2);
|
||||
}
|
||||
|
||||
// Token: 0x060001F9 RID: 505 RVA: 0x00010B24 File Offset: 0x0000ED24
|
||||
private void SerializeDictionaryHeader(StreamBuffer writer, object dict, out bool setKeyType, out bool setValueType)
|
||||
{
|
||||
Type[] genericArguments = dict.GetType().GetGenericArguments();
|
||||
setKeyType = genericArguments[0] == typeof(object);
|
||||
setValueType = genericArguments[1] == typeof(object);
|
||||
bool flag = setKeyType;
|
||||
if (flag)
|
||||
{
|
||||
writer.WriteByte(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Protocol16.GpType codeOfType = this.GetCodeOfType(genericArguments[0]);
|
||||
bool flag2 = codeOfType == Protocol16.GpType.Unknown || codeOfType == Protocol16.GpType.Dictionary;
|
||||
if (flag2)
|
||||
{
|
||||
throw new Exception("Unexpected - cannot serialize Dictionary with key type: " + genericArguments[0]);
|
||||
}
|
||||
writer.WriteByte((byte)codeOfType);
|
||||
}
|
||||
bool flag3 = setValueType;
|
||||
if (flag3)
|
||||
{
|
||||
writer.WriteByte(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Protocol16.GpType codeOfType2 = this.GetCodeOfType(genericArguments[1]);
|
||||
bool flag4 = codeOfType2 == Protocol16.GpType.Unknown;
|
||||
if (flag4)
|
||||
{
|
||||
throw new Exception("Unexpected - cannot serialize Dictionary with value type: " + genericArguments[0]);
|
||||
}
|
||||
writer.WriteByte((byte)codeOfType2);
|
||||
bool flag5 = codeOfType2 == Protocol16.GpType.Dictionary;
|
||||
if (flag5)
|
||||
{
|
||||
this.SerializeDictionaryHeader(writer, genericArguments[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001FA RID: 506 RVA: 0x00010C10 File Offset: 0x0000EE10
|
||||
private void SerializeDictionaryElements(StreamBuffer writer, object dict, bool setKeyType, bool setValueType)
|
||||
{
|
||||
IDictionary dictionary = (IDictionary)dict;
|
||||
this.SerializeShort(writer, (short)dictionary.Count, false);
|
||||
foreach (object obj in dictionary)
|
||||
{
|
||||
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
|
||||
bool flag = !setValueType && dictionaryEntry.Value == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new Exception("Can't serialize null in Dictionary with specific value-type.");
|
||||
}
|
||||
bool flag2 = !setKeyType && dictionaryEntry.Key == null;
|
||||
if (flag2)
|
||||
{
|
||||
throw new Exception("Can't serialize null in Dictionary with specific key-type.");
|
||||
}
|
||||
this.Serialize(writer, dictionaryEntry.Key, setKeyType);
|
||||
this.Serialize(writer, dictionaryEntry.Value, setValueType);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001FB RID: 507 RVA: 0x00010CE0 File Offset: 0x0000EEE0
|
||||
public override object Deserialize(StreamBuffer din, byte type)
|
||||
{
|
||||
if (type <= 42)
|
||||
{
|
||||
if (type == 0 || type == 42)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == 68)
|
||||
{
|
||||
return this.DeserializeDictionary(din);
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case 97:
|
||||
return this.DeserializeStringArray(din);
|
||||
case 98:
|
||||
return this.DeserializeByte(din);
|
||||
case 99:
|
||||
{
|
||||
byte b = (byte)din.ReadByte();
|
||||
return this.DeserializeCustom(din, b);
|
||||
}
|
||||
case 100:
|
||||
return this.DeserializeDouble(din);
|
||||
case 101:
|
||||
return this.DeserializeEventData(din);
|
||||
case 102:
|
||||
return this.DeserializeFloat(din);
|
||||
case 104:
|
||||
return this.DeserializeHashTable(din);
|
||||
case 105:
|
||||
return this.DeserializeInteger(din);
|
||||
case 107:
|
||||
return this.DeserializeShort(din);
|
||||
case 108:
|
||||
return this.DeserializeLong(din);
|
||||
case 110:
|
||||
return this.DeserializeIntArray(din);
|
||||
case 111:
|
||||
return this.DeserializeBoolean(din);
|
||||
case 112:
|
||||
return this.DeserializeOperationResponse(din);
|
||||
case 113:
|
||||
return this.DeserializeOperationRequest(din);
|
||||
case 115:
|
||||
return this.DeserializeString(din);
|
||||
case 120:
|
||||
return this.DeserializeByteArray(din);
|
||||
case 121:
|
||||
return this.DeserializeArray(din);
|
||||
case 122:
|
||||
return this.DeserializeObjectArray(din);
|
||||
}
|
||||
}
|
||||
throw new Exception(string.Concat(new object[]
|
||||
{
|
||||
"Deserialize(): ",
|
||||
type,
|
||||
" pos: ",
|
||||
din.Position,
|
||||
" bytes: ",
|
||||
din.Length,
|
||||
". ",
|
||||
SupportClass.ByteArrayToString(din.GetBuffer())
|
||||
}));
|
||||
}
|
||||
|
||||
// Token: 0x060001FC RID: 508 RVA: 0x00010F10 File Offset: 0x0000F110
|
||||
public override byte DeserializeByte(StreamBuffer din)
|
||||
{
|
||||
return (byte)din.ReadByte();
|
||||
}
|
||||
|
||||
// Token: 0x060001FD RID: 509 RVA: 0x00010F2C File Offset: 0x0000F12C
|
||||
private bool DeserializeBoolean(StreamBuffer din)
|
||||
{
|
||||
return din.ReadByte() != 0;
|
||||
}
|
||||
|
||||
// Token: 0x060001FE RID: 510 RVA: 0x00010F48 File Offset: 0x0000F148
|
||||
public override short DeserializeShort(StreamBuffer din)
|
||||
{
|
||||
byte[] array = this.memShort;
|
||||
short num;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memShort;
|
||||
din.Read(array2, 0, 2);
|
||||
num = (short)(((int)array2[0] << 8) | (int)array2[1]);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060001FF RID: 511 RVA: 0x00010F9C File Offset: 0x0000F19C
|
||||
private int DeserializeInteger(StreamBuffer din)
|
||||
{
|
||||
byte[] array = this.memInteger;
|
||||
int num;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memInteger;
|
||||
din.Read(array2, 0, 4);
|
||||
num = ((int)array2[0] << 24) | ((int)array2[1] << 16) | ((int)array2[2] << 8) | (int)array2[3];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000200 RID: 512 RVA: 0x00011000 File Offset: 0x0000F200
|
||||
private long DeserializeLong(StreamBuffer din)
|
||||
{
|
||||
byte[] array = this.memLong;
|
||||
long num;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memLong;
|
||||
din.Read(array2, 0, 8);
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
num = (long)(((ulong)array2[0] << 56) | ((ulong)array2[1] << 48) | ((ulong)array2[2] << 40) | ((ulong)array2[3] << 32) | ((ulong)array2[4] << 24) | ((ulong)array2[5] << 16) | ((ulong)array2[6] << 8) | (ulong)array2[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
num = BitConverter.ToInt64(array2, 0);
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000201 RID: 513 RVA: 0x0001109C File Offset: 0x0000F29C
|
||||
private float DeserializeFloat(StreamBuffer din)
|
||||
{
|
||||
byte[] array = this.memFloat;
|
||||
float num;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memFloat;
|
||||
din.Read(array2, 0, 4);
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = array2[0];
|
||||
byte b2 = array2[1];
|
||||
array2[0] = array2[3];
|
||||
array2[1] = array2[2];
|
||||
array2[2] = b2;
|
||||
array2[3] = b;
|
||||
}
|
||||
num = BitConverter.ToSingle(array2, 0);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000202 RID: 514 RVA: 0x00011118 File Offset: 0x0000F318
|
||||
private double DeserializeDouble(StreamBuffer din)
|
||||
{
|
||||
byte[] array = this.memDouble;
|
||||
double num;
|
||||
lock (array)
|
||||
{
|
||||
byte[] array2 = this.memDouble;
|
||||
din.Read(array2, 0, 8);
|
||||
bool isLittleEndian = BitConverter.IsLittleEndian;
|
||||
if (isLittleEndian)
|
||||
{
|
||||
byte b = array2[0];
|
||||
byte b2 = array2[1];
|
||||
byte b3 = array2[2];
|
||||
byte b4 = array2[3];
|
||||
array2[0] = array2[7];
|
||||
array2[1] = array2[6];
|
||||
array2[2] = array2[5];
|
||||
array2[3] = array2[4];
|
||||
array2[4] = b4;
|
||||
array2[5] = b3;
|
||||
array2[6] = b2;
|
||||
array2[7] = b;
|
||||
}
|
||||
num = BitConverter.ToDouble(array2, 0);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000203 RID: 515 RVA: 0x000111B4 File Offset: 0x0000F3B4
|
||||
private string DeserializeString(StreamBuffer din)
|
||||
{
|
||||
short num = this.DeserializeShort(din);
|
||||
bool flag = num == 0;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.memString == null || this.memString.Length < (int)num;
|
||||
if (flag2)
|
||||
{
|
||||
this.memString = new byte[(int)num];
|
||||
}
|
||||
din.Read(this.memString, 0, (int)num);
|
||||
text = Encoding.UTF8.GetString(this.memString, 0, (int)num);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x06000204 RID: 516 RVA: 0x00011228 File Offset: 0x0000F428
|
||||
private Array DeserializeArray(StreamBuffer din)
|
||||
{
|
||||
short num = this.DeserializeShort(din);
|
||||
byte b = (byte)din.ReadByte();
|
||||
bool flag = b == 121;
|
||||
Array array2;
|
||||
if (flag)
|
||||
{
|
||||
Array array = this.DeserializeArray(din);
|
||||
Type type = array.GetType();
|
||||
array2 = Array.CreateInstance(type, (int)num);
|
||||
array2.SetValue(array, 0);
|
||||
for (short num2 = 1; num2 < num; num2 += 1)
|
||||
{
|
||||
array = this.DeserializeArray(din);
|
||||
array2.SetValue(array, (int)num2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = b == 120;
|
||||
if (flag2)
|
||||
{
|
||||
array2 = Array.CreateInstance(typeof(byte[]), (int)num);
|
||||
for (short num3 = 0; num3 < num; num3 += 1)
|
||||
{
|
||||
Array array3 = this.DeserializeByteArray(din);
|
||||
array2.SetValue(array3, (int)num3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = b == 99;
|
||||
if (flag3)
|
||||
{
|
||||
byte b2 = (byte)din.ReadByte();
|
||||
CustomType customType;
|
||||
bool flag4 = Protocol.CodeDict.TryGetValue(b2, out customType);
|
||||
if (!flag4)
|
||||
{
|
||||
throw new Exception("Cannot find deserializer for custom type: " + b2);
|
||||
}
|
||||
array2 = Array.CreateInstance(customType.Type, (int)num);
|
||||
for (int i = 0; i < (int)num; i++)
|
||||
{
|
||||
short num4 = this.DeserializeShort(din);
|
||||
bool flag5 = customType.DeserializeStreamFunction == null;
|
||||
if (flag5)
|
||||
{
|
||||
byte[] array4 = new byte[(int)num4];
|
||||
din.Read(array4, 0, (int)num4);
|
||||
array2.SetValue(customType.DeserializeFunction(array4), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
array2.SetValue(customType.DeserializeStreamFunction(din, num4), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag6 = b == 68;
|
||||
if (flag6)
|
||||
{
|
||||
Array array5 = null;
|
||||
this.DeserializeDictionaryArray(din, num, out array5);
|
||||
return array5;
|
||||
}
|
||||
array2 = this.CreateArrayByType(b, num);
|
||||
for (short num5 = 0; num5 < num; num5 += 1)
|
||||
{
|
||||
array2.SetValue(this.Deserialize(din, b), (int)num5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
// Token: 0x06000205 RID: 517 RVA: 0x0001142C File Offset: 0x0000F62C
|
||||
private byte[] DeserializeByteArray(StreamBuffer din)
|
||||
{
|
||||
int num = this.DeserializeInteger(din);
|
||||
byte[] array = new byte[num];
|
||||
din.Read(array, 0, num);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000206 RID: 518 RVA: 0x00011458 File Offset: 0x0000F658
|
||||
private int[] DeserializeIntArray(StreamBuffer din)
|
||||
{
|
||||
int num = this.DeserializeInteger(din);
|
||||
int[] array = new int[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
array[i] = this.DeserializeInteger(din);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000207 RID: 519 RVA: 0x00011498 File Offset: 0x0000F698
|
||||
private string[] DeserializeStringArray(StreamBuffer din)
|
||||
{
|
||||
int num = (int)this.DeserializeShort(din);
|
||||
string[] array = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
array[i] = this.DeserializeString(din);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000208 RID: 520 RVA: 0x000114D8 File Offset: 0x0000F6D8
|
||||
private object[] DeserializeObjectArray(StreamBuffer din)
|
||||
{
|
||||
short num = this.DeserializeShort(din);
|
||||
object[] array = new object[(int)num];
|
||||
for (int i = 0; i < (int)num; i++)
|
||||
{
|
||||
byte b = (byte)din.ReadByte();
|
||||
array[i] = this.Deserialize(din, b);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000209 RID: 521 RVA: 0x00011524 File Offset: 0x0000F724
|
||||
private Hashtable DeserializeHashTable(StreamBuffer din)
|
||||
{
|
||||
int num = (int)this.DeserializeShort(din);
|
||||
Hashtable hashtable = new Hashtable(num);
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
object obj = this.Deserialize(din, (byte)din.ReadByte());
|
||||
object obj2 = this.Deserialize(din, (byte)din.ReadByte());
|
||||
hashtable[obj] = obj2;
|
||||
}
|
||||
return hashtable;
|
||||
}
|
||||
|
||||
// Token: 0x0600020A RID: 522 RVA: 0x00011588 File Offset: 0x0000F788
|
||||
private IDictionary DeserializeDictionary(StreamBuffer din)
|
||||
{
|
||||
byte b = (byte)din.ReadByte();
|
||||
byte b2 = (byte)din.ReadByte();
|
||||
int num = (int)this.DeserializeShort(din);
|
||||
bool flag = b == 0 || b == 42;
|
||||
bool flag2 = b2 == 0 || b2 == 42;
|
||||
Type typeOfCode = this.GetTypeOfCode(b);
|
||||
Type typeOfCode2 = this.GetTypeOfCode(b2);
|
||||
Type type = typeof(Dictionary<, >).MakeGenericType(new Type[] { typeOfCode, typeOfCode2 });
|
||||
IDictionary dictionary = Activator.CreateInstance(type) as IDictionary;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
object obj = this.Deserialize(din, flag ? ((byte)din.ReadByte()) : b);
|
||||
object obj2 = this.Deserialize(din, flag2 ? ((byte)din.ReadByte()) : b2);
|
||||
dictionary.Add(obj, obj2);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
// Token: 0x0600020B RID: 523 RVA: 0x00011664 File Offset: 0x0000F864
|
||||
private bool DeserializeDictionaryArray(StreamBuffer din, short size, out Array arrayResult)
|
||||
{
|
||||
byte b;
|
||||
byte b2;
|
||||
Type type = this.DeserializeDictionaryType(din, out b, out b2);
|
||||
arrayResult = Array.CreateInstance(type, (int)size);
|
||||
for (short num = 0; num < size; num += 1)
|
||||
{
|
||||
IDictionary dictionary = Activator.CreateInstance(type) as IDictionary;
|
||||
bool flag = dictionary == null;
|
||||
if (flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
short num2 = this.DeserializeShort(din);
|
||||
for (int i = 0; i < (int)num2; i++)
|
||||
{
|
||||
bool flag2 = b > 0;
|
||||
object obj;
|
||||
if (flag2)
|
||||
{
|
||||
obj = this.Deserialize(din, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte b3 = (byte)din.ReadByte();
|
||||
obj = this.Deserialize(din, b3);
|
||||
}
|
||||
bool flag3 = b2 > 0;
|
||||
object obj2;
|
||||
if (flag3)
|
||||
{
|
||||
obj2 = this.Deserialize(din, b2);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte b4 = (byte)din.ReadByte();
|
||||
obj2 = this.Deserialize(din, b4);
|
||||
}
|
||||
dictionary.Add(obj, obj2);
|
||||
}
|
||||
arrayResult.SetValue(dictionary, (int)num);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0600020C RID: 524 RVA: 0x00011760 File Offset: 0x0000F960
|
||||
private Type DeserializeDictionaryType(StreamBuffer reader, out byte keyTypeCode, out byte valTypeCode)
|
||||
{
|
||||
keyTypeCode = (byte)reader.ReadByte();
|
||||
valTypeCode = (byte)reader.ReadByte();
|
||||
Protocol16.GpType gpType = (Protocol16.GpType)keyTypeCode;
|
||||
Protocol16.GpType gpType2 = (Protocol16.GpType)valTypeCode;
|
||||
bool flag = gpType == Protocol16.GpType.Unknown;
|
||||
Type type;
|
||||
if (flag)
|
||||
{
|
||||
type = typeof(object);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = this.GetTypeOfCode(keyTypeCode);
|
||||
}
|
||||
bool flag2 = gpType2 == Protocol16.GpType.Unknown;
|
||||
Type type2;
|
||||
if (flag2)
|
||||
{
|
||||
type2 = typeof(object);
|
||||
}
|
||||
else
|
||||
{
|
||||
type2 = this.GetTypeOfCode(valTypeCode);
|
||||
}
|
||||
return typeof(Dictionary<, >).MakeGenericType(new Type[] { type, type2 });
|
||||
}
|
||||
|
||||
// Token: 0x04000120 RID: 288
|
||||
private readonly byte[] versionBytes = new byte[] { 1, 6 };
|
||||
|
||||
// Token: 0x04000121 RID: 289
|
||||
private readonly byte[] memShort = new byte[2];
|
||||
|
||||
// Token: 0x04000122 RID: 290
|
||||
private readonly long[] memLongBlock = new long[1];
|
||||
|
||||
// Token: 0x04000123 RID: 291
|
||||
private readonly byte[] memLongBlockBytes = new byte[8];
|
||||
|
||||
// Token: 0x04000124 RID: 292
|
||||
private static readonly float[] memFloatBlock = new float[1];
|
||||
|
||||
// Token: 0x04000125 RID: 293
|
||||
private static readonly byte[] memFloatBlockBytes = new byte[4];
|
||||
|
||||
// Token: 0x04000126 RID: 294
|
||||
private readonly double[] memDoubleBlock = new double[1];
|
||||
|
||||
// Token: 0x04000127 RID: 295
|
||||
private readonly byte[] memDoubleBlockBytes = new byte[8];
|
||||
|
||||
// Token: 0x04000128 RID: 296
|
||||
private readonly byte[] memInteger = new byte[4];
|
||||
|
||||
// Token: 0x04000129 RID: 297
|
||||
private readonly byte[] memLong = new byte[8];
|
||||
|
||||
// Token: 0x0400012A RID: 298
|
||||
private readonly byte[] memFloat = new byte[4];
|
||||
|
||||
// Token: 0x0400012B RID: 299
|
||||
private readonly byte[] memDouble = new byte[8];
|
||||
|
||||
// Token: 0x0400012C RID: 300
|
||||
private byte[] memString;
|
||||
|
||||
// Token: 0x02000049 RID: 73
|
||||
public enum GpType : byte
|
||||
{
|
||||
// Token: 0x040001B0 RID: 432
|
||||
Unknown,
|
||||
// Token: 0x040001B1 RID: 433
|
||||
Array = 121,
|
||||
// Token: 0x040001B2 RID: 434
|
||||
Boolean = 111,
|
||||
// Token: 0x040001B3 RID: 435
|
||||
Byte = 98,
|
||||
// Token: 0x040001B4 RID: 436
|
||||
ByteArray = 120,
|
||||
// Token: 0x040001B5 RID: 437
|
||||
ObjectArray = 122,
|
||||
// Token: 0x040001B6 RID: 438
|
||||
Short = 107,
|
||||
// Token: 0x040001B7 RID: 439
|
||||
Float = 102,
|
||||
// Token: 0x040001B8 RID: 440
|
||||
Dictionary = 68,
|
||||
// Token: 0x040001B9 RID: 441
|
||||
Double = 100,
|
||||
// Token: 0x040001BA RID: 442
|
||||
Hashtable = 104,
|
||||
// Token: 0x040001BB RID: 443
|
||||
Integer,
|
||||
// Token: 0x040001BC RID: 444
|
||||
IntegerArray = 110,
|
||||
// Token: 0x040001BD RID: 445
|
||||
Long = 108,
|
||||
// Token: 0x040001BE RID: 446
|
||||
String = 115,
|
||||
// Token: 0x040001BF RID: 447
|
||||
StringArray = 97,
|
||||
// Token: 0x040001C0 RID: 448
|
||||
Custom = 99,
|
||||
// Token: 0x040001C1 RID: 449
|
||||
Null = 42,
|
||||
// Token: 0x040001C2 RID: 450
|
||||
EventData = 101,
|
||||
// Token: 0x040001C3 RID: 451
|
||||
OperationRequest = 113,
|
||||
// Token: 0x040001C4 RID: 452
|
||||
OperationResponse = 112
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001C RID: 28
|
||||
public enum SerializationProtocol
|
||||
{
|
||||
// Token: 0x0400010C RID: 268
|
||||
GpBinaryV16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001D RID: 29
|
||||
internal static class SerializationProtocolFactory
|
||||
{
|
||||
// Token: 0x06000199 RID: 409 RVA: 0x0000F120 File Offset: 0x0000D320
|
||||
internal static IProtocol Create(SerializationProtocol serializationProtocol)
|
||||
{
|
||||
return new Protocol16();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000022 RID: 34
|
||||
// (Invoke) Token: 0x060001BA RID: 442
|
||||
public delegate byte[] SerializeMethod(object customObject);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000023 RID: 35
|
||||
// (Invoke) Token: 0x060001BE RID: 446
|
||||
public delegate short SerializeStreamMethod(StreamBuffer outStream, object customObject);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000036 RID: 54
|
||||
internal class SimulationItem
|
||||
{
|
||||
// Token: 0x06000250 RID: 592 RVA: 0x000130D4 File Offset: 0x000112D4
|
||||
public SimulationItem()
|
||||
{
|
||||
this.stopw = new Stopwatch();
|
||||
this.stopw.Start();
|
||||
}
|
||||
|
||||
// Token: 0x17000075 RID: 117
|
||||
// (get) Token: 0x06000251 RID: 593 RVA: 0x000130F5 File Offset: 0x000112F5
|
||||
// (set) Token: 0x06000252 RID: 594 RVA: 0x000130FD File Offset: 0x000112FD
|
||||
public int Delay { get; internal set; }
|
||||
|
||||
// Token: 0x04000151 RID: 337
|
||||
internal readonly Stopwatch stopw;
|
||||
|
||||
// Token: 0x04000152 RID: 338
|
||||
public int TimeToExecute;
|
||||
|
||||
// Token: 0x04000153 RID: 339
|
||||
public byte[] DelayedData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000033 RID: 51
|
||||
internal class SocketTcp : IPhotonSocket, IDisposable
|
||||
{
|
||||
// Token: 0x06000240 RID: 576 RVA: 0x00012734 File Offset: 0x00010934
|
||||
public SocketTcp(PeerBase npeer)
|
||||
: base(npeer)
|
||||
{
|
||||
bool flag = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "SocketTcp: TCP, DotNet, Unity.");
|
||||
}
|
||||
this.PollReceive = false;
|
||||
}
|
||||
|
||||
// Token: 0x06000241 RID: 577 RVA: 0x0001277C File Offset: 0x0001097C
|
||||
public void Dispose()
|
||||
{
|
||||
base.State = PhotonSocketState.Disconnecting;
|
||||
bool flag = this.sock != null;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool connected = this.sock.Connected;
|
||||
if (connected)
|
||||
{
|
||||
this.sock.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Dispose(): " + ex);
|
||||
}
|
||||
}
|
||||
this.sock = null;
|
||||
base.State = PhotonSocketState.Disconnected;
|
||||
}
|
||||
|
||||
// Token: 0x06000242 RID: 578 RVA: 0x000127F8 File Offset: 0x000109F8
|
||||
public override bool Connect()
|
||||
{
|
||||
bool flag = base.Connect();
|
||||
bool flag2 = !flag;
|
||||
bool flag3;
|
||||
if (flag2)
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.State = PhotonSocketState.Connecting;
|
||||
new Thread(new ThreadStart(this.DnsAndConnect))
|
||||
{
|
||||
Name = "photon dns thread",
|
||||
IsBackground = true
|
||||
}.Start();
|
||||
flag3 = true;
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x06000243 RID: 579 RVA: 0x00012854 File Offset: 0x00010A54
|
||||
public override bool Disconnect()
|
||||
{
|
||||
bool flag = base.ReportDebugOfLevel(DebugLevel.INFO);
|
||||
if (flag)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "SocketTcp.Disconnect()");
|
||||
}
|
||||
base.State = PhotonSocketState.Disconnecting;
|
||||
object obj = this.syncer;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag2 = this.sock != null;
|
||||
if (flag2)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.sock.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Disconnect(): " + ex);
|
||||
}
|
||||
this.sock = null;
|
||||
}
|
||||
}
|
||||
base.State = PhotonSocketState.Disconnected;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06000244 RID: 580 RVA: 0x00012908 File Offset: 0x00010B08
|
||||
public override PhotonSocketError Send(byte[] data, int length)
|
||||
{
|
||||
bool flag = this.sock == null || !this.sock.Connected;
|
||||
PhotonSocketError photonSocketError;
|
||||
if (flag)
|
||||
{
|
||||
photonSocketError = PhotonSocketError.Skipped;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
this.sock.Send(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag2 = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected;
|
||||
if (flag2)
|
||||
{
|
||||
bool flag3 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag3)
|
||||
{
|
||||
string text = "";
|
||||
bool flag4 = this.sock != null;
|
||||
if (flag4)
|
||||
{
|
||||
text = string.Concat(new object[]
|
||||
{
|
||||
" Local: ",
|
||||
this.sock.LocalEndPoint,
|
||||
" Remote: ",
|
||||
this.sock.RemoteEndPoint,
|
||||
" (",
|
||||
this.sock.Connected ? "connected" : "not connected",
|
||||
", ",
|
||||
this.sock.IsBound ? "bound" : "not bound",
|
||||
")"
|
||||
});
|
||||
}
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[]
|
||||
{
|
||||
"Cannot send to: ",
|
||||
base.ServerAddress,
|
||||
". Uptime: ",
|
||||
SupportClass.GetTickCount() - this.peerBase.timeBase,
|
||||
"ms.",
|
||||
base.AddressResolvedAsIpv6 ? " IPv6" : "",
|
||||
text
|
||||
}));
|
||||
}
|
||||
base.HandleException(StatusCode.Exception);
|
||||
}
|
||||
return PhotonSocketError.Exception;
|
||||
}
|
||||
photonSocketError = PhotonSocketError.Success;
|
||||
}
|
||||
return photonSocketError;
|
||||
}
|
||||
|
||||
// Token: 0x06000245 RID: 581 RVA: 0x00012AC4 File Offset: 0x00010CC4
|
||||
public override PhotonSocketError Receive(out byte[] data)
|
||||
{
|
||||
data = null;
|
||||
return PhotonSocketError.NoData;
|
||||
}
|
||||
|
||||
// Token: 0x06000246 RID: 582 RVA: 0x00012ADC File Offset: 0x00010CDC
|
||||
public void DnsAndConnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
IPAddress ipAddress = IPhotonSocket.GetIpAddress(base.ServerAddress);
|
||||
bool flag = ipAddress == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentException("Invalid IPAddress. Address: " + base.ServerAddress);
|
||||
}
|
||||
this.sock = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
this.sock.NoDelay = true;
|
||||
this.sock.ReceiveTimeout = this.peerBase.DisconnectTimeout;
|
||||
this.sock.SendTimeout = this.peerBase.DisconnectTimeout;
|
||||
this.sock.Connect(ipAddress, base.ServerPort);
|
||||
base.AddressResolvedAsIpv6 = base.IsIpv6SimpleCheck(ipAddress);
|
||||
base.State = PhotonSocketState.Connected;
|
||||
this.peerBase.OnConnect();
|
||||
}
|
||||
catch (SecurityException ex)
|
||||
{
|
||||
bool flag2 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Connect() to '" + base.ServerAddress + "' failed: " + ex.ToString());
|
||||
}
|
||||
base.HandleException(StatusCode.SecurityExceptionOnConnect);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
bool flag3 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag3)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Connect() to '" + base.ServerAddress + "' failed: " + ex2.ToString());
|
||||
}
|
||||
base.HandleException(StatusCode.ExceptionOnConnect);
|
||||
return;
|
||||
}
|
||||
new Thread(new ThreadStart(this.ReceiveLoop))
|
||||
{
|
||||
Name = "photon receive thread",
|
||||
IsBackground = true
|
||||
}.Start();
|
||||
}
|
||||
|
||||
// Token: 0x06000247 RID: 583 RVA: 0x00012C78 File Offset: 0x00010E78
|
||||
public void ReceiveLoop()
|
||||
{
|
||||
StreamBuffer streamBuffer = new StreamBuffer(base.MTU);
|
||||
byte[] array = new byte[9];
|
||||
while (base.State == PhotonSocketState.Connected)
|
||||
{
|
||||
streamBuffer.SetLength(0L);
|
||||
try
|
||||
{
|
||||
int i = 0;
|
||||
int num = 0;
|
||||
while (i < 9)
|
||||
{
|
||||
try
|
||||
{
|
||||
num = this.sock.Receive(array, i, 9 - i, SocketFlags.None);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
bool flag = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected && ex.SocketErrorCode == SocketError.WouldBlock;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, "ReceiveLoop() got a WouldBlock exception. This is non-fatal. Going to continue.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
i += num;
|
||||
bool flag3 = num == 0;
|
||||
if (flag3)
|
||||
{
|
||||
throw new SocketException(10054);
|
||||
}
|
||||
}
|
||||
bool flag4 = array[0] == 240;
|
||||
if (flag4)
|
||||
{
|
||||
base.HandleReceivedDatagram(array, array.Length, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = ((int)array[1] << 24) | ((int)array[2] << 16) | ((int)array[3] << 8) | (int)array[4];
|
||||
bool trafficStatsEnabled = this.peerBase.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
bool flag5 = array[5] == 0;
|
||||
bool flag6 = flag5;
|
||||
if (flag6)
|
||||
{
|
||||
this.peerBase.TrafficStatsIncoming.CountReliableOpCommand(num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.peerBase.TrafficStatsIncoming.CountUnreliableOpCommand(num2);
|
||||
}
|
||||
}
|
||||
bool flag7 = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag7)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, "message length: " + num2);
|
||||
}
|
||||
streamBuffer.SetCapacityMinimum(num2 - 7);
|
||||
streamBuffer.Write(array, 7, i - 7);
|
||||
i = 0;
|
||||
num2 -= 9;
|
||||
while (i < num2)
|
||||
{
|
||||
try
|
||||
{
|
||||
num = this.sock.Receive(streamBuffer.GetBuffer(), (int)streamBuffer.Position, num2 - i, SocketFlags.None);
|
||||
}
|
||||
catch (SocketException ex2)
|
||||
{
|
||||
bool flag8 = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected && ex2.SocketErrorCode == SocketError.WouldBlock;
|
||||
if (flag8)
|
||||
{
|
||||
bool flag9 = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag9)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, "ReceiveLoop() got a WouldBlock exception. This is non-fatal. Going to continue.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
streamBuffer.Position += (long)num;
|
||||
i += num;
|
||||
bool flag10 = num == 0;
|
||||
if (flag10)
|
||||
{
|
||||
throw new SocketException(10054);
|
||||
}
|
||||
}
|
||||
base.HandleReceivedDatagram(streamBuffer.ToArray(), (int)streamBuffer.Length, false);
|
||||
bool flag11 = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag11)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ALL, "TCP < " + streamBuffer.Length + ((streamBuffer.Length == (long)(num2 + 2)) ? " OK" : " BAD"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SocketException ex3)
|
||||
{
|
||||
bool flag12 = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected;
|
||||
if (flag12)
|
||||
{
|
||||
bool flag13 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag13)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, "Receiving failed. SocketException: " + ex3.SocketErrorCode);
|
||||
}
|
||||
bool flag14 = ex3.SocketErrorCode == SocketError.ConnectionReset || ex3.SocketErrorCode == SocketError.ConnectionAborted;
|
||||
if (flag14)
|
||||
{
|
||||
base.HandleException(StatusCode.DisconnectByServer);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.HandleException(StatusCode.ExceptionOnReceive);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex4)
|
||||
{
|
||||
bool flag15 = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected;
|
||||
if (flag15)
|
||||
{
|
||||
bool flag16 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag16)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Receive issue. State: ", base.State, ". Server: '", base.ServerAddress, "' Exception: ", ex4 }));
|
||||
}
|
||||
base.HandleException(StatusCode.ExceptionOnReceive);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.Disconnect();
|
||||
}
|
||||
|
||||
// Token: 0x0400014F RID: 335
|
||||
private Socket sock;
|
||||
|
||||
// Token: 0x04000150 RID: 336
|
||||
private readonly object syncer = new object();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000032 RID: 50
|
||||
internal class SocketUdp : IPhotonSocket, IDisposable
|
||||
{
|
||||
// Token: 0x06000238 RID: 568 RVA: 0x00012064 File Offset: 0x00010264
|
||||
public SocketUdp(PeerBase npeer)
|
||||
: base(npeer)
|
||||
{
|
||||
bool flag = base.ReportDebugOfLevel(DebugLevel.ALL);
|
||||
if (flag)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "CSharpSocket: UDP, Unity3d.");
|
||||
}
|
||||
this.PollReceive = false;
|
||||
}
|
||||
|
||||
// Token: 0x06000239 RID: 569 RVA: 0x000120AC File Offset: 0x000102AC
|
||||
public void Dispose()
|
||||
{
|
||||
base.State = PhotonSocketState.Disconnecting;
|
||||
bool flag = this.sock != null;
|
||||
if (flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool connected = this.sock.Connected;
|
||||
if (connected)
|
||||
{
|
||||
this.sock.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Dispose(): " + ex);
|
||||
}
|
||||
}
|
||||
this.sock = null;
|
||||
base.State = PhotonSocketState.Disconnected;
|
||||
}
|
||||
|
||||
// Token: 0x0600023A RID: 570 RVA: 0x00012128 File Offset: 0x00010328
|
||||
public override bool Connect()
|
||||
{
|
||||
object obj = this.syncer;
|
||||
bool flag3;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag = base.Connect();
|
||||
bool flag2 = !flag;
|
||||
if (flag2)
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.State = PhotonSocketState.Connecting;
|
||||
new Thread(new ThreadStart(this.DnsAndConnect))
|
||||
{
|
||||
Name = "photon dns thread",
|
||||
IsBackground = true
|
||||
}.Start();
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600023B RID: 571 RVA: 0x000121B0 File Offset: 0x000103B0
|
||||
public override bool Disconnect()
|
||||
{
|
||||
bool flag = base.ReportDebugOfLevel(DebugLevel.INFO);
|
||||
if (flag)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "CSharpSocket.Disconnect()");
|
||||
}
|
||||
base.State = PhotonSocketState.Disconnecting;
|
||||
object obj = this.syncer;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag2 = this.sock != null;
|
||||
if (flag2)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.sock.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Disconnect(): " + ex);
|
||||
}
|
||||
this.sock = null;
|
||||
}
|
||||
}
|
||||
base.State = PhotonSocketState.Disconnected;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0600023C RID: 572 RVA: 0x00012264 File Offset: 0x00010464
|
||||
public override PhotonSocketError Send(byte[] data, int length)
|
||||
{
|
||||
object obj = this.syncer;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag = this.sock == null || !this.sock.Connected;
|
||||
if (flag)
|
||||
{
|
||||
return PhotonSocketError.Skipped;
|
||||
}
|
||||
try
|
||||
{
|
||||
this.sock.Send(data, 0, length, SocketFlags.None);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag2 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, "Cannot send to: " + base.ServerAddress + ". " + ex.Message);
|
||||
}
|
||||
return PhotonSocketError.Exception;
|
||||
}
|
||||
}
|
||||
return PhotonSocketError.Success;
|
||||
}
|
||||
|
||||
// Token: 0x0600023D RID: 573 RVA: 0x0001231C File Offset: 0x0001051C
|
||||
public override PhotonSocketError Receive(out byte[] data)
|
||||
{
|
||||
data = null;
|
||||
return PhotonSocketError.NoData;
|
||||
}
|
||||
|
||||
// Token: 0x0600023E RID: 574 RVA: 0x00012334 File Offset: 0x00010534
|
||||
internal void DnsAndConnect()
|
||||
{
|
||||
IPAddress ipaddress = null;
|
||||
try
|
||||
{
|
||||
ipaddress = IPhotonSocket.GetIpAddress(base.ServerAddress);
|
||||
bool flag = ipaddress == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentException("Invalid IPAddress. Address: " + base.ServerAddress);
|
||||
}
|
||||
object obj = this.syncer;
|
||||
lock (obj)
|
||||
{
|
||||
bool flag2 = base.State == PhotonSocketState.Disconnecting || base.State == PhotonSocketState.Disconnected;
|
||||
if (flag2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.sock = new Socket(ipaddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
|
||||
this.sock.Connect(ipaddress, base.ServerPort);
|
||||
base.AddressResolvedAsIpv6 = base.IsIpv6SimpleCheck(ipaddress);
|
||||
base.State = PhotonSocketState.Connected;
|
||||
this.peerBase.OnConnect();
|
||||
}
|
||||
}
|
||||
catch (SecurityException ex)
|
||||
{
|
||||
bool flag3 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag3)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new string[]
|
||||
{
|
||||
"Connect() to '",
|
||||
base.ServerAddress,
|
||||
"' (",
|
||||
(ipaddress == null) ? "" : ipaddress.AddressFamily.ToString(),
|
||||
") failed: ",
|
||||
ex.ToString()
|
||||
}));
|
||||
}
|
||||
base.HandleException(StatusCode.SecurityExceptionOnConnect);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
bool flag4 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag4)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new string[]
|
||||
{
|
||||
"Connect() to '",
|
||||
base.ServerAddress,
|
||||
"' (",
|
||||
(ipaddress == null) ? "" : ipaddress.AddressFamily.ToString(),
|
||||
") failed: ",
|
||||
ex2.ToString()
|
||||
}));
|
||||
}
|
||||
base.HandleException(StatusCode.ExceptionOnConnect);
|
||||
return;
|
||||
}
|
||||
new Thread(new ThreadStart(this.ReceiveLoop))
|
||||
{
|
||||
Name = "photon receive thread",
|
||||
IsBackground = true
|
||||
}.Start();
|
||||
}
|
||||
|
||||
// Token: 0x0600023F RID: 575 RVA: 0x0001255C File Offset: 0x0001075C
|
||||
public void ReceiveLoop()
|
||||
{
|
||||
byte[] array = new byte[base.MTU];
|
||||
while (base.State == PhotonSocketState.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = this.sock.Receive(array);
|
||||
base.HandleReceivedDatagram(array, num, true);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
bool flag = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[]
|
||||
{
|
||||
"Receive issue. State: ", base.State, ". Server: '", base.ServerAddress, "' ErrorCode: ", ex.ErrorCode, " SocketErrorCode: ", ex.SocketErrorCode, " Message: ", ex.Message,
|
||||
" ", ex
|
||||
}));
|
||||
}
|
||||
base.HandleException(StatusCode.ExceptionOnReceive);
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
bool flag3 = base.State != PhotonSocketState.Disconnecting && base.State > PhotonSocketState.Disconnected;
|
||||
if (flag3)
|
||||
{
|
||||
bool flag4 = base.ReportDebugOfLevel(DebugLevel.ERROR);
|
||||
if (flag4)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Receive issue. State: ", base.State, ". Server: '", base.ServerAddress, "' Message: ", ex2.Message, " Exception: ", ex2 }));
|
||||
}
|
||||
base.HandleException(StatusCode.ExceptionOnReceive);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.Disconnect();
|
||||
}
|
||||
|
||||
// Token: 0x0400014D RID: 333
|
||||
private Socket sock;
|
||||
|
||||
// Token: 0x0400014E RID: 334
|
||||
private readonly object syncer = new object();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000035 RID: 53
|
||||
public class SocketUdpNativeDynamic : IPhotonSocket
|
||||
{
|
||||
// Token: 0x0600024C RID: 588 RVA: 0x000130BC File Offset: 0x000112BC
|
||||
public SocketUdpNativeDynamic(PeerBase peerBase)
|
||||
: base(peerBase)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600024D RID: 589 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override bool Disconnect()
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
|
||||
// Token: 0x0600024E RID: 590 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override PhotonSocketError Send(byte[] data, int length)
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
|
||||
// Token: 0x0600024F RID: 591 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override PhotonSocketError Receive(out byte[] data)
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000034 RID: 52
|
||||
public class SocketUdpNativeStatic : IPhotonSocket
|
||||
{
|
||||
// Token: 0x06000248 RID: 584 RVA: 0x000130BC File Offset: 0x000112BC
|
||||
public SocketUdpNativeStatic(PeerBase peerBase)
|
||||
: base(peerBase)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000249 RID: 585 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override bool Disconnect()
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
|
||||
// Token: 0x0600024A RID: 586 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override PhotonSocketError Send(byte[] data, int length)
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
|
||||
// Token: 0x0600024B RID: 587 RVA: 0x000130C7 File Offset: 0x000112C7
|
||||
public override PhotonSocketError Receive(out byte[] data)
|
||||
{
|
||||
throw new NotImplementedException("This class was compiled in an assembly WITH c# sockets. Another dll must be used for native sockets.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000A RID: 10
|
||||
public enum StatusCode
|
||||
{
|
||||
// Token: 0x04000014 RID: 20
|
||||
Connect = 1024,
|
||||
// Token: 0x04000015 RID: 21
|
||||
Disconnect,
|
||||
// Token: 0x04000016 RID: 22
|
||||
Exception,
|
||||
// Token: 0x04000017 RID: 23
|
||||
ExceptionOnConnect = 1023,
|
||||
// Token: 0x04000018 RID: 24
|
||||
SecurityExceptionOnConnect = 1022,
|
||||
// Token: 0x04000019 RID: 25
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueOutgoingReliableWarning = 1027,
|
||||
// Token: 0x0400001A RID: 26
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueOutgoingUnreliableWarning = 1029,
|
||||
// Token: 0x0400001B RID: 27
|
||||
SendError,
|
||||
// Token: 0x0400001C RID: 28
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueOutgoingAcksWarning,
|
||||
// Token: 0x0400001D RID: 29
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueIncomingReliableWarning = 1033,
|
||||
// Token: 0x0400001E RID: 30
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueIncomingUnreliableWarning = 1035,
|
||||
// Token: 0x0400001F RID: 31
|
||||
[Obsolete("Check QueuedOutgoingCommands and QueuedIncomingCommands on demand instead.")]
|
||||
QueueSentWarning = 1037,
|
||||
// Token: 0x04000020 RID: 32
|
||||
ExceptionOnReceive = 1039,
|
||||
// Token: 0x04000021 RID: 33
|
||||
TimeoutDisconnect,
|
||||
// Token: 0x04000022 RID: 34
|
||||
DisconnectByServer,
|
||||
// Token: 0x04000023 RID: 35
|
||||
DisconnectByServerUserLimit,
|
||||
// Token: 0x04000024 RID: 36
|
||||
DisconnectByServerLogic,
|
||||
// Token: 0x04000025 RID: 37
|
||||
EncryptionEstablished = 1048,
|
||||
// Token: 0x04000026 RID: 38
|
||||
EncryptionFailedToEstablish
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,421 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200000C RID: 12
|
||||
public class StreamBuffer : Stream
|
||||
{
|
||||
// Token: 0x06000087 RID: 135 RVA: 0x00007401 File Offset: 0x00005601
|
||||
public StreamBuffer(int size = 0)
|
||||
{
|
||||
this.buf = new byte[size];
|
||||
}
|
||||
|
||||
// Token: 0x06000088 RID: 136 RVA: 0x00007417 File Offset: 0x00005617
|
||||
public StreamBuffer(byte[] buf)
|
||||
{
|
||||
this.buf = buf;
|
||||
this.len = buf.Length;
|
||||
}
|
||||
|
||||
// Token: 0x06000089 RID: 137 RVA: 0x00007434 File Offset: 0x00005634
|
||||
public byte[] ToArray()
|
||||
{
|
||||
byte[] array = new byte[this.len];
|
||||
Buffer.BlockCopy(this.buf, 0, array, 0, this.len);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600008A RID: 138 RVA: 0x00007468 File Offset: 0x00005668
|
||||
public byte[] ToArrayFromPos()
|
||||
{
|
||||
int num = this.len - this.pos;
|
||||
bool flag = num <= 0;
|
||||
byte[] array;
|
||||
if (flag)
|
||||
{
|
||||
array = new byte[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array2 = new byte[num];
|
||||
Buffer.BlockCopy(this.buf, this.pos, array2, 0, num);
|
||||
array = array2;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600008B RID: 139 RVA: 0x000074BC File Offset: 0x000056BC
|
||||
public void Compact()
|
||||
{
|
||||
long num = this.Length - this.Position;
|
||||
bool flag = num > 0L;
|
||||
if (flag)
|
||||
{
|
||||
Buffer.BlockCopy(this.buf, (int)this.Position, this.buf, 0, (int)num);
|
||||
}
|
||||
this.Position = 0L;
|
||||
this.SetLength(num);
|
||||
}
|
||||
|
||||
// Token: 0x0600008C RID: 140 RVA: 0x00007510 File Offset: 0x00005710
|
||||
public byte[] GetBuffer()
|
||||
{
|
||||
return this.buf;
|
||||
}
|
||||
|
||||
// Token: 0x0600008D RID: 141 RVA: 0x00007528 File Offset: 0x00005728
|
||||
public byte[] GetBufferAndAdvance(int length, out int offset)
|
||||
{
|
||||
offset = (int)this.Position;
|
||||
this.Position += (long)length;
|
||||
return this.buf;
|
||||
}
|
||||
|
||||
// Token: 0x1700000B RID: 11
|
||||
// (get) Token: 0x0600008E RID: 142 RVA: 0x0000755C File Offset: 0x0000575C
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000C RID: 12
|
||||
// (get) Token: 0x0600008F RID: 143 RVA: 0x00007570 File Offset: 0x00005770
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000D RID: 13
|
||||
// (get) Token: 0x06000090 RID: 144 RVA: 0x00007584 File Offset: 0x00005784
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000E RID: 14
|
||||
// (get) Token: 0x06000091 RID: 145 RVA: 0x00007598 File Offset: 0x00005798
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)this.len;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000F RID: 15
|
||||
// (get) Token: 0x06000092 RID: 146 RVA: 0x000075B4 File Offset: 0x000057B4
|
||||
// (set) Token: 0x06000093 RID: 147 RVA: 0x000075D0 File Offset: 0x000057D0
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)this.pos;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.pos = (int)value;
|
||||
bool flag = this.len < this.pos;
|
||||
if (flag)
|
||||
{
|
||||
this.len = this.pos;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000094 RID: 148 RVA: 0x00007613 File Offset: 0x00005813
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000095 RID: 149 RVA: 0x00007618 File Offset: 0x00005818
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
int num;
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
num = (int)offset;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
num = this.pos + (int)offset;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
num = this.len + (int)offset;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid seek origin");
|
||||
}
|
||||
bool flag = num < 0;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentException("Seek before begin");
|
||||
}
|
||||
bool flag2 = num > this.len;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentException("Seek after end");
|
||||
}
|
||||
this.pos = num;
|
||||
return (long)this.pos;
|
||||
}
|
||||
|
||||
// Token: 0x06000096 RID: 150 RVA: 0x000076A8 File Offset: 0x000058A8
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
this.len = (int)value;
|
||||
this.CheckSize(this.len);
|
||||
bool flag = this.pos > this.len;
|
||||
if (flag)
|
||||
{
|
||||
this.pos = this.len;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000097 RID: 151 RVA: 0x000076EB File Offset: 0x000058EB
|
||||
public void SetCapacityMinimum(int neededSize)
|
||||
{
|
||||
this.CheckSize(neededSize);
|
||||
}
|
||||
|
||||
// Token: 0x06000098 RID: 152 RVA: 0x000076F8 File Offset: 0x000058F8
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int num = this.len - this.pos;
|
||||
bool flag = num <= 0;
|
||||
int num2;
|
||||
if (flag)
|
||||
{
|
||||
num2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = count > num;
|
||||
if (flag2)
|
||||
{
|
||||
count = num;
|
||||
}
|
||||
Buffer.BlockCopy(this.buf, this.pos, buffer, offset, count);
|
||||
this.pos += count;
|
||||
num2 = count;
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000099 RID: 153 RVA: 0x0000775C File Offset: 0x0000595C
|
||||
public override void Write(byte[] buffer, int srcOffset, int count)
|
||||
{
|
||||
int num = this.pos + count;
|
||||
this.CheckSize(num);
|
||||
bool flag = num > this.len;
|
||||
if (flag)
|
||||
{
|
||||
this.len = num;
|
||||
}
|
||||
Buffer.BlockCopy(buffer, srcOffset, this.buf, this.pos, count);
|
||||
this.pos = num;
|
||||
}
|
||||
|
||||
// Token: 0x0600009A RID: 154 RVA: 0x000077B0 File Offset: 0x000059B0
|
||||
public override int ReadByte()
|
||||
{
|
||||
bool flag = this.pos >= this.len;
|
||||
int num;
|
||||
if (flag)
|
||||
{
|
||||
num = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = this.buf;
|
||||
int num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
num = array[num2];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600009B RID: 155 RVA: 0x000077F4 File Offset: 0x000059F4
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
bool flag = this.pos >= this.len;
|
||||
if (flag)
|
||||
{
|
||||
this.len = this.pos + 1;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
byte[] array = this.buf;
|
||||
int num = this.pos;
|
||||
this.pos = num + 1;
|
||||
array[num] = value;
|
||||
}
|
||||
|
||||
// Token: 0x0600009C RID: 156 RVA: 0x00007850 File Offset: 0x00005A50
|
||||
public void WriteBytes(byte v0, byte v1)
|
||||
{
|
||||
int num = this.pos + 2;
|
||||
bool flag = this.len < num;
|
||||
if (flag)
|
||||
{
|
||||
this.len = num;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
byte[] array = this.buf;
|
||||
int num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array[num2] = v0;
|
||||
byte[] array2 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array2[num2] = v1;
|
||||
}
|
||||
|
||||
// Token: 0x0600009D RID: 157 RVA: 0x000078BC File Offset: 0x00005ABC
|
||||
public void WriteBytes(byte v0, byte v1, byte v2)
|
||||
{
|
||||
int num = this.pos + 3;
|
||||
bool flag = this.len < num;
|
||||
if (flag)
|
||||
{
|
||||
this.len = num;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
byte[] array = this.buf;
|
||||
int num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array[num2] = v0;
|
||||
byte[] array2 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array2[num2] = v1;
|
||||
byte[] array3 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array3[num2] = v2;
|
||||
}
|
||||
|
||||
// Token: 0x0600009E RID: 158 RVA: 0x00007944 File Offset: 0x00005B44
|
||||
public void WriteBytes(byte v0, byte v1, byte v2, byte v3)
|
||||
{
|
||||
int num = this.pos + 4;
|
||||
bool flag = this.len < num;
|
||||
if (flag)
|
||||
{
|
||||
this.len = num;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
byte[] array = this.buf;
|
||||
int num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array[num2] = v0;
|
||||
byte[] array2 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array2[num2] = v1;
|
||||
byte[] array3 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array3[num2] = v2;
|
||||
byte[] array4 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array4[num2] = v3;
|
||||
}
|
||||
|
||||
// Token: 0x0600009F RID: 159 RVA: 0x000079E4 File Offset: 0x00005BE4
|
||||
public void WriteBytes(byte v0, byte v1, byte v2, byte v3, byte v4, byte v5, byte v6, byte v7)
|
||||
{
|
||||
int num = this.pos + 8;
|
||||
bool flag = this.len < num;
|
||||
if (flag)
|
||||
{
|
||||
this.len = num;
|
||||
this.CheckSize(this.len);
|
||||
}
|
||||
byte[] array = this.buf;
|
||||
int num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array[num2] = v0;
|
||||
byte[] array2 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array2[num2] = v1;
|
||||
byte[] array3 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array3[num2] = v2;
|
||||
byte[] array4 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array4[num2] = v3;
|
||||
byte[] array5 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array5[num2] = v4;
|
||||
byte[] array6 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array6[num2] = v5;
|
||||
byte[] array7 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array7[num2] = v6;
|
||||
byte[] array8 = this.buf;
|
||||
num2 = this.pos;
|
||||
this.pos = num2 + 1;
|
||||
array8[num2] = v7;
|
||||
}
|
||||
|
||||
// Token: 0x060000A0 RID: 160 RVA: 0x00007AEC File Offset: 0x00005CEC
|
||||
private bool CheckSize(int size)
|
||||
{
|
||||
bool flag = size <= this.buf.Length;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = this.buf.Length;
|
||||
bool flag3 = num == 0;
|
||||
if (flag3)
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
while (size > num)
|
||||
{
|
||||
num *= 2;
|
||||
}
|
||||
byte[] array = new byte[num];
|
||||
Buffer.BlockCopy(this.buf, 0, array, 0, this.buf.Length);
|
||||
this.buf = array;
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x04000027 RID: 39
|
||||
private const int DefaultInitialSize = 0;
|
||||
|
||||
// Token: 0x04000028 RID: 40
|
||||
private int pos;
|
||||
|
||||
// Token: 0x04000029 RID: 41
|
||||
private int len;
|
||||
|
||||
// Token: 0x0400002A RID: 42
|
||||
private byte[] buf;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000009 RID: 9
|
||||
public class SupportClass
|
||||
{
|
||||
// Token: 0x06000074 RID: 116 RVA: 0x00006EB8 File Offset: 0x000050B8
|
||||
public static uint CalculateCrc(byte[] buffer, int length)
|
||||
{
|
||||
uint num = uint.MaxValue;
|
||||
uint num2 = 3988292384U;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
byte b = buffer[i];
|
||||
num ^= (uint)b;
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
bool flag = (num & 1U) > 0U;
|
||||
if (flag)
|
||||
{
|
||||
num = (num >> 1) ^ num2;
|
||||
}
|
||||
else
|
||||
{
|
||||
num >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000075 RID: 117 RVA: 0x00006F24 File Offset: 0x00005124
|
||||
public static List<MethodInfo> GetMethods(Type type, Type attribute)
|
||||
{
|
||||
List<MethodInfo> list = new List<MethodInfo>();
|
||||
bool flag = type == null;
|
||||
List<MethodInfo> list2;
|
||||
if (flag)
|
||||
{
|
||||
list2 = list;
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
foreach (MethodInfo methodInfo in methods)
|
||||
{
|
||||
bool flag2 = attribute == null || methodInfo.IsDefined(attribute, false);
|
||||
if (flag2)
|
||||
{
|
||||
list.Add(methodInfo);
|
||||
}
|
||||
}
|
||||
list2 = list;
|
||||
}
|
||||
return list2;
|
||||
}
|
||||
|
||||
// Token: 0x06000076 RID: 118 RVA: 0x00006F94 File Offset: 0x00005194
|
||||
public static int GetTickCount()
|
||||
{
|
||||
return SupportClass.IntegerMilliseconds();
|
||||
}
|
||||
|
||||
// Token: 0x06000077 RID: 119 RVA: 0x00006FB0 File Offset: 0x000051B0
|
||||
[Obsolete("Use StartBackgroundCalls() instead. It works with StopBackgroundCalls().")]
|
||||
public static byte CallInBackground(Func<bool> myThread, int millisecondsInterval = 100, string taskName = "")
|
||||
{
|
||||
return SupportClass.StartBackgroundCalls(myThread, millisecondsInterval, null);
|
||||
}
|
||||
|
||||
// Token: 0x06000078 RID: 120 RVA: 0x00006FCC File Offset: 0x000051CC
|
||||
public static byte StartBackgroundCalls(Func<bool> myThread, int millisecondsInterval = 100, string taskName = "")
|
||||
{
|
||||
bool flag = SupportClass.threadList == null;
|
||||
if (flag)
|
||||
{
|
||||
SupportClass.threadList = new List<Thread>();
|
||||
}
|
||||
Thread thread = new Thread(delegate
|
||||
{
|
||||
while (myThread())
|
||||
{
|
||||
Thread.Sleep(millisecondsInterval);
|
||||
}
|
||||
});
|
||||
bool flag2 = !string.IsNullOrEmpty(taskName);
|
||||
if (flag2)
|
||||
{
|
||||
thread.Name = taskName;
|
||||
}
|
||||
thread.IsBackground = true;
|
||||
thread.Start();
|
||||
SupportClass.threadList.Add(thread);
|
||||
return (byte)(SupportClass.threadList.Count - 1);
|
||||
}
|
||||
|
||||
// Token: 0x06000079 RID: 121 RVA: 0x00007060 File Offset: 0x00005260
|
||||
public static bool StopBackgroundCalls(byte id)
|
||||
{
|
||||
bool flag = SupportClass.threadList == null || (int)id > SupportClass.threadList.Count || SupportClass.threadList[(int)id] == null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SupportClass.threadList[(int)id].Abort();
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600007A RID: 122 RVA: 0x000070B4 File Offset: 0x000052B4
|
||||
public static bool StopAllBackgroundCalls()
|
||||
{
|
||||
bool flag = SupportClass.threadList == null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Thread thread in SupportClass.threadList)
|
||||
{
|
||||
thread.Abort();
|
||||
}
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600007B RID: 123 RVA: 0x00007124 File Offset: 0x00005324
|
||||
public static void WriteStackTrace(Exception throwable, TextWriter stream)
|
||||
{
|
||||
bool flag = stream != null;
|
||||
if (flag)
|
||||
{
|
||||
stream.WriteLine(throwable.ToString());
|
||||
stream.WriteLine(throwable.StackTrace);
|
||||
stream.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine(throwable.ToString());
|
||||
Debug.WriteLine(throwable.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600007C RID: 124 RVA: 0x00007179 File Offset: 0x00005379
|
||||
public static void WriteStackTrace(Exception throwable)
|
||||
{
|
||||
SupportClass.WriteStackTrace(throwable, null);
|
||||
}
|
||||
|
||||
// Token: 0x0600007D RID: 125 RVA: 0x00007184 File Offset: 0x00005384
|
||||
public static string DictionaryToString(IDictionary dictionary)
|
||||
{
|
||||
return SupportClass.DictionaryToString(dictionary, true);
|
||||
}
|
||||
|
||||
// Token: 0x0600007E RID: 126 RVA: 0x000071A0 File Offset: 0x000053A0
|
||||
public static string DictionaryToString(IDictionary dictionary, bool includeTypes)
|
||||
{
|
||||
bool flag = dictionary == null;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = "null";
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append("{");
|
||||
foreach (object obj in dictionary.Keys)
|
||||
{
|
||||
bool flag2 = stringBuilder.Length > 1;
|
||||
if (flag2)
|
||||
{
|
||||
stringBuilder.Append(", ");
|
||||
}
|
||||
bool flag3 = dictionary[obj] == null;
|
||||
Type type;
|
||||
string text2;
|
||||
if (flag3)
|
||||
{
|
||||
type = typeof(object);
|
||||
text2 = "null";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = dictionary[obj].GetType();
|
||||
text2 = dictionary[obj].ToString();
|
||||
}
|
||||
bool flag4 = typeof(IDictionary) == type || typeof(Hashtable) == type;
|
||||
if (flag4)
|
||||
{
|
||||
text2 = SupportClass.DictionaryToString((IDictionary)dictionary[obj]);
|
||||
}
|
||||
bool flag5 = typeof(string[]) == type;
|
||||
if (flag5)
|
||||
{
|
||||
text2 = string.Format("{{{0}}}", string.Join(",", (string[])dictionary[obj]));
|
||||
}
|
||||
bool flag6 = typeof(byte[]) == type;
|
||||
if (flag6)
|
||||
{
|
||||
text2 = string.Format("byte[{0}]", ((byte[])dictionary[obj]).Length);
|
||||
}
|
||||
if (includeTypes)
|
||||
{
|
||||
stringBuilder.AppendFormat("({0}){1}=({2}){3}", new object[]
|
||||
{
|
||||
obj.GetType().Name,
|
||||
obj,
|
||||
type.Name,
|
||||
text2
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.AppendFormat("{0}={1}", obj, text2);
|
||||
}
|
||||
}
|
||||
stringBuilder.Append("}");
|
||||
text = stringBuilder.ToString();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x0600007F RID: 127 RVA: 0x000073A0 File Offset: 0x000055A0
|
||||
[Obsolete("Use DictionaryToString() instead.")]
|
||||
public static string HashtableToString(Hashtable hash)
|
||||
{
|
||||
return SupportClass.DictionaryToString(hash);
|
||||
}
|
||||
|
||||
// Token: 0x06000080 RID: 128 RVA: 0x000073B8 File Offset: 0x000055B8
|
||||
public static string ByteArrayToString(byte[] list)
|
||||
{
|
||||
bool flag = list == null;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = BitConverter.ToString(list);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x04000011 RID: 17
|
||||
private static List<Thread> threadList;
|
||||
|
||||
// Token: 0x04000012 RID: 18
|
||||
protected internal static SupportClass.IntegerMillisecondsDelegate IntegerMilliseconds = () => Environment.TickCount;
|
||||
|
||||
// Token: 0x0200003E RID: 62
|
||||
// (Invoke) Token: 0x060002C7 RID: 711
|
||||
public delegate int IntegerMillisecondsDelegate();
|
||||
|
||||
// Token: 0x0200003F RID: 63
|
||||
public class ThreadSafeRandom
|
||||
{
|
||||
// Token: 0x060002CA RID: 714 RVA: 0x0001410C File Offset: 0x0001230C
|
||||
public static int Next()
|
||||
{
|
||||
Random r = SupportClass.ThreadSafeRandom._r;
|
||||
int num;
|
||||
lock (r)
|
||||
{
|
||||
num = SupportClass.ThreadSafeRandom._r.Next();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x04000191 RID: 401
|
||||
private static readonly Random _r = new Random();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,606 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x0200001A RID: 26
|
||||
internal class TPeer : PeerBase
|
||||
{
|
||||
// Token: 0x17000061 RID: 97
|
||||
// (get) Token: 0x0600017E RID: 382 RVA: 0x0000E0D8 File Offset: 0x0000C2D8
|
||||
internal override int QueuedIncomingCommandsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.incomingList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000062 RID: 98
|
||||
// (get) Token: 0x0600017F RID: 383 RVA: 0x0000E0F8 File Offset: 0x0000C2F8
|
||||
internal override int QueuedOutgoingCommandsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outgoingCommandsInStream;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000180 RID: 384 RVA: 0x0000E110 File Offset: 0x0000C310
|
||||
internal TPeer()
|
||||
{
|
||||
byte[] array = new byte[5];
|
||||
array[0] = 240;
|
||||
this.pingRequest = array;
|
||||
this.DoFraming = true;
|
||||
base..ctor();
|
||||
PeerBase.peerCount += 1;
|
||||
base.InitOnce();
|
||||
this.TrafficPackageHeaderSize = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000181 RID: 385 RVA: 0x0000E168 File Offset: 0x0000C368
|
||||
internal override void InitPeerBase()
|
||||
{
|
||||
base.InitPeerBase();
|
||||
this.incomingList = new Queue<byte[]>(32);
|
||||
}
|
||||
|
||||
// Token: 0x06000182 RID: 386 RVA: 0x0000E180 File Offset: 0x0000C380
|
||||
internal override bool Connect(string serverAddress, string appID, object customData = null)
|
||||
{
|
||||
bool flag = this.peerConnectionState > PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.WARNING, "Connect() can't be called if peer is not Disconnected. Not connecting.");
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = base.debugOut >= DebugLevel.ALL;
|
||||
if (flag3)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "Connect()");
|
||||
}
|
||||
base.ServerAddress = serverAddress;
|
||||
this.InitPeerBase();
|
||||
this.outgoingStream = new List<byte[]>();
|
||||
bool flag4 = this.usedProtocol == ConnectionProtocol.WebSocket || this.usedProtocol == ConnectionProtocol.WebSocketSecure;
|
||||
if (flag4)
|
||||
{
|
||||
serverAddress = base.PepareWebSocketUrl(serverAddress, appID, customData);
|
||||
}
|
||||
bool flag5 = base.SocketImplementation != null;
|
||||
if (flag5)
|
||||
{
|
||||
this.rt = (IPhotonSocket)Activator.CreateInstance(base.SocketImplementation, new object[] { this });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rt = new SocketTcp(this);
|
||||
}
|
||||
bool flag6 = this.rt == null;
|
||||
if (flag6)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, "Connect() failed, because SocketImplementation or socket was null. Set PhotonPeer.SocketImplementation before Connect(). SocketImplementation: " + base.SocketImplementation);
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.messageHeader = (this.DoFraming ? TPeer.tcpFramedMessageHead : TPeer.tcpMsgHead);
|
||||
bool flag7 = this.rt.Connect();
|
||||
if (flag7)
|
||||
{
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Connecting;
|
||||
flag2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnected;
|
||||
flag2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x06000183 RID: 387 RVA: 0x0000E2D0 File Offset: 0x0000C4D0
|
||||
public override void OnConnect()
|
||||
{
|
||||
byte[] array = base.PrepareConnectData(base.ServerAddress, this.AppId, this.CustomInitData);
|
||||
this.EnqueueInit(array);
|
||||
this.SendOutgoingCommands();
|
||||
}
|
||||
|
||||
// Token: 0x06000184 RID: 388 RVA: 0x0000E308 File Offset: 0x0000C508
|
||||
internal override void Disconnect()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnected || this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnecting;
|
||||
if (!flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ALL;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ALL, "TPeer.Disconnect()");
|
||||
}
|
||||
this.StopConnection();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000185 RID: 389 RVA: 0x0000E35C File Offset: 0x0000C55C
|
||||
internal override void StopConnection()
|
||||
{
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnecting;
|
||||
bool flag = this.rt != null;
|
||||
if (flag)
|
||||
{
|
||||
this.rt.Disconnect();
|
||||
}
|
||||
Queue<byte[]> queue = this.incomingList;
|
||||
lock (queue)
|
||||
{
|
||||
this.incomingList.Clear();
|
||||
}
|
||||
this.peerConnectionState = PeerBase.ConnectionStateValue.Disconnected;
|
||||
base.EnqueueStatusCallback(StatusCode.Disconnect);
|
||||
}
|
||||
|
||||
// Token: 0x06000186 RID: 390 RVA: 0x0000E3D8 File Offset: 0x0000C5D8
|
||||
internal override void FetchServerTimestamp()
|
||||
{
|
||||
bool flag = this.peerConnectionState != PeerBase.ConnectionStateValue.Connected;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.INFO;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.INFO, "FetchServerTimestamp() was skipped, as the client is not connected. Current ConnectionState: " + this.peerConnectionState);
|
||||
}
|
||||
base.Listener.OnStatusChanged(StatusCode.SendError);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SendPing();
|
||||
this.serverTimeOffsetIsAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000187 RID: 391 RVA: 0x0000E44C File Offset: 0x0000C64C
|
||||
private void EnqueueInit(byte[] data)
|
||||
{
|
||||
bool flag = !this.DoFraming;
|
||||
if (!flag)
|
||||
{
|
||||
StreamBuffer streamBuffer = new StreamBuffer(data.Length + 32);
|
||||
BinaryWriter binaryWriter = new BinaryWriter(streamBuffer);
|
||||
byte[] array = new byte[] { 251, 0, 0, 0, 0, 0, 1 };
|
||||
int num = 1;
|
||||
Protocol.Serialize(data.Length + array.Length, array, ref num);
|
||||
binaryWriter.Write(array);
|
||||
binaryWriter.Write(data);
|
||||
byte[] array2 = streamBuffer.ToArray();
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
TrafficStats trafficStatsOutgoing = base.TrafficStatsOutgoing;
|
||||
int num2 = trafficStatsOutgoing.TotalPacketCount;
|
||||
trafficStatsOutgoing.TotalPacketCount = num2 + 1;
|
||||
TrafficStats trafficStatsOutgoing2 = base.TrafficStatsOutgoing;
|
||||
num2 = trafficStatsOutgoing2.TotalCommandsInPackets;
|
||||
trafficStatsOutgoing2.TotalCommandsInPackets = num2 + 1;
|
||||
base.TrafficStatsOutgoing.CountControlCommand(array2.Length);
|
||||
}
|
||||
this.EnqueueMessageAsPayload(true, array2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000188 RID: 392 RVA: 0x0000E518 File Offset: 0x0000C718
|
||||
internal override bool DispatchIncomingCommands()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Queue<PeerBase.MyAction> actionQueue = this.ActionQueue;
|
||||
PeerBase.MyAction myAction;
|
||||
lock (actionQueue)
|
||||
{
|
||||
bool flag = this.ActionQueue.Count <= 0;
|
||||
if (flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
myAction = this.ActionQueue.Dequeue();
|
||||
}
|
||||
myAction();
|
||||
}
|
||||
Queue<byte[]> queue = this.incomingList;
|
||||
byte[] array;
|
||||
lock (queue)
|
||||
{
|
||||
bool flag2 = this.incomingList.Count <= 0;
|
||||
if (flag2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
array = this.incomingList.Dequeue();
|
||||
}
|
||||
this.ByteCountCurrentDispatch = array.Length + 3;
|
||||
return this.DeserializeMessageAndCallback(array);
|
||||
}
|
||||
|
||||
// Token: 0x06000189 RID: 393 RVA: 0x0000E5F0 File Offset: 0x0000C7F0
|
||||
internal override bool SendOutgoingCommands()
|
||||
{
|
||||
bool flag = this.peerConnectionState == PeerBase.ConnectionStateValue.Disconnected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag3 = !this.rt.Connected;
|
||||
if (flag3)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
this.timeLastSendOutgoing = this.timeInt;
|
||||
bool flag4 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connected && Math.Abs(SupportClass.GetTickCount() - this.lastPingResult) > base.timePingInterval;
|
||||
if (flag4)
|
||||
{
|
||||
this.SendPing();
|
||||
}
|
||||
List<byte[]> list = this.outgoingStream;
|
||||
lock (list)
|
||||
{
|
||||
foreach (byte[] array in this.outgoingStream)
|
||||
{
|
||||
this.SendData(array);
|
||||
}
|
||||
this.outgoingStream.Clear();
|
||||
this.outgoingCommandsInStream = 0;
|
||||
}
|
||||
flag2 = false;
|
||||
}
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600018A RID: 394 RVA: 0x0000E70C File Offset: 0x0000C90C
|
||||
internal override bool SendAcksOnly()
|
||||
{
|
||||
bool flag = this.rt == null || !this.rt.Connected;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
bool flag3 = this.peerConnectionState == PeerBase.ConnectionStateValue.Connected && SupportClass.GetTickCount() - this.lastPingResult > base.timePingInterval;
|
||||
if (flag3)
|
||||
{
|
||||
this.SendPing();
|
||||
}
|
||||
flag2 = false;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600018B RID: 395 RVA: 0x0000E780 File Offset: 0x0000C980
|
||||
internal override bool EnqueueOperation(Dictionary<byte, object> parameters, byte opCode, bool sendReliable, byte channelId, bool encrypt, PeerBase.EgMessageType messageType)
|
||||
{
|
||||
bool flag = this.peerConnectionState != PeerBase.ConnectionStateValue.Connected;
|
||||
bool flag3;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Cannot send op: ", opCode, "! Not connected. PeerState: ", this.peerConnectionState }));
|
||||
}
|
||||
base.Listener.OnStatusChanged(StatusCode.SendError);
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = channelId >= base.ChannelCount;
|
||||
if (flag4)
|
||||
{
|
||||
bool flag5 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag5)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, string.Concat(new object[] { "Cannot send op: Selected channel (", channelId, ")>= channelCount (", base.ChannelCount, ")." }));
|
||||
}
|
||||
base.Listener.OnStatusChanged(StatusCode.SendError);
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = this.SerializeOperationToMessage(opCode, parameters, messageType, encrypt);
|
||||
flag3 = this.EnqueueMessageAsPayload(sendReliable, array, channelId);
|
||||
}
|
||||
}
|
||||
return flag3;
|
||||
}
|
||||
|
||||
// Token: 0x0600018C RID: 396 RVA: 0x0000E8A8 File Offset: 0x0000CAA8
|
||||
internal override byte[] SerializeOperationToMessage(byte opc, Dictionary<byte, object> parameters, PeerBase.EgMessageType messageType, bool encrypt)
|
||||
{
|
||||
StreamBuffer serializeMemStream = this.SerializeMemStream;
|
||||
byte[] array2;
|
||||
lock (serializeMemStream)
|
||||
{
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
bool flag = !encrypt;
|
||||
if (flag)
|
||||
{
|
||||
this.SerializeMemStream.Write(this.messageHeader, 0, this.messageHeader.Length);
|
||||
}
|
||||
this.protocol.SerializeOperationRequest(this.SerializeMemStream, opc, parameters, false);
|
||||
if (encrypt)
|
||||
{
|
||||
byte[] array = this.CryptoProvider.Encrypt(this.SerializeMemStream.GetBuffer(), 0, (int)this.SerializeMemStream.Length);
|
||||
this.SerializeMemStream.SetLength(0L);
|
||||
this.SerializeMemStream.Write(this.messageHeader, 0, this.messageHeader.Length);
|
||||
this.SerializeMemStream.Write(array, 0, array.Length);
|
||||
}
|
||||
array2 = this.SerializeMemStream.ToArray();
|
||||
}
|
||||
bool flag2 = messageType != PeerBase.EgMessageType.Operation;
|
||||
if (flag2)
|
||||
{
|
||||
array2[this.messageHeader.Length - 1] = (byte)messageType;
|
||||
}
|
||||
if (encrypt)
|
||||
{
|
||||
array2[this.messageHeader.Length - 1] = array2[this.messageHeader.Length - 1] | 128;
|
||||
}
|
||||
bool doFraming = this.DoFraming;
|
||||
if (doFraming)
|
||||
{
|
||||
int num = 1;
|
||||
Protocol.Serialize(array2.Length, array2, ref num);
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
// Token: 0x0600018D RID: 397 RVA: 0x0000EA08 File Offset: 0x0000CC08
|
||||
internal bool EnqueueMessageAsPayload(bool sendReliable, byte[] opMessage, byte channelId)
|
||||
{
|
||||
bool flag = opMessage == null;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool doFraming = this.DoFraming;
|
||||
if (doFraming)
|
||||
{
|
||||
opMessage[5] = channelId;
|
||||
opMessage[6] = (sendReliable ? 1 : 0);
|
||||
}
|
||||
List<byte[]> list = this.outgoingStream;
|
||||
lock (list)
|
||||
{
|
||||
this.outgoingStream.Add(opMessage);
|
||||
this.outgoingCommandsInStream++;
|
||||
}
|
||||
int num = opMessage.Length;
|
||||
this.ByteCountLastOperation = num;
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
if (sendReliable)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountReliableOpCommand(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountUnreliableOpCommand(num);
|
||||
}
|
||||
base.TrafficStatsGameLevel.CountOperation(num);
|
||||
}
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
// Token: 0x0600018E RID: 398 RVA: 0x0000EADC File Offset: 0x0000CCDC
|
||||
internal void SendPing()
|
||||
{
|
||||
this.lastPingResult = SupportClass.GetTickCount();
|
||||
bool flag = !this.DoFraming;
|
||||
if (flag)
|
||||
{
|
||||
int tickCount = SupportClass.GetTickCount();
|
||||
this.EnqueueOperation(new Dictionary<byte, object> { { 1, tickCount } }, PhotonCodes.Ping, true, 0, false, PeerBase.EgMessageType.InternalOperationRequest);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = 1;
|
||||
Protocol.Serialize(SupportClass.GetTickCount(), this.pingRequest, ref num);
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
base.TrafficStatsOutgoing.CountControlCommand(this.pingRequest.Length);
|
||||
}
|
||||
this.SendData(this.pingRequest);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018F RID: 399 RVA: 0x0000EB74 File Offset: 0x0000CD74
|
||||
internal void SendData(byte[] data)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.bytesOut += (long)data.Length;
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
TrafficStats trafficStatsOutgoing = base.TrafficStatsOutgoing;
|
||||
int totalPacketCount = trafficStatsOutgoing.TotalPacketCount;
|
||||
trafficStatsOutgoing.TotalPacketCount = totalPacketCount + 1;
|
||||
base.TrafficStatsOutgoing.TotalCommandsInPackets += this.outgoingCommandsInStream;
|
||||
}
|
||||
bool isSimulationEnabled = base.NetworkSimulationSettings.IsSimulationEnabled;
|
||||
if (isSimulationEnabled)
|
||||
{
|
||||
base.SendNetworkSimulated(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rt.Send(data, data.Length);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bool flag = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag)
|
||||
{
|
||||
base.Listener.DebugReturn(DebugLevel.ERROR, ex.ToString());
|
||||
}
|
||||
SupportClass.WriteStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000190 RID: 400 RVA: 0x0000EC44 File Offset: 0x0000CE44
|
||||
internal override void ReceiveIncomingCommands(byte[] inbuff, int dataLength)
|
||||
{
|
||||
bool flag = inbuff == null;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag2)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, "checkAndQueueIncomingCommands() inBuff: null");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.timestampOfLastReceive = SupportClass.GetTickCount();
|
||||
this.timeInt = SupportClass.GetTickCount() - this.timeBase;
|
||||
this.bytesIn += (long)(inbuff.Length + 7);
|
||||
bool trafficStatsEnabled = base.TrafficStatsEnabled;
|
||||
if (trafficStatsEnabled)
|
||||
{
|
||||
TrafficStats trafficStatsIncoming = base.TrafficStatsIncoming;
|
||||
int num = trafficStatsIncoming.TotalPacketCount;
|
||||
trafficStatsIncoming.TotalPacketCount = num + 1;
|
||||
TrafficStats trafficStatsIncoming2 = base.TrafficStatsIncoming;
|
||||
num = trafficStatsIncoming2.TotalCommandsInPackets;
|
||||
trafficStatsIncoming2.TotalCommandsInPackets = num + 1;
|
||||
}
|
||||
bool flag3 = inbuff[0] == 243 || inbuff[0] == 244;
|
||||
if (flag3)
|
||||
{
|
||||
Queue<byte[]> queue = this.incomingList;
|
||||
lock (queue)
|
||||
{
|
||||
this.incomingList.Enqueue(inbuff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag4 = inbuff[0] == 240;
|
||||
if (flag4)
|
||||
{
|
||||
base.TrafficStatsIncoming.CountControlCommand(inbuff.Length);
|
||||
this.ReadPingResult(inbuff);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag5 = base.debugOut >= DebugLevel.ERROR;
|
||||
if (flag5)
|
||||
{
|
||||
base.EnqueueDebugReturn(DebugLevel.ERROR, "receiveIncomingCommands() MagicNumber should be 0xF0, 0xF3 or 0xF4. Is: " + inbuff[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000191 RID: 401 RVA: 0x0000ED9C File Offset: 0x0000CF9C
|
||||
private void ReadPingResult(byte[] inbuff)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int num3 = 1;
|
||||
Protocol.Deserialize(out num, inbuff, ref num3);
|
||||
Protocol.Deserialize(out num2, inbuff, ref num3);
|
||||
this.lastRoundTripTime = SupportClass.GetTickCount() - num2;
|
||||
bool flag = !this.serverTimeOffsetIsAvailable;
|
||||
if (flag)
|
||||
{
|
||||
this.roundTripTime = this.lastRoundTripTime;
|
||||
}
|
||||
base.UpdateRoundTripTimeAndVariance(this.lastRoundTripTime);
|
||||
bool flag2 = !this.serverTimeOffsetIsAvailable;
|
||||
if (flag2)
|
||||
{
|
||||
this.serverTimeOffset = num + (this.lastRoundTripTime >> 1) - SupportClass.GetTickCount();
|
||||
this.serverTimeOffsetIsAvailable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000192 RID: 402 RVA: 0x0000EE2C File Offset: 0x0000D02C
|
||||
protected internal void ReadPingResult(OperationResponse operationResponse)
|
||||
{
|
||||
int num = (int)operationResponse.Parameters[2];
|
||||
int num2 = (int)operationResponse.Parameters[1];
|
||||
this.lastRoundTripTime = SupportClass.GetTickCount() - num2;
|
||||
bool flag = !this.serverTimeOffsetIsAvailable;
|
||||
if (flag)
|
||||
{
|
||||
this.roundTripTime = this.lastRoundTripTime;
|
||||
}
|
||||
base.UpdateRoundTripTimeAndVariance(this.lastRoundTripTime);
|
||||
bool flag2 = !this.serverTimeOffsetIsAvailable;
|
||||
if (flag2)
|
||||
{
|
||||
this.serverTimeOffset = num + (this.lastRoundTripTime >> 1) - SupportClass.GetTickCount();
|
||||
this.serverTimeOffsetIsAvailable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000FE RID: 254
|
||||
internal const int TCP_HEADER_BYTES = 7;
|
||||
|
||||
// Token: 0x040000FF RID: 255
|
||||
internal const int MSG_HEADER_BYTES = 2;
|
||||
|
||||
// Token: 0x04000100 RID: 256
|
||||
public const int ALL_HEADER_BYTES = 9;
|
||||
|
||||
// Token: 0x04000101 RID: 257
|
||||
private Queue<byte[]> incomingList = new Queue<byte[]>(32);
|
||||
|
||||
// Token: 0x04000102 RID: 258
|
||||
internal List<byte[]> outgoingStream;
|
||||
|
||||
// Token: 0x04000103 RID: 259
|
||||
private int lastPingResult;
|
||||
|
||||
// Token: 0x04000104 RID: 260
|
||||
private byte[] pingRequest;
|
||||
|
||||
// Token: 0x04000105 RID: 261
|
||||
internal static readonly byte[] tcpFramedMessageHead = new byte[] { 251, 0, 0, 0, 0, 0, 0, 243, 2 };
|
||||
|
||||
// Token: 0x04000106 RID: 262
|
||||
internal static readonly byte[] tcpMsgHead = new byte[] { 243, 2 };
|
||||
|
||||
// Token: 0x04000107 RID: 263
|
||||
internal byte[] messageHeader;
|
||||
|
||||
// Token: 0x04000108 RID: 264
|
||||
protected internal bool DoFraming;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000039 RID: 57
|
||||
public class TrafficStats
|
||||
{
|
||||
// Token: 0x17000094 RID: 148
|
||||
// (get) Token: 0x06000295 RID: 661 RVA: 0x00013A46 File Offset: 0x00011C46
|
||||
// (set) Token: 0x06000296 RID: 662 RVA: 0x00013A4E File Offset: 0x00011C4E
|
||||
public int PackageHeaderSize { get; internal set; }
|
||||
|
||||
// Token: 0x17000095 RID: 149
|
||||
// (get) Token: 0x06000297 RID: 663 RVA: 0x00013A57 File Offset: 0x00011C57
|
||||
// (set) Token: 0x06000298 RID: 664 RVA: 0x00013A5F File Offset: 0x00011C5F
|
||||
public int ReliableCommandCount { get; internal set; }
|
||||
|
||||
// Token: 0x17000096 RID: 150
|
||||
// (get) Token: 0x06000299 RID: 665 RVA: 0x00013A68 File Offset: 0x00011C68
|
||||
// (set) Token: 0x0600029A RID: 666 RVA: 0x00013A70 File Offset: 0x00011C70
|
||||
public int UnreliableCommandCount { get; internal set; }
|
||||
|
||||
// Token: 0x17000097 RID: 151
|
||||
// (get) Token: 0x0600029B RID: 667 RVA: 0x00013A79 File Offset: 0x00011C79
|
||||
// (set) Token: 0x0600029C RID: 668 RVA: 0x00013A81 File Offset: 0x00011C81
|
||||
public int FragmentCommandCount { get; internal set; }
|
||||
|
||||
// Token: 0x17000098 RID: 152
|
||||
// (get) Token: 0x0600029D RID: 669 RVA: 0x00013A8A File Offset: 0x00011C8A
|
||||
// (set) Token: 0x0600029E RID: 670 RVA: 0x00013A92 File Offset: 0x00011C92
|
||||
public int ControlCommandCount { get; internal set; }
|
||||
|
||||
// Token: 0x17000099 RID: 153
|
||||
// (get) Token: 0x0600029F RID: 671 RVA: 0x00013A9B File Offset: 0x00011C9B
|
||||
// (set) Token: 0x060002A0 RID: 672 RVA: 0x00013AA3 File Offset: 0x00011CA3
|
||||
public int TotalPacketCount { get; internal set; }
|
||||
|
||||
// Token: 0x1700009A RID: 154
|
||||
// (get) Token: 0x060002A1 RID: 673 RVA: 0x00013AAC File Offset: 0x00011CAC
|
||||
// (set) Token: 0x060002A2 RID: 674 RVA: 0x00013AB4 File Offset: 0x00011CB4
|
||||
public int TotalCommandsInPackets { get; internal set; }
|
||||
|
||||
// Token: 0x1700009B RID: 155
|
||||
// (get) Token: 0x060002A3 RID: 675 RVA: 0x00013ABD File Offset: 0x00011CBD
|
||||
// (set) Token: 0x060002A4 RID: 676 RVA: 0x00013AC5 File Offset: 0x00011CC5
|
||||
public int ReliableCommandBytes { get; internal set; }
|
||||
|
||||
// Token: 0x1700009C RID: 156
|
||||
// (get) Token: 0x060002A5 RID: 677 RVA: 0x00013ACE File Offset: 0x00011CCE
|
||||
// (set) Token: 0x060002A6 RID: 678 RVA: 0x00013AD6 File Offset: 0x00011CD6
|
||||
public int UnreliableCommandBytes { get; internal set; }
|
||||
|
||||
// Token: 0x1700009D RID: 157
|
||||
// (get) Token: 0x060002A7 RID: 679 RVA: 0x00013ADF File Offset: 0x00011CDF
|
||||
// (set) Token: 0x060002A8 RID: 680 RVA: 0x00013AE7 File Offset: 0x00011CE7
|
||||
public int FragmentCommandBytes { get; internal set; }
|
||||
|
||||
// Token: 0x1700009E RID: 158
|
||||
// (get) Token: 0x060002A9 RID: 681 RVA: 0x00013AF0 File Offset: 0x00011CF0
|
||||
// (set) Token: 0x060002AA RID: 682 RVA: 0x00013AF8 File Offset: 0x00011CF8
|
||||
public int ControlCommandBytes { get; internal set; }
|
||||
|
||||
// Token: 0x060002AB RID: 683 RVA: 0x00013B01 File Offset: 0x00011D01
|
||||
internal TrafficStats(int packageHeaderSize)
|
||||
{
|
||||
this.PackageHeaderSize = packageHeaderSize;
|
||||
}
|
||||
|
||||
// Token: 0x1700009F RID: 159
|
||||
// (get) Token: 0x060002AC RID: 684 RVA: 0x00013B14 File Offset: 0x00011D14
|
||||
public int TotalCommandCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ReliableCommandCount + this.UnreliableCommandCount + this.FragmentCommandCount + this.ControlCommandCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A0 RID: 160
|
||||
// (get) Token: 0x060002AD RID: 685 RVA: 0x00013B44 File Offset: 0x00011D44
|
||||
public int TotalCommandBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ReliableCommandBytes + this.UnreliableCommandBytes + this.FragmentCommandBytes + this.ControlCommandBytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A1 RID: 161
|
||||
// (get) Token: 0x060002AE RID: 686 RVA: 0x00013B74 File Offset: 0x00011D74
|
||||
public int TotalPacketBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.TotalCommandBytes + this.TotalPacketCount * this.PackageHeaderSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A2 RID: 162
|
||||
// (get) Token: 0x060002AF RID: 687 RVA: 0x00013B9A File Offset: 0x00011D9A
|
||||
// (set) Token: 0x060002B0 RID: 688 RVA: 0x00013BA2 File Offset: 0x00011DA2
|
||||
public int TimestampOfLastAck { get; set; }
|
||||
|
||||
// Token: 0x170000A3 RID: 163
|
||||
// (get) Token: 0x060002B1 RID: 689 RVA: 0x00013BAB File Offset: 0x00011DAB
|
||||
// (set) Token: 0x060002B2 RID: 690 RVA: 0x00013BB3 File Offset: 0x00011DB3
|
||||
public int TimestampOfLastReliableCommand { get; set; }
|
||||
|
||||
// Token: 0x060002B3 RID: 691 RVA: 0x00013BBC File Offset: 0x00011DBC
|
||||
internal void CountControlCommand(int size)
|
||||
{
|
||||
this.ControlCommandBytes += size;
|
||||
int controlCommandCount = this.ControlCommandCount;
|
||||
this.ControlCommandCount = controlCommandCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x060002B4 RID: 692 RVA: 0x00013BEC File Offset: 0x00011DEC
|
||||
internal void CountReliableOpCommand(int size)
|
||||
{
|
||||
this.ReliableCommandBytes += size;
|
||||
int reliableCommandCount = this.ReliableCommandCount;
|
||||
this.ReliableCommandCount = reliableCommandCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x060002B5 RID: 693 RVA: 0x00013C1C File Offset: 0x00011E1C
|
||||
internal void CountUnreliableOpCommand(int size)
|
||||
{
|
||||
this.UnreliableCommandBytes += size;
|
||||
int unreliableCommandCount = this.UnreliableCommandCount;
|
||||
this.UnreliableCommandCount = unreliableCommandCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x060002B6 RID: 694 RVA: 0x00013C4C File Offset: 0x00011E4C
|
||||
internal void CountFragmentOpCommand(int size)
|
||||
{
|
||||
this.FragmentCommandBytes += size;
|
||||
int fragmentCommandCount = this.FragmentCommandCount;
|
||||
this.FragmentCommandCount = fragmentCommandCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x060002B7 RID: 695 RVA: 0x00013C7C File Offset: 0x00011E7C
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("TotalPacketBytes: {0} TotalCommandBytes: {1} TotalPacketCount: {2} TotalCommandsInPackets: {3}", new object[] { this.TotalPacketBytes, this.TotalCommandBytes, this.TotalPacketCount, this.TotalCommandsInPackets });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000038 RID: 56
|
||||
public class TrafficStatsGameLevel
|
||||
{
|
||||
// Token: 0x1700007F RID: 127
|
||||
// (get) Token: 0x06000267 RID: 615 RVA: 0x000135AF File Offset: 0x000117AF
|
||||
// (set) Token: 0x06000268 RID: 616 RVA: 0x000135B7 File Offset: 0x000117B7
|
||||
public int OperationByteCount { get; set; }
|
||||
|
||||
// Token: 0x17000080 RID: 128
|
||||
// (get) Token: 0x06000269 RID: 617 RVA: 0x000135C0 File Offset: 0x000117C0
|
||||
// (set) Token: 0x0600026A RID: 618 RVA: 0x000135C8 File Offset: 0x000117C8
|
||||
public int OperationCount { get; set; }
|
||||
|
||||
// Token: 0x17000081 RID: 129
|
||||
// (get) Token: 0x0600026B RID: 619 RVA: 0x000135D1 File Offset: 0x000117D1
|
||||
// (set) Token: 0x0600026C RID: 620 RVA: 0x000135D9 File Offset: 0x000117D9
|
||||
public int ResultByteCount { get; set; }
|
||||
|
||||
// Token: 0x17000082 RID: 130
|
||||
// (get) Token: 0x0600026D RID: 621 RVA: 0x000135E2 File Offset: 0x000117E2
|
||||
// (set) Token: 0x0600026E RID: 622 RVA: 0x000135EA File Offset: 0x000117EA
|
||||
public int ResultCount { get; set; }
|
||||
|
||||
// Token: 0x17000083 RID: 131
|
||||
// (get) Token: 0x0600026F RID: 623 RVA: 0x000135F3 File Offset: 0x000117F3
|
||||
// (set) Token: 0x06000270 RID: 624 RVA: 0x000135FB File Offset: 0x000117FB
|
||||
public int EventByteCount { get; set; }
|
||||
|
||||
// Token: 0x17000084 RID: 132
|
||||
// (get) Token: 0x06000271 RID: 625 RVA: 0x00013604 File Offset: 0x00011804
|
||||
// (set) Token: 0x06000272 RID: 626 RVA: 0x0001360C File Offset: 0x0001180C
|
||||
public int EventCount { get; set; }
|
||||
|
||||
// Token: 0x17000085 RID: 133
|
||||
// (get) Token: 0x06000273 RID: 627 RVA: 0x00013615 File Offset: 0x00011815
|
||||
// (set) Token: 0x06000274 RID: 628 RVA: 0x0001361D File Offset: 0x0001181D
|
||||
public int LongestOpResponseCallback { get; set; }
|
||||
|
||||
// Token: 0x17000086 RID: 134
|
||||
// (get) Token: 0x06000275 RID: 629 RVA: 0x00013626 File Offset: 0x00011826
|
||||
// (set) Token: 0x06000276 RID: 630 RVA: 0x0001362E File Offset: 0x0001182E
|
||||
public byte LongestOpResponseCallbackOpCode { get; set; }
|
||||
|
||||
// Token: 0x17000087 RID: 135
|
||||
// (get) Token: 0x06000277 RID: 631 RVA: 0x00013637 File Offset: 0x00011837
|
||||
// (set) Token: 0x06000278 RID: 632 RVA: 0x0001363F File Offset: 0x0001183F
|
||||
public int LongestEventCallback { get; set; }
|
||||
|
||||
// Token: 0x17000088 RID: 136
|
||||
// (get) Token: 0x06000279 RID: 633 RVA: 0x00013648 File Offset: 0x00011848
|
||||
// (set) Token: 0x0600027A RID: 634 RVA: 0x00013650 File Offset: 0x00011850
|
||||
public byte LongestEventCallbackCode { get; set; }
|
||||
|
||||
// Token: 0x17000089 RID: 137
|
||||
// (get) Token: 0x0600027B RID: 635 RVA: 0x00013659 File Offset: 0x00011859
|
||||
// (set) Token: 0x0600027C RID: 636 RVA: 0x00013661 File Offset: 0x00011861
|
||||
public int LongestDeltaBetweenDispatching { get; set; }
|
||||
|
||||
// Token: 0x1700008A RID: 138
|
||||
// (get) Token: 0x0600027D RID: 637 RVA: 0x0001366A File Offset: 0x0001186A
|
||||
// (set) Token: 0x0600027E RID: 638 RVA: 0x00013672 File Offset: 0x00011872
|
||||
public int LongestDeltaBetweenSending { get; set; }
|
||||
|
||||
// Token: 0x1700008B RID: 139
|
||||
// (get) Token: 0x0600027F RID: 639 RVA: 0x0001367C File Offset: 0x0001187C
|
||||
[Obsolete("Use DispatchIncomingCommandsCalls, which has proper naming.")]
|
||||
public int DispatchCalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.DispatchIncomingCommandsCalls;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700008C RID: 140
|
||||
// (get) Token: 0x06000280 RID: 640 RVA: 0x00013694 File Offset: 0x00011894
|
||||
// (set) Token: 0x06000281 RID: 641 RVA: 0x0001369C File Offset: 0x0001189C
|
||||
public int DispatchIncomingCommandsCalls { get; set; }
|
||||
|
||||
// Token: 0x1700008D RID: 141
|
||||
// (get) Token: 0x06000282 RID: 642 RVA: 0x000136A5 File Offset: 0x000118A5
|
||||
// (set) Token: 0x06000283 RID: 643 RVA: 0x000136AD File Offset: 0x000118AD
|
||||
public int SendOutgoingCommandsCalls { get; set; }
|
||||
|
||||
// Token: 0x1700008E RID: 142
|
||||
// (get) Token: 0x06000284 RID: 644 RVA: 0x000136B8 File Offset: 0x000118B8
|
||||
public int TotalByteCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.OperationByteCount + this.ResultByteCount + this.EventByteCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700008F RID: 143
|
||||
// (get) Token: 0x06000285 RID: 645 RVA: 0x000136E0 File Offset: 0x000118E0
|
||||
public int TotalMessageCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.OperationCount + this.ResultCount + this.EventCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000090 RID: 144
|
||||
// (get) Token: 0x06000286 RID: 646 RVA: 0x00013708 File Offset: 0x00011908
|
||||
public int TotalIncomingByteCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ResultByteCount + this.EventByteCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000091 RID: 145
|
||||
// (get) Token: 0x06000287 RID: 647 RVA: 0x00013728 File Offset: 0x00011928
|
||||
public int TotalIncomingMessageCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ResultCount + this.EventCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000092 RID: 146
|
||||
// (get) Token: 0x06000288 RID: 648 RVA: 0x00013748 File Offset: 0x00011948
|
||||
public int TotalOutgoingByteCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.OperationByteCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000093 RID: 147
|
||||
// (get) Token: 0x06000289 RID: 649 RVA: 0x00013760 File Offset: 0x00011960
|
||||
public int TotalOutgoingMessageCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.OperationCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600028A RID: 650 RVA: 0x00013778 File Offset: 0x00011978
|
||||
internal void CountOperation(int operationBytes)
|
||||
{
|
||||
this.OperationByteCount += operationBytes;
|
||||
int operationCount = this.OperationCount;
|
||||
this.OperationCount = operationCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x0600028B RID: 651 RVA: 0x000137A8 File Offset: 0x000119A8
|
||||
internal void CountResult(int resultBytes)
|
||||
{
|
||||
this.ResultByteCount += resultBytes;
|
||||
int resultCount = this.ResultCount;
|
||||
this.ResultCount = resultCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x0600028C RID: 652 RVA: 0x000137D8 File Offset: 0x000119D8
|
||||
internal void CountEvent(int eventBytes)
|
||||
{
|
||||
this.EventByteCount += eventBytes;
|
||||
int eventCount = this.EventCount;
|
||||
this.EventCount = eventCount + 1;
|
||||
}
|
||||
|
||||
// Token: 0x0600028D RID: 653 RVA: 0x00013808 File Offset: 0x00011A08
|
||||
internal void TimeForResponseCallback(byte code, int time)
|
||||
{
|
||||
bool flag = time > this.LongestOpResponseCallback;
|
||||
if (flag)
|
||||
{
|
||||
this.LongestOpResponseCallback = time;
|
||||
this.LongestOpResponseCallbackOpCode = code;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600028E RID: 654 RVA: 0x00013838 File Offset: 0x00011A38
|
||||
internal void TimeForEventCallback(byte code, int time)
|
||||
{
|
||||
bool flag = time > this.LongestEventCallback;
|
||||
if (flag)
|
||||
{
|
||||
this.LongestEventCallback = time;
|
||||
this.LongestEventCallbackCode = code;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600028F RID: 655 RVA: 0x00013868 File Offset: 0x00011A68
|
||||
internal void DispatchIncomingCommandsCalled()
|
||||
{
|
||||
bool flag = this.timeOfLastDispatchCall != 0;
|
||||
if (flag)
|
||||
{
|
||||
int num = SupportClass.GetTickCount() - this.timeOfLastDispatchCall;
|
||||
bool flag2 = num > this.LongestDeltaBetweenDispatching;
|
||||
if (flag2)
|
||||
{
|
||||
this.LongestDeltaBetweenDispatching = num;
|
||||
}
|
||||
}
|
||||
int dispatchIncomingCommandsCalls = this.DispatchIncomingCommandsCalls;
|
||||
this.DispatchIncomingCommandsCalls = dispatchIncomingCommandsCalls + 1;
|
||||
this.timeOfLastDispatchCall = SupportClass.GetTickCount();
|
||||
}
|
||||
|
||||
// Token: 0x06000290 RID: 656 RVA: 0x000138C8 File Offset: 0x00011AC8
|
||||
internal void SendOutgoingCommandsCalled()
|
||||
{
|
||||
bool flag = this.timeOfLastSendCall != 0;
|
||||
if (flag)
|
||||
{
|
||||
int num = SupportClass.GetTickCount() - this.timeOfLastSendCall;
|
||||
bool flag2 = num > this.LongestDeltaBetweenSending;
|
||||
if (flag2)
|
||||
{
|
||||
this.LongestDeltaBetweenSending = num;
|
||||
}
|
||||
}
|
||||
int sendOutgoingCommandsCalls = this.SendOutgoingCommandsCalls;
|
||||
this.SendOutgoingCommandsCalls = sendOutgoingCommandsCalls + 1;
|
||||
this.timeOfLastSendCall = SupportClass.GetTickCount();
|
||||
}
|
||||
|
||||
// Token: 0x06000291 RID: 657 RVA: 0x00013928 File Offset: 0x00011B28
|
||||
public void ResetMaximumCounters()
|
||||
{
|
||||
this.LongestDeltaBetweenDispatching = 0;
|
||||
this.LongestDeltaBetweenSending = 0;
|
||||
this.LongestEventCallback = 0;
|
||||
this.LongestEventCallbackCode = 0;
|
||||
this.LongestOpResponseCallback = 0;
|
||||
this.LongestOpResponseCallbackOpCode = 0;
|
||||
this.timeOfLastDispatchCall = 0;
|
||||
this.timeOfLastSendCall = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000292 RID: 658 RVA: 0x00013974 File Offset: 0x00011B74
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("OperationByteCount: {0} ResultByteCount: {1} EventByteCount: {2}", this.OperationByteCount, this.ResultByteCount, this.EventByteCount);
|
||||
}
|
||||
|
||||
// Token: 0x06000293 RID: 659 RVA: 0x000139B4 File Offset: 0x00011BB4
|
||||
public string ToStringVitalStats()
|
||||
{
|
||||
return string.Format("Longest delta between Send: {0}ms Dispatch: {1}ms. Longest callback OnEv: {3}={2}ms OnResp: {5}={4}ms. Calls of Send: {6} Dispatch: {7}.", new object[] { this.LongestDeltaBetweenSending, this.LongestDeltaBetweenDispatching, this.LongestEventCallback, this.LongestEventCallbackCode, this.LongestOpResponseCallback, this.LongestOpResponseCallbackOpCode, this.SendOutgoingCommandsCalls, this.DispatchIncomingCommandsCalls });
|
||||
}
|
||||
|
||||
// Token: 0x04000161 RID: 353
|
||||
private int timeOfLastDispatchCall;
|
||||
|
||||
// Token: 0x04000162 RID: 354
|
||||
private int timeOfLastSendCall;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace ExitGames.Client.Photon
|
||||
{
|
||||
// Token: 0x02000006 RID: 6
|
||||
internal static class Version
|
||||
{
|
||||
// Token: 0x0400000F RID: 15
|
||||
internal static readonly byte[] clientVersion = new byte[] { 4, 1, 1, 18 };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user