public static string PercentDecode(this string me) { Text.Builder result = null; if (me.NotNull()) { Generic.IEnumerator <char> enumerator = me.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current == '%') { char[] characters = new char[] { enumerator.Next(), enumerator.Next() }; byte value; if (byte.TryParse(new string(characters), System.Globalization.NumberStyles.HexNumber, System.Globalization.NumberFormatInfo.InvariantInfo, out value)) { result += System.Text.Encoding.ASCII.GetChars(new byte[] { value }); } else { result += "%" + characters; } } else { result += enumerator.Current; } } } return(result); }
public static IAsyncEnumerator <T> Create <T>(Generic.IEnumerator <T> enumerator) { return(enumerator.NotNull() ? AsyncEnumerator.Create(() => Tasks.Task.FromResult(enumerator.Next()), enumerator) : AsyncEnumerator.Empty <T>()); }
public static Generic.IEnumerator <T> Create <T>(Generic.IEnumerator <T> enumerator) { return(enumerator.NotNull() ? Enumerator.Create(() => enumerator.Next(), enumerator.Reset, enumerator.Dispose) : Enumerator.Empty <T>()); }