/// <summary> /// 将ADB回应的二进制数据转换为字符串 /// </summary> /// <param name="response"></param> /// <returns></returns> public static string DataAsString(this AdbResponse response) { try { return(Encoding.UTF8.GetString(response.Data)); } catch { return(null); } }
/// <summary> /// 发送ADB请求 /// </summary> /// <param name="request"></param> /// <param name="readDataWhenOkay"></param> /// <returns></returns> public AdbResponse SendRequest(string request, bool readDataWhenOkay = true) { core.SendRequest(request); byte[] state = core.ReceiveState(); AdbResponse response = new AdbResponse() { State = state.ToAdbResponseState(), }; if (readDataWhenOkay || !response.IsOkay) { response.Data = core.ReceiveData(); } return(response); }