public unsafe virtual void ReadValue(byte* stream, int* pos, int length, out Guid value) { byte* readpos = stream + *pos; *pos += 16; if (*pos >= length) { value = Guid.Empty; return; } var bytes = new byte[16]; ToolsMethods.MemoryCopy(readpos, bytes, 0, 16); value = new Guid(bytes); }
public string GetWildDomain(string host) { string[] result; if (!ToolsMethods.WildMatchByPtr(host, Pattern, out result)) { return(null); } var sb = new StringBuilder(RedirectMatch); for (int i = 0; i < result.Length; i++) { sb.Replace($"{{${i}}}", result[i] + ""); } return(sb.ToString()); }
[SecurityCritical] // auto-generated public static string ToBase64String(byte[] data) { int datalen = data.Length; if (datalen == 0) { return(string.Empty); } int strLen = datalen / 3 * 4; int lengthmod3 = datalen % 3; if (lengthmod3 != 0) { strLen += lengthmod3 + 1; } string out_chs = ToolsMethods.FastAllocateString(strLen); UnsafeToBase64String(data, datalen - lengthmod3, lengthmod3, out_chs); return(out_chs); }
public unsafe virtual void ReadValue(byte* stream, int* pos, int length, out byte[] value) { byte* readstart = stream + *pos; byte by; ReadValue(stream, pos, length, out by); int bytelength; switch (by) { case 254: { ushort t; ReadValue(stream, pos, length, out t); bytelength = t; break; } case 255: { ReadValue(stream, pos, length, out bytelength); break; } default: { bytelength = by; break; } } byte[] result = new byte[bytelength]; byte* copyStart = stream + *pos; *pos += bytelength; if (*pos >= length) { value = EmptyBytes; return; } ToolsMethods.MemoryCopy(copyStart, result, 0, bytelength); value = result; }