Exemple #1
0
 private static string UrlDecodeStringFromStringInternal(string s, Encoding e)
 {
     int length = s.Length;
     HttpUtil.UrlDecoder urlDecoder = new HttpUtil.UrlDecoder(length, e);
     int i = 0;
     while (i < length)
     {
         char c = s[i];
         if (c == '+')
         {
             c = ' ';
             goto IL_106;
         }
         if (c != '%' || i >= length - 2)
         {
             goto IL_106;
         }
         if (s[i + 1] == 'u' && i < length - 5)
         {
             int num = HttpUtil.HexToInt(s[i + 2]);
             int num2 = HttpUtil.HexToInt(s[i + 3]);
             int num3 = HttpUtil.HexToInt(s[i + 4]);
             int num4 = HttpUtil.HexToInt(s[i + 5]);
             if (num < 0 || num2 < 0 || num3 < 0 || num4 < 0)
             {
                 goto IL_106;
             }
             c = (char)(num << 12 | num2 << 8 | num3 << 4 | num4);
             i += 5;
             urlDecoder.AddChar(c);
         }
         else
         {
             int num5 = HttpUtil.HexToInt(s[i + 1]);
             int num6 = HttpUtil.HexToInt(s[i + 2]);
             if (num5 < 0 || num6 < 0)
             {
                 goto IL_106;
             }
             byte b = (byte)(num5 << 4 | num6);
             i += 2;
             urlDecoder.AddByte(b);
         }
     IL_120:
         i++;
         continue;
     IL_106:
         if ((c & 'タ') == '\0')
         {
             urlDecoder.AddByte((byte)c);
             goto IL_120;
         }
         urlDecoder.AddChar(c);
         goto IL_120;
     }
     return urlDecoder.GetString();
 }
Exemple #2
0
 private static string UrlDecodeStringFromBytesInternal(byte[] buf, int offset, int count, Encoding e)
 {
     HttpUtil.UrlDecoder urlDecoder = new HttpUtil.UrlDecoder(count, e);
     int i = 0;
     while (i < count)
     {
         int num = offset + i;
         byte b = buf[num];
         if (b == 43)
         {
             b = 32;
             goto IL_DA;
         }
         if (b != 37 || i >= count - 2)
         {
             goto IL_DA;
         }
         if (buf[num + 1] == 117 && i < count - 5)
         {
             int num2 = HttpUtil.HexToInt((char)buf[num + 2]);
             int num3 = HttpUtil.HexToInt((char)buf[num + 3]);
             int num4 = HttpUtil.HexToInt((char)buf[num + 4]);
             int num5 = HttpUtil.HexToInt((char)buf[num + 5]);
             if (num2 < 0 || num3 < 0 || num4 < 0 || num5 < 0)
             {
                 goto IL_DA;
             }
             char ch = (char)(num2 << 12 | num3 << 8 | num4 << 4 | num5);
             i += 5;
             urlDecoder.AddChar(ch);
         }
         else
         {
             int num6 = HttpUtil.HexToInt((char)buf[num + 1]);
             int num7 = HttpUtil.HexToInt((char)buf[num + 2]);
             if (num6 >= 0 && num7 >= 0)
             {
                 b = (byte)(num6 << 4 | num7);
                 i += 2;
                 goto IL_DA;
             }
             goto IL_DA;
         }
     IL_E1:
         i++;
         continue;
     IL_DA:
         urlDecoder.AddByte(b);
         goto IL_E1;
     }
     return urlDecoder.GetString();
 }
Exemple #3
0
 internal static string CollapsePercentUFromStringInternal(string s, Encoding e)
 {
     int length = s.Length;
     HttpUtil.UrlDecoder urlDecoder = new HttpUtil.UrlDecoder(length, e);
     int num = s.IndexOf("%u", StringComparison.Ordinal);
     if (num == -1)
     {
         return s;
     }
     int i = 0;
     while (i < length)
     {
         char c = s[i];
         if (c != '%' || i >= length - 5 || s[i + 1] != 'u')
         {
             goto IL_C8;
         }
         int num2 = HttpUtil.HexToInt(s[i + 2]);
         int num3 = HttpUtil.HexToInt(s[i + 3]);
         int num4 = HttpUtil.HexToInt(s[i + 4]);
         int num5 = HttpUtil.HexToInt(s[i + 5]);
         if (num2 < 0 || num3 < 0 || num4 < 0 || num5 < 0)
         {
             goto IL_C8;
         }
         c = (char)(num2 << 12 | num3 << 8 | num4 << 4 | num5);
         i += 5;
         urlDecoder.AddChar(c);
     IL_E5:
         i++;
         continue;
     IL_C8:
         if ((c & 'タ') == '\0')
         {
             urlDecoder.AddByte((byte)c);
             goto IL_E5;
         }
         urlDecoder.AddChar(c);
         goto IL_E5;
     }
     return urlDecoder.GetString();
 }