Files
cefsharp/CefSharp/DevTools/DevToolsMethodResponse.cs
T
Alex Maitland fc3a41ea82 DevTools Client - Follow up to #3669
- Improve xml doc
- Reduce code duplication
2021-07-22 15:03:45 +10:00

42 lines
1.0 KiB
C#

// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.IO;
using System.Runtime.Serialization.Json;
using System.Text;
namespace CefSharp.DevTools
{
/// <summary>
/// DevTools Method Response
/// </summary>
public class DevToolsMethodResponse
{
/// <summary>
/// MessageId
/// </summary>
public int MessageId { get; set; }
/// <summary>
/// Success
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Method Response as Json string
/// </summary>
public string ResponseAsJsonString { get; set; }
internal T DeserializeJson<T>(bool ignoreSuccess = false)
{
if (Success || ignoreSuccess)
{
return DevToolsClient.DeserializeJson<T>(ResponseAsJsonString);
}
throw new DevToolsClientException(ResponseAsJsonString);
}
}
}