scripts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user