private static string UrlDecodeStringFromStringInternal(string s, Encoding e) { int length = s.Length; UrlUtility.UrlDecoder urlDecoder = new UrlUtility.UrlDecoder(length, e); for (int i = 0; i < length; i++) { char chr = s[i]; if (chr != '+') { if (chr == '%' && i < length - 2) { if (s[i + 1] != 'u' || i >= length - 5) { int num = UrlUtility.HexToInt(s[i + 1]); int num1 = UrlUtility.HexToInt(s[i + 2]); if (num < 0 || num1 < 0) { goto Label1; } byte num2 = (byte)(num << 4 | num1); i = i + 2; urlDecoder.AddByte(num2); goto Label0; } else { int num3 = UrlUtility.HexToInt(s[i + 2]); int num4 = UrlUtility.HexToInt(s[i + 3]); int num5 = UrlUtility.HexToInt(s[i + 4]); int num6 = UrlUtility.HexToInt(s[i + 5]); if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0) { goto Label1; } chr = (char)((ushort)(num3 << 12 | num4 << 8 | num5 << 4 | num6)); i = i + 5; urlDecoder.AddChar(chr); continue; } } } else { chr = ' '; } Label1: if ((chr & '\uFF80') != 0) { urlDecoder.AddChar(chr); } else { urlDecoder.AddByte((byte)chr); } } return(urlDecoder.GetString()); }
private void FlushBytes() { if (this._numBytes > 0) { UrlUtility.UrlDecoder chars = this; chars._numChars = chars._numChars + this._encoding.GetChars(this._byteBuffer, 0, this._numBytes, this._charBuffer, this._numChars); this._numBytes = 0; } }
internal void AddChar(char ch) { if (this._numBytes > 0) { this.FlushBytes(); } UrlUtility.UrlDecoder urlDecoder = this; int num = urlDecoder._numChars; int num1 = num; urlDecoder._numChars = num + 1; this._charBuffer[num1] = ch; }
internal void AddByte(byte b) { if (this._byteBuffer == null) { this._byteBuffer = new byte[this._bufferSize]; } UrlUtility.UrlDecoder urlDecoder = this; int num = urlDecoder._numBytes; int num1 = num; urlDecoder._numBytes = num + 1; this._byteBuffer[num1] = b; }
private static string UrlDecodeStringFromStringInternal(string s, Encoding e) { int length = s.Length; UrlUtility.UrlDecoder urlDecoder = new UrlUtility.UrlDecoder(length, e); for (int i = 0; i < length; i++) { char chr = s[i]; if (chr != '+') { if (chr == '%' && i < length - 2) { if (s[i + 1] != 'u' || i >= length - 5) { int num = UrlUtility.HexToInt(s[i + 1]); int num1 = UrlUtility.HexToInt(s[i + 2]); if (num < 0 || num1 < 0) { goto Label1; } byte num2 = (byte)(num << 4 | num1); i = i + 2; urlDecoder.AddByte(num2); goto Label0; } else { int num3 = UrlUtility.HexToInt(s[i + 2]); int num4 = UrlUtility.HexToInt(s[i + 3]); int num5 = UrlUtility.HexToInt(s[i + 4]); int num6 = UrlUtility.HexToInt(s[i + 5]); if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0) { goto Label1; } chr = (char)((ushort)(num3 << 12 | num4 << 8 | num5 << 4 | num6)); i = i + 5; urlDecoder.AddChar(chr); continue; } } } else { chr = ' '; } Label1: if ((chr & '\uFF80') != 0) { urlDecoder.AddChar(chr); } else { urlDecoder.AddByte((byte)chr); } } return urlDecoder.GetString(); }