118 lines
3.1 KiB
C#
118 lines
3.1 KiB
C#
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; }
|
|
}
|
|
}
|
|
}
|