public static void ReadAllText(string path, Encoding encoding, Action<Exception, string> callback)
{
if (callback == null) throw new ArgumentNullException("callback");
if (encoding == null) throw new ArgumentNullException("encoding");
FileReadAllAsync(path, (ex, buffer) =>
{
try
{
if (ex != null) throw ex;
var text = encoding.GetString(buffer);
EventLoop.Pend(() => callback(null, text));
} catch (Exception ex2)
{
EventLoop.Pend(() => callback(ex2, null));
}
});
}