802 lines
24 KiB
C#
802 lines
24 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using BestHTTP.Logger;
|
|
using BestHTTP.PlatformSupport.FileSystem;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Caching
|
|
{
|
|
// Token: 0x020020A5 RID: 8357
|
|
[Token(Token = "0x20020A5")]
|
|
public static class HTTPCacheService
|
|
{
|
|
// Token: 0x1700217E RID: 8574
|
|
// (get) Token: 0x0600D243 RID: 53827 RVA: 0x00300894 File Offset: 0x002FEA94
|
|
[Token(Token = "0x1700217E")]
|
|
public static bool IsSupported
|
|
{
|
|
[Token(Token = "0x600D243")]
|
|
[Address(RVA = "0x2415FC0", Offset = "0x2414FC0", VA = "0x182415FC0")]
|
|
get
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
string rootCacheFolder = HTTPManager.GetRootCacheFolder();
|
|
ILogger logger = HTTPManager.Logger;
|
|
}
|
|
while (num != 0);
|
|
return HTTPCacheService.isSupported;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700217F RID: 8575
|
|
// (get) Token: 0x0600D244 RID: 53828 RVA: 0x003008D8 File Offset: 0x002FEAD8
|
|
[Token(Token = "0x1700217F")]
|
|
private static Dictionary<Uri, HTTPCacheFileInfo> Library
|
|
{
|
|
[Token(Token = "0x600D244")]
|
|
[Address(RVA = "0x2416310", Offset = "0x2415310", VA = "0x182416310")]
|
|
get
|
|
{
|
|
HTTPCacheService.LoadLibrary();
|
|
return HTTPCacheService.library;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002180 RID: 8576
|
|
// (get) Token: 0x0600D245 RID: 53829 RVA: 0x003008F4 File Offset: 0x002FEAF4
|
|
// (set) Token: 0x0600D246 RID: 53830 RVA: 0x00300908 File Offset: 0x002FEB08
|
|
[Token(Token = "0x17002180")]
|
|
internal static string CacheFolder
|
|
{
|
|
[Token(Token = "0x600D245")]
|
|
[Address(RVA = "0x2415F60", Offset = "0x2414F60", VA = "0x182415F60")]
|
|
get;
|
|
[Token(Token = "0x600D246")]
|
|
[Address(RVA = "0x2416370", Offset = "0x2415370", VA = "0x182416370")]
|
|
private set;
|
|
}
|
|
|
|
// Token: 0x17002181 RID: 8577
|
|
// (get) Token: 0x0600D247 RID: 53831 RVA: 0x0030091C File Offset: 0x002FEB1C
|
|
// (set) Token: 0x0600D248 RID: 53832 RVA: 0x00300930 File Offset: 0x002FEB30
|
|
[Token(Token = "0x17002181")]
|
|
private static string LibraryPath
|
|
{
|
|
[Token(Token = "0x600D247")]
|
|
[Address(RVA = "0x2416250", Offset = "0x2415250", VA = "0x182416250")]
|
|
get;
|
|
[Token(Token = "0x600D248")]
|
|
[Address(RVA = "0x24163D0", Offset = "0x24153D0", VA = "0x1824163D0")]
|
|
set;
|
|
}
|
|
|
|
// Token: 0x0600D24A RID: 53834 RVA: 0x0030095C File Offset: 0x002FEB5C
|
|
[Token(Token = "0x600D24A")]
|
|
[Address(RVA = "0x24124B0", Offset = "0x24114B0", VA = "0x1824124B0")]
|
|
internal static void CheckSetup()
|
|
{
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
HTTPCacheService.SetupCacheFolder();
|
|
HTTPCacheService.LoadLibrary();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D24B RID: 53835 RVA: 0x00300984 File Offset: 0x002FEB84
|
|
[Token(Token = "0x600D24B")]
|
|
[Address(RVA = "0x24156A0", Offset = "0x24146A0", VA = "0x1824156A0")]
|
|
internal static void SetupCacheFolder()
|
|
{
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
bool flag = string.IsNullOrEmpty(HTTPCacheService.<CacheFolder>k__BackingField);
|
|
if (flag || flag)
|
|
{
|
|
HTTPCacheService.<CacheFolder>k__BackingField = Path.Combine(HTTPManager.GetRootCacheFolder(), "HTTPCache");
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
IIOService ioservice2 = HTTPManager.IOService;
|
|
HTTPCacheService.<LibraryPath>k__BackingField = Path.Combine(HTTPManager.GetRootCacheFolder(), "Library");
|
|
}
|
|
ILogger logger = HTTPManager.Logger;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D24C RID: 53836 RVA: 0x00300A04 File Offset: 0x002FEC04
|
|
[Token(Token = "0x600D24C")]
|
|
[Address(RVA = "0x24138F0", Offset = "0x24128F0", VA = "0x1824138F0")]
|
|
internal static ulong GetNameIdx()
|
|
{
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
ulong nextNameIDX = HTTPCacheService.NextNameIDX;
|
|
ulong num = HTTPCacheService.NextNameIDX;
|
|
num += (ulong)1L;
|
|
HTTPCacheService.NextNameIDX = num;
|
|
HTTPCacheService.NextNameIDX = 0UL;
|
|
Dictionary<ulong, HTTPCacheFileInfo> usedIndexes = HTTPCacheService.UsedIndexes;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D24D RID: 53837 RVA: 0x00300A68 File Offset: 0x002FEC68
|
|
[Token(Token = "0x600D24D")]
|
|
[Address(RVA = "0x2413AE0", Offset = "0x2412AE0", VA = "0x182413AE0")]
|
|
internal static bool HasEntity(Uri uri)
|
|
{
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
throw new NullReferenceException();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D24E RID: 53838 RVA: 0x00300AB8 File Offset: 0x002FECB8
|
|
[Token(Token = "0x600D24E")]
|
|
[Address(RVA = "0x2412820", Offset = "0x2411820", VA = "0x182412820")]
|
|
public static bool DeleteEntity(Uri uri, bool removeFromLibrary = true)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
break;
|
|
}
|
|
int num2 = 0;
|
|
object obj = HTTPCacheFileLock.Acquire(uri);
|
|
Monitor.Enter(obj, num2);
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num3 = 0;
|
|
Monitor.Enter(dictionary, num2);
|
|
HTTPCacheService.LoadLibrary();
|
|
bool flag = HTTPCacheService.library.TryGetValue(uri, num3);
|
|
if (flag)
|
|
{
|
|
}
|
|
if (removeFromLibrary != flag)
|
|
{
|
|
bool flag2 = HTTPCacheService.Library.Remove(uri);
|
|
Dictionary<ulong, HTTPCacheFileInfo> usedIndexes = HTTPCacheService.UsedIndexes;
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
if (num == 0)
|
|
{
|
|
if (num != -1)
|
|
{
|
|
}
|
|
Monitor.Exit(obj);
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D24F RID: 53839 RVA: 0x00300B74 File Offset: 0x002FED74
|
|
[Token(Token = "0x600D24F")]
|
|
[Address(RVA = "0x2413F30", Offset = "0x2412F30", VA = "0x182413F30")]
|
|
internal static bool IsCachedEntityExpiresInTheFuture(HTTPRequest request)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
goto IL_4F;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
Uri currentUri = request.CurrentUri;
|
|
if (!dictionary2.TryGetValue(currentUri, num2))
|
|
{
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
IL_4F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D250 RID: 53840 RVA: 0x00300BE4 File Offset: 0x002FEDE4
|
|
[Token(Token = "0x600D250")]
|
|
[Address(RVA = "0x2415460", Offset = "0x2414460", VA = "0x182415460")]
|
|
internal static void SetHeaders(HTTPRequest request)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
break;
|
|
}
|
|
bool flag = request.RemoveHeader("If-None-Match");
|
|
bool flag2 = request.RemoveHeader("If-Modified-Since");
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
Uri currentUri = request.CurrentUri;
|
|
if (dictionary2.TryGetValue(currentUri, num2))
|
|
{
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600D251 RID: 53841 RVA: 0x00300C64 File Offset: 0x002FEE64
|
|
[Token(Token = "0x600D251")]
|
|
[Address(RVA = "0x2413460", Offset = "0x2412460", VA = "0x182413460")]
|
|
internal static HTTPCacheFileInfo GetEntity(Uri uri)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
break;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
bool flag = HTTPCacheService.library.TryGetValue(uri, num2);
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D252 RID: 53842 RVA: 0x00300CB8 File Offset: 0x002FEEB8
|
|
[Token(Token = "0x600D252")]
|
|
[Address(RVA = "0x2413660", Offset = "0x2412660", VA = "0x182413660")]
|
|
internal static HTTPResponse GetFullResponse(HTTPRequest request)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
goto IL_4F;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
Uri currentUri = request.CurrentUri;
|
|
if (!dictionary2.TryGetValue(currentUri, num2))
|
|
{
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
IL_4F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D253 RID: 53843 RVA: 0x00300D28 File Offset: 0x002FEF28
|
|
[Token(Token = "0x600D253")]
|
|
[Address(RVA = "0x2413CE0", Offset = "0x2412CE0", VA = "0x182413CE0")]
|
|
internal static bool IsCacheble(Uri uri, HTTPMethods method, HTTPResponse response)
|
|
{
|
|
if (!HTTPCacheService.IsSupported || response == 0 || response.<StatusCode>k__BackingField > 199)
|
|
{
|
|
return;
|
|
}
|
|
List<string> headerValues = response.GetHeaderValues("cache-control");
|
|
if (headerValues != 0)
|
|
{
|
|
Predicate<string> <>9__30_ = HTTPCacheService.<>c.<>9__30_0;
|
|
if (<>9__30_ == 0)
|
|
{
|
|
HTTPCacheService.<>c.<>9__30_0 = delegate(string headerValue)
|
|
{
|
|
string text = headerValue.ToLower();
|
|
return text.Contains("no-store") || text.Contains("no-cache");
|
|
};
|
|
}
|
|
if (headerValues.Exists(<>9__30_))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
List<string> headerValues2 = response.GetHeaderValues("pragma");
|
|
if (headerValues2 != 0)
|
|
{
|
|
Predicate<string> predicate;
|
|
if (HTTPCacheService.<>c.<>9__30_1 == 0)
|
|
{
|
|
predicate = delegate(string headerValue)
|
|
{
|
|
string text2 = headerValue.ToLower();
|
|
return text2.Contains("no-store") || text2.Contains("no-cache");
|
|
};
|
|
HTTPCacheService.<>c.<>9__30_1 = predicate;
|
|
}
|
|
if (headerValues2.Exists(predicate))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
if (response.GetHeaderValues("content-range") == 0)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D254 RID: 53844 RVA: 0x00300DE0 File Offset: 0x002FEFE0
|
|
[Token(Token = "0x600D254")]
|
|
[Address(RVA = "0x2415B10", Offset = "0x2414B10", VA = "0x182415B10")]
|
|
internal static HTTPCacheFileInfo Store(Uri uri, HTTPMethods method, HTTPResponse response)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if (response == 0)
|
|
{
|
|
goto IL_C0;
|
|
}
|
|
byte[] <Data>k__BackingField = response.<Data>k__BackingField;
|
|
if (<Data>k__BackingField == 0 || <Data>k__BackingField.Length == num || !HTTPCacheService.IsSupported)
|
|
{
|
|
goto IL_C0;
|
|
}
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.Library;
|
|
int num2 = 0;
|
|
if (!HTTPCacheService.Library.TryGetValue(uri, num2))
|
|
{
|
|
break;
|
|
}
|
|
int num3 = 0;
|
|
ILogger logger = HTTPManager.Logger;
|
|
if (num < num3)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
ILogger logger2 = HTTPManager.Logger;
|
|
int hashCode = uri.GetHashCode();
|
|
string text = string.Format("{0} - Saved to cache", hashCode);
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
if (num == 0)
|
|
{
|
|
goto IL_C0;
|
|
}
|
|
}
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.Library;
|
|
HTTPCacheFileInfo httpcacheFileInfo = new HTTPCacheFileInfo(uri);
|
|
throw new NullReferenceException();
|
|
IL_C0:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D255 RID: 53845 RVA: 0x00300EE0 File Offset: 0x002FF0E0
|
|
[Token(Token = "0x600D255")]
|
|
[Address(RVA = "0x2414920", Offset = "0x2413920", VA = "0x182414920")]
|
|
internal static Stream PrepareStreamed(Uri uri, HTTPResponse response)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
goto IL_63;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
if (!HTTPCacheService.library.TryGetValue(uri, num2))
|
|
{
|
|
break;
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
if (num == 0)
|
|
{
|
|
goto IL_63;
|
|
}
|
|
}
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.Library;
|
|
HTTPCacheFileInfo httpcacheFileInfo = new HTTPCacheFileInfo(uri);
|
|
throw new NullReferenceException();
|
|
IL_63:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D256 RID: 53846 RVA: 0x00300F70 File Offset: 0x002FF170
|
|
[Token(Token = "0x600D256")]
|
|
[Address(RVA = "0x24121E0", Offset = "0x24111E0", VA = "0x1824121E0")]
|
|
public static void BeginClear()
|
|
{
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
HTTPCacheService.SetupCacheFolder();
|
|
WaitCallback <>9__33_ = HTTPCacheService.<>c.<>9__33_0;
|
|
if (<>9__33_ == 0)
|
|
{
|
|
HTTPCacheService.<>c.<>9__33_0 = delegate(object param)
|
|
{
|
|
HTTPCacheService.ClearImpl(param);
|
|
};
|
|
}
|
|
bool flag = ThreadPool.QueueUserWorkItem(<>9__33_);
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D257 RID: 53847 RVA: 0x00300FB8 File Offset: 0x002FF1B8
|
|
[Token(Token = "0x600D257")]
|
|
[Address(RVA = "0x2412550", Offset = "0x2411550", VA = "0x182412550")]
|
|
private static void ClearImpl(object param)
|
|
{
|
|
int num = 0;
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
IIOService ioservice2 = HTTPManager.IOService;
|
|
num++;
|
|
num++;
|
|
HTTPCacheService.UsedIndexes.Clear();
|
|
HTTPCacheService.library.Clear();
|
|
HTTPCacheService.SaveLibrary();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D258 RID: 53848 RVA: 0x0030101C File Offset: 0x002FF21C
|
|
[Token(Token = "0x600D258")]
|
|
[Address(RVA = "0x2412350", Offset = "0x2411350", VA = "0x182412350")]
|
|
public static void BeginMaintainence(HTTPCacheMaintananceParams maintananceParam)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600D258)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.Caching.HTTPCacheService::BeginMaintainence(BestHTTP.Caching.HTTPCacheMaintananceParams)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_3B:
|
|
stloc:ArgumentNullException(var_4_45, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("maintananceParams == null")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600D259 RID: 53849 RVA: 0x00301070 File Offset: 0x002FF270
|
|
[Token(Token = "0x600D259")]
|
|
[Address(RVA = "0x2412FA0", Offset = "0x2411FA0", VA = "0x182412FA0")]
|
|
public static int GetCacheEntityCount()
|
|
{
|
|
int num;
|
|
int count;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
return 0;
|
|
}
|
|
HTTPCacheService.CheckSetup();
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
HTTPCacheService.LoadLibrary();
|
|
count = HTTPCacheService.library.Count;
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
return count;
|
|
}
|
|
|
|
// Token: 0x0600D25A RID: 53850 RVA: 0x003010C8 File Offset: 0x002FF2C8
|
|
[Token(Token = "0x600D25A")]
|
|
[Address(RVA = "0x2413180", Offset = "0x2412180", VA = "0x182413180")]
|
|
public static ulong GetCacheSize()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
break;
|
|
}
|
|
HTTPCacheService.CheckSetup();
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_51;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
}
|
|
while (num != 0);
|
|
throw new NullReferenceException();
|
|
IL_51:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D25B RID: 53851 RVA: 0x0030112C File Offset: 0x002FF32C
|
|
[Token(Token = "0x600D25B")]
|
|
[Address(RVA = "0x24141B0", Offset = "0x24131B0", VA = "0x1824141B0")]
|
|
private static void LoadLibrary()
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
return;
|
|
}
|
|
HTTPCacheService.library = new Dictionary(new UriComparer());
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
IIOService ioservice2 = HTTPManager.IOService;
|
|
BinaryReader binaryReader;
|
|
ushort num2 = binaryReader.ReadUInt16();
|
|
HTTPCacheService.NextNameIDX = (ulong)binaryReader.ReadInt64();
|
|
ushort num3 = binaryReader.ReadUInt16();
|
|
Uri uri;
|
|
if (num < (int)num3)
|
|
{
|
|
decimal num4 = binaryReader.ReadDecimal();
|
|
if (new HTTPCacheFileInfo(uri, binaryReader, (int)num2).IsExists())
|
|
{
|
|
break;
|
|
}
|
|
num++;
|
|
}
|
|
if (binaryReader != 0)
|
|
{
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_12F;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
num++;
|
|
int num5;
|
|
if (uri != 0)
|
|
{
|
|
num5 = 0;
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_12F;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
Monitor.Exit(num5);
|
|
if (num == 0)
|
|
{
|
|
goto Block_6;
|
|
}
|
|
}
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.library;
|
|
throw new NullReferenceException();
|
|
Block_6:
|
|
HTTPCacheService.DeleteUnusedFiles();
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
HTTPCacheService.SetupCacheFolder();
|
|
WaitCallback waitCallback;
|
|
if (HTTPCacheService.<>c.<>9__33_0 == 0)
|
|
{
|
|
waitCallback = delegate(object param)
|
|
{
|
|
HTTPCacheService.ClearImpl(param);
|
|
};
|
|
HTTPCacheService.<>c.<>9__33_0 = waitCallback;
|
|
}
|
|
bool flag = ThreadPool.QueueUserWorkItem(waitCallback);
|
|
}
|
|
return;
|
|
IL_12F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D25C RID: 53852 RVA: 0x00301270 File Offset: 0x002FF470
|
|
[Token(Token = "0x600D25C")]
|
|
[Address(RVA = "0x2414C50", Offset = "0x2413C50", VA = "0x182414C50")]
|
|
internal static void SaveLibrary()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
break;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
BinaryWriter binaryWriter;
|
|
binaryWriter.Write(2);
|
|
ulong nextNameIDX = HTTPCacheService.NextNameIDX;
|
|
binaryWriter.Write((long)nextNameIDX);
|
|
int count = HTTPCacheService.Library.Count;
|
|
binaryWriter.Write((ushort)count);
|
|
int num2 = 0;
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.Library;
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
int hashCode = num2.GetHashCode();
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_AE;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
num++;
|
|
if (binaryWriter != 0)
|
|
{
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_C0;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
num++;
|
|
int num3 = 0;
|
|
if (num != 0)
|
|
{
|
|
goto IL_C0;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
Monitor.Exit(num3);
|
|
}
|
|
while (num != 0);
|
|
return;
|
|
IL_AE:
|
|
throw new NullReferenceException();
|
|
IL_C0:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D25D RID: 53853 RVA: 0x00301344 File Offset: 0x002FF544
|
|
[Token(Token = "0x600D25D")]
|
|
[Address(RVA = "0x2415160", Offset = "0x2414160", VA = "0x182415160")]
|
|
internal static void SetBodyLength(Uri uri, int bodyLength)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if (!HTTPCacheService.IsSupported)
|
|
{
|
|
return;
|
|
}
|
|
HTTPCacheService.LoadLibrary();
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.library;
|
|
int num2 = 0;
|
|
HTTPCacheService.LoadLibrary();
|
|
if (!HTTPCacheService.library.TryGetValue(uri, num2))
|
|
{
|
|
break;
|
|
}
|
|
Monitor.Exit(dictionary);
|
|
if (num == 0)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary2 = HTTPCacheService.Library;
|
|
DateTime utcNow = DateTime.UtcNow;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600D25E RID: 53854 RVA: 0x003013D4 File Offset: 0x002FF5D4
|
|
[Token(Token = "0x600D25E")]
|
|
[Address(RVA = "0x2412B90", Offset = "0x2411B90", VA = "0x182412B90")]
|
|
private static void DeleteUnusedFiles()
|
|
{
|
|
int num = 0;
|
|
if (HTTPCacheService.IsSupported)
|
|
{
|
|
HTTPCacheService.CheckSetup();
|
|
IIOService ioservice = HTTPManager.IOService;
|
|
int num2 = 0;
|
|
string fileName = Path.GetFileName(num);
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
Dictionary<Uri, HTTPCacheFileInfo> dictionary = HTTPCacheService.Library;
|
|
Dictionary<ulong, HTTPCacheFileInfo> usedIndexes = HTTPCacheService.UsedIndexes;
|
|
throw new NullReferenceException();
|
|
}
|
|
IIOService ioservice2 = HTTPManager.IOService;
|
|
num2++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x040085BB RID: 34235
|
|
[Token(Token = "0x40085BB")]
|
|
private const int LibraryVersion = 2;
|
|
|
|
// Token: 0x040085BC RID: 34236
|
|
[Token(Token = "0x40085BC")]
|
|
private static bool isSupported;
|
|
|
|
// Token: 0x040085BD RID: 34237
|
|
[Token(Token = "0x40085BD")]
|
|
private static bool IsSupportCheckDone;
|
|
|
|
// Token: 0x040085BE RID: 34238
|
|
[Token(Token = "0x40085BE")]
|
|
private static Dictionary<Uri, HTTPCacheFileInfo> library;
|
|
|
|
// Token: 0x040085BF RID: 34239
|
|
[Token(Token = "0x40085BF")]
|
|
private static Dictionary<ulong, HTTPCacheFileInfo> UsedIndexes = new Dictionary();
|
|
|
|
// Token: 0x040085C2 RID: 34242
|
|
[Token(Token = "0x40085C2")]
|
|
private static bool InClearThread;
|
|
|
|
// Token: 0x040085C3 RID: 34243
|
|
[Token(Token = "0x40085C3")]
|
|
private static bool InMaintainenceThread;
|
|
|
|
// Token: 0x040085C4 RID: 34244
|
|
[Token(Token = "0x40085C4")]
|
|
private static ulong NextNameIDX;
|
|
}
|
|
}
|