This commit is contained in:
niko
2026-04-08 23:40:05 +02:00
parent d6894bcbc7
commit 18dc73f922
7750 changed files with 1795369 additions and 0 deletions
@@ -0,0 +1,513 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using Cpp2IlInjected;
namespace BestHTTP.Extensions
{
// Token: 0x020019B2 RID: 6578
[Token(Token = "0x20019B2")]
[StructLayout(3)]
public static class Extensions
{
// Token: 0x0600B0D4 RID: 45268 RVA: 0x002951F8 File Offset: 0x002933F8
[Token(Token = "0x600B0D4")]
[Address(RVA = "0x1C87A90", Offset = "0x1C86490", VA = "0x181C87A90")]
public static string AsciiToString(this byte[] bytes)
{
int length;
StringBuilder stringBuilder = new StringBuilder(length);
length = bytes.Length;
int num = 0;
int length2 = bytes.Length;
if (num < length2)
{
byte b;
StringBuilder stringBuilder2 = stringBuilder.Append((char)b);
num++;
}
throw new NullReferenceException();
}
// Token: 0x0600B0D5 RID: 45269 RVA: 0x00295234 File Offset: 0x00293434
[Token(Token = "0x600B0D5")]
[Address(RVA = "0x1C87F70", Offset = "0x1C86970", VA = "0x181C87F70")]
public static byte[] GetASCIIBytes(this string str)
{
int stringLength = str.m_stringLength;
int num = 0;
byte[] array = VariableSizedBufferPool.Get((long)stringLength, num != 0);
int num2 = 0;
if (num2 < str.m_stringLength)
{
char c = str[num2];
num2++;
}
return array;
}
// Token: 0x0600B0D6 RID: 45270 RVA: 0x00295274 File Offset: 0x00293474
[Token(Token = "0x600B0D6")]
[Address(RVA = "0x1C88DE0", Offset = "0x1C877E0", VA = "0x181C88DE0")]
public static void SendAsASCII(this BinaryWriter stream, string str)
{
int num = 0;
if (num < str.m_stringLength)
{
char c = str[num];
stream.Write(c != '\0');
num++;
}
}
// Token: 0x0600B0D7 RID: 45271 RVA: 0x002952A8 File Offset: 0x002934A8
[Token(Token = "0x600B0D7")]
[Address(RVA = "0x1C89330", Offset = "0x1C87D30", VA = "0x181C89330")]
public static void WriteLine(this Stream fs)
{
int num = fs.ReadByte();
}
// Token: 0x0600B0D8 RID: 45272 RVA: 0x002952C4 File Offset: 0x002934C4
[Token(Token = "0x600B0D8")]
[Address(RVA = "0x1C894B0", Offset = "0x1C87EB0", VA = "0x181C894B0")]
public static void WriteLine(this Stream fs, string line)
{
byte[] asciibytes = line.GetASCIIBytes();
int num = fs.ReadByte();
fs.WriteLine();
VariableSizedBufferPool.Release(asciibytes);
}
// Token: 0x0600B0D9 RID: 45273 RVA: 0x002952F4 File Offset: 0x002934F4
[Token(Token = "0x600B0D9")]
[Address(RVA = "0x1C893C0", Offset = "0x1C87DC0", VA = "0x181C893C0")]
public static void WriteLine(this Stream fs, string format, params object[] values)
{
byte[] asciibytes = string.Format(format, values).GetASCIIBytes();
int num = fs.ReadByte();
fs.WriteLine();
VariableSizedBufferPool.Release(asciibytes);
}
// Token: 0x0600B0DA RID: 45274 RVA: 0x00295328 File Offset: 0x00293528
[Token(Token = "0x600B0DA")]
[Address(RVA = "0x1C88050", Offset = "0x1C86A50", VA = "0x181C88050")]
public static string GetRequestPathAndQueryURL(this Uri uri)
{
string parts = uri.GetParts(UriComponents.PathAndQuery, UriFormat.UriEscaped);
return "/";
}
// Token: 0x0600B0DB RID: 45275 RVA: 0x0029534C File Offset: 0x0029354C
[Token(Token = "0x600B0DB")]
[Address(RVA = "0x1C87DD0", Offset = "0x1C867D0", VA = "0x181C87DD0")]
public static string[] FindOption(this string str, string option)
{
string text = str.ToLower();
(new char[1])[0] = (char)((uint)44);
string text2 = option.ToLower();
int num = 0;
string[] array;
int length = array.Length;
if (num < length)
{
string text3 = array[num];
int num2 = 0;
if (!text3.Contains(text2))
{
num++;
}
string text4 = array[num];
return text4.Split(new char[] { (char)((uint)61) }, (StringSplitOptions)num2);
}
throw new NullReferenceException();
}
// Token: 0x0600B0DC RID: 45276 RVA: 0x002953D0 File Offset: 0x002935D0
[Token(Token = "0x600B0DC")]
[Address(RVA = "0xE3A240", Offset = "0xE38C40", VA = "0x180E3A240")]
public static void WriteArray(this Stream stream, byte[] array)
{
int num = stream.ReadByte();
}
// Token: 0x0600B0DD RID: 45277 RVA: 0x002953EC File Offset: 0x002935EC
[Token(Token = "0x600B0DD")]
[Address(RVA = "0x1C880C0", Offset = "0x1C86AC0", VA = "0x181C880C0")]
public static bool IsHostIsAnIPAddress(this Uri uri)
{
int num = 0;
if (!(uri == num))
{
string host = uri.Host;
if (!string.IsNullOrEmpty(host))
{
string text = host.Trim();
bool flag;
if (flag)
{
return true;
}
}
bool flag2;
if (!string.IsNullOrEmpty(uri.Host) && flag2)
{
bool flag3;
return flag3;
}
}
throw new NullReferenceException();
}
// Token: 0x0600B0DE RID: 45278 RVA: 0x00295444 File Offset: 0x00293644
[Token(Token = "0x600B0DE")]
[Address(RVA = "0x1C882D0", Offset = "0x1C86CD0", VA = "0x181C882D0")]
public static bool IsIpV4AddressValid(string address)
{
if (string.IsNullOrEmpty(address))
{
}
string text = address.Trim();
bool flag;
return flag;
}
// Token: 0x0600B0DF RID: 45279 RVA: 0x0029546C File Offset: 0x0029366C
[Token(Token = "0x600B0DF")]
[Address(RVA = "0x1C88380", Offset = "0x1C86D80", VA = "0x181C88380")]
public static bool IsIpV6AddressValid(string address)
{
bool flag;
if (!string.IsNullOrEmpty(address) && flag)
{
bool flag2;
return flag2;
}
throw new NullReferenceException();
}
// Token: 0x0600B0E0 RID: 45280 RVA: 0x00295490 File Offset: 0x00293690
[Token(Token = "0x600B0E0")]
[Address(RVA = "0x1C88FC0", Offset = "0x1C879C0", VA = "0x181C88FC0")]
public static int ToInt32(this string str, int defaultValue = 0)
{
if (str != 0)
{
return int.Parse(str);
}
return defaultValue;
}
// Token: 0x0600B0E1 RID: 45281 RVA: 0x002954AC File Offset: 0x002936AC
[Token(Token = "0x600B0E1")]
[Address(RVA = "0x1C89040", Offset = "0x1C87A40", VA = "0x181C89040")]
public static long ToInt64(this string str, long defaultValue = 0L)
{
if (str != 0)
{
return long.Parse(str);
}
return defaultValue;
}
// Token: 0x0600B0E2 RID: 45282 RVA: 0x002954C8 File Offset: 0x002936C8
[Token(Token = "0x600B0E2")]
[Address(RVA = "0x1C88F10", Offset = "0x1C87910", VA = "0x181C88F10")]
public static DateTime ToDateTime(this string str, [Optional] DateTime defaultValue)
{
if (str != 0)
{
bool flag = DateTime.TryParse(str, defaultValue);
}
return defaultValue;
}
// Token: 0x0600B0E3 RID: 45283 RVA: 0x002954E4 File Offset: 0x002936E4
[Token(Token = "0x600B0E3")]
[Address(RVA = "0x1C890C0", Offset = "0x1C87AC0", VA = "0x181C890C0")]
public static string ToStrOrEmpty(this string str)
{
if (str != 0)
{
return str;
}
return string.Empty;
}
// Token: 0x0600B0E4 RID: 45284 RVA: 0x002954FC File Offset: 0x002936FC
[Token(Token = "0x600B0E4")]
[Address(RVA = "0x1C87D30", Offset = "0x1C86730", VA = "0x181C87D30")]
public static string CalculateMD5Hash(this string input)
{
byte[] asciibytes = input.GetASCIIBytes();
string text = asciibytes.CalculateMD5Hash();
VariableSizedBufferPool.Release(asciibytes);
return text;
}
// Token: 0x0600B0E5 RID: 45285 RVA: 0x00295520 File Offset: 0x00293720
[Token(Token = "0x600B0E5")]
[Address(RVA = "0x1C87B60", Offset = "0x1C86560", VA = "0x181C87B60")]
public static string CalculateMD5Hash(this byte[] input)
{
int num;
do
{
num = 0;
MD5 md = MD5.Create();
byte[] array = md.ComputeHash(input);
int length;
StringBuilder stringBuilder = new StringBuilder(length);
length = array.Length;
if (num < array.Length)
{
num += 32;
num += array;
num++;
}
VariableSizedBufferPool.Release(array);
int hashCode = stringBuilder.GetHashCode();
if (md != 0)
{
}
if (num != -1)
{
}
}
while (num != 0);
throw new IndexOutOfRangeException();
}
// Token: 0x0600B0E6 RID: 45286 RVA: 0x002955A0 File Offset: 0x002937A0
[Token(Token = "0x600B0E6")]
[Address(RVA = "0x1C88CF0", Offset = "0x1C876F0", VA = "0x181C88CF0")]
internal static string Read(this string str, ref int pos, char block, bool needResult = true)
{
Func<char, bool> func = (char ch) => ch != block;
return Extensions.Read(str, ref pos, func, needResult);
}
// Token: 0x0600B0E7 RID: 45287 RVA: 0x002955D8 File Offset: 0x002937D8
[Token(Token = "0x600B0E7")]
[Address(RVA = "0x1C88BE0", Offset = "0x1C875E0", VA = "0x181C88BE0")]
internal static string Read(this string str, ref int pos, Func<char, bool> block, bool needResult = true)
{
int stringLength = str.m_stringLength;
str.SkipWhiteSpace(ref pos);
char c;
if (block(c) != 0)
{
}
if (needResult)
{
}
throw new NullReferenceException();
}
// Token: 0x0600B0E8 RID: 45288 RVA: 0x00295608 File Offset: 0x00293808
[Token(Token = "0x600B0E8")]
[Address(RVA = "0x1C88A20", Offset = "0x1C87420", VA = "0x181C88A20")]
internal static string ReadPossibleQuotedText(this string str, ref int pos)
{
string empty = string.Empty;
if (str != 0)
{
Func<char, bool> <>9__21_ = Extensions.<>c.<>9__21_0;
if (<>9__21_ == 0)
{
Extensions.<>c.<>9__21_0 = delegate(char ch)
{
bool flag;
return flag;
};
}
string text = Extensions.Read(str, ref pos, <>9__21_, true);
}
return empty;
}
// Token: 0x0600B0E9 RID: 45289 RVA: 0x00295658 File Offset: 0x00293858
[Token(Token = "0x600B0E9")]
[Address(RVA = "0x1C88E70", Offset = "0x1C87870", VA = "0x181C88E70")]
internal static void SkipWhiteSpace(this string str, ref int pos)
{
char c;
if (char.IsWhiteSpace(c))
{
}
}
// Token: 0x0600B0EA RID: 45290 RVA: 0x00295674 File Offset: 0x00293874
[Token(Token = "0x600B0EA")]
[Address(RVA = "0x1C89110", Offset = "0x1C87B10", VA = "0x181C89110")]
internal static string TrimAndLower(this string str)
{
if (str != 0)
{
char[] array = new char[str.m_stringLength];
int num = 0;
int num2 = 0;
if (0 < str.m_stringLength)
{
char c = str[num2];
if (!char.IsWhiteSpace(c) && !char.IsControl(c))
{
num++;
char c2 = char.ToLowerInvariant(c);
array[0] = c2;
}
num2++;
}
string text;
return text;
}
throw new IndexOutOfRangeException();
}
// Token: 0x0600B0EB RID: 45291 RVA: 0x002956E4 File Offset: 0x002938E4
[Token(Token = "0x600B0EB")]
[Address(RVA = "0x1C88840", Offset = "0x1C87240", VA = "0x181C88840")]
internal static char? Peek(this string str, int pos)
{
if (pos < str.m_stringLength)
{
char c = str[pos];
}
throw new NullReferenceException();
}
// Token: 0x0600B0EC RID: 45292 RVA: 0x0029570C File Offset: 0x0029390C
[Token(Token = "0x600B0EC")]
[Address(RVA = "0x1C88420", Offset = "0x1C86E20", VA = "0x181C88420")]
internal static List<HeaderValue> ParseOptionalHeader(this string str)
{
List<HeaderValue> list = new List();
if (str != 0)
{
int num = 0;
if (num < str.m_stringLength)
{
Func<char, bool> <>9__25_ = Extensions.<>c.<>9__25_0;
if (<>9__25_ == 0)
{
Extensions.<>c.<>9__25_0 = delegate(char ch)
{
bool flag;
return flag;
};
}
string text = Extensions.Read(str, num, <>9__25_, true).TrimAndLower();
HeaderValue headerValue = new HeaderValue();
headerValue.<Key>k__BackingField = text;
char c = str[-1];
string text2 = str.ReadPossibleQuotedText(num);
headerValue.<Value>k__BackingField = text2;
list.Add(headerValue);
}
}
return list;
}
// Token: 0x0600B0ED RID: 45293 RVA: 0x00295798 File Offset: 0x00293998
[Token(Token = "0x600B0ED")]
[Address(RVA = "0x1C88620", Offset = "0x1C87020", VA = "0x181C88620")]
internal static List<HeaderValue> ParseQualityParams(this string str)
{
List<HeaderValue> list = new List();
if (str != 0)
{
int num = 0;
if (num < str.m_stringLength)
{
Func<char, bool> <>9__26_ = Extensions.<>c.<>9__26_0;
if (<>9__26_ == 0)
{
Extensions.<>c.<>9__26_0 = delegate(char ch)
{
bool flag;
return flag;
};
}
string text = Extensions.Read(str, num, <>9__26_, true).TrimAndLower();
HeaderValue headerValue = new HeaderValue();
headerValue.<Key>k__BackingField = text;
char c = str[-1];
string text2;
headerValue.<Value>k__BackingField = text2;
list.Add(headerValue);
}
}
return list;
}
// Token: 0x0600B0EE RID: 45294 RVA: 0x0029581C File Offset: 0x00293A1C
[Token(Token = "0x600B0EE")]
[Address(RVA = "0x1C888D0", Offset = "0x1C872D0", VA = "0x181C888D0")]
public static void ReadBuffer(this Stream stream, byte[] buffer)
{
int num = 0;
int num2 = buffer.Length;
num2 -= num;
}
// Token: 0x0600B0EF RID: 45295 RVA: 0x0029583C File Offset: 0x00293A3C
[Token(Token = "0x600B0EF")]
[Address(RVA = "0x1C88970", Offset = "0x1C87370", VA = "0x181C88970")]
public static void ReadBuffer(this Stream stream, byte[] buffer, int length)
{
}
// Token: 0x0600B0F0 RID: 45296 RVA: 0x00295854 File Offset: 0x00293A54
[Token(Token = "0x600B0F0")]
[Address(RVA = "0x1C89740", Offset = "0x1C88140", VA = "0x181C89740")]
public static void WriteString(this BufferPoolMemoryStream ms, string str)
{
object obj = Encoding.UTF8.Clone();
byte[] bytes = Encoding.UTF8.GetBytes(str);
int num = ms.ReadByte();
byte[] array;
VariableSizedBufferPool.Release(array);
}
// Token: 0x0600B0F1 RID: 45297 RVA: 0x00295894 File Offset: 0x00293A94
[Token(Token = "0x600B0F1")]
[Address(RVA = "0x1C892A0", Offset = "0x1C87CA0", VA = "0x181C892A0")]
public static void WriteLine(this BufferPoolMemoryStream ms)
{
byte[] eol = HTTPRequest.EOL;
int num = ms.ReadByte();
}
// Token: 0x0600B0F2 RID: 45298 RVA: 0x002958B4 File Offset: 0x00293AB4
[Token(Token = "0x600B0F2")]
[Address(RVA = "0x1C89580", Offset = "0x1C87F80", VA = "0x181C89580")]
public static void WriteLine(this BufferPoolMemoryStream ms, string str)
{
object obj = Encoding.UTF8.Clone();
byte[] bytes = Encoding.UTF8.GetBytes(str);
int num = ms.ReadByte();
byte[] array;
VariableSizedBufferPool.Release(array);
byte[] eol = HTTPRequest.EOL;
int num2 = ms.ReadByte();
}
// Token: 0x0600B0F3 RID: 45299 RVA: 0x00295900 File Offset: 0x00293B00
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600B0F3")]
[Address(RVA = "0x1C89860", Offset = "0x1C88260", VA = "0x181C89860")]
static Extensions()
{
Regex regex = new Regex("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b", RegexOptions.IgnoreCase);
}
// Token: 0x0400741C RID: 29724
[Token(Token = "0x400741C")]
private static readonly Regex validIpV4AddressRegex;
}
}